Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preset configuration lost from time to time #484

Open
viciovb opened this issue Dec 16, 2023 · 32 comments
Open

Preset configuration lost from time to time #484

viciovb opened this issue Dec 16, 2023 · 32 comments
Labels
Help wanted Extra attention is needed

Comments

@viciovb
Copy link

viciovb commented Dec 16, 2023

Description

I have 3 C200 camera and automation in HA that move them in 2 different presets I've created in each camera.

Very often the preset configuration disappear and if I look at my automation I can't see the two saved presets anymore. I have to reinstall the cameras each time.

I'm not sure if thia happens after I turn privacy mode on for a long time or it's random

Reproduction Steps

Create two presets in a camera
Create an automation in HA that move the camera to those presets
Turn on the camera privacy mode
Check if the automation shows the presets

Expected behavior

The presets should be visible and available even if the camera is in privacy mode

If applicable, add error logs.

No response

Device Firmware

1.3.9

Integration Version

5.4.12

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

HA OS on a Proxmox VM

Search for similar issues

Yes

Additional information

No response

@krue81
Copy link

krue81 commented Jan 22, 2024

I think, maybe, this is related to this issue: #443

@JurajNyiri
Copy link
Owner

JurajNyiri commented Jan 22, 2024

Move to preset select entity is not available when the camera is in privacy mode. This was introduced in https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/releases/tag/5.3.0 as a feature. As soon as camera moves away from privacy mode the entity is available for control again.
Here is a simple script that has been working for me since the creation of this integration:

alias: "Privacy: OFF"
sequence:
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.office_privacy
  - service: select.select_option
    data:
      option: Room
    target:
      entity_id: select.office_move_to_preset

@JurajNyiri JurajNyiri added the Invalid Bug/Enhancement not related to integration or already available. label Jan 22, 2024
@viciovb
Copy link
Author

viciovb commented Jan 22, 2024

I thought the same and that's why my automation wait 2 minutes after disabling privacy mode to move my camera to a preset but often that doesn't work and the preset option is unavailable even after I turn the privacy mode off

@krue81
Copy link

krue81 commented Jan 22, 2024

I thought the same and that's why my automation wait 2 minutes after disabling privacy mode to move my camera to a preset but often that doesn't work and the preset option is unavailable even after I turn the privacy mode off

Same here:
image

This is 2 minutes after turning privacy (privacidad) off, the preset list (apuntar a) remains disabled.

This happens randomly on all my 4 C200.

@viciovb
Copy link
Author

viciovb commented Jan 22, 2024

I'm not entire sure if it depends on how long privacy mode has been on or not

@JurajNyiri
Copy link
Owner

JurajNyiri commented Jan 22, 2024

@krue81 check logs. It might be unavailable because of different reason, probably the camera is unavailable due to network issues.

@krue81
Copy link

krue81 commented Jan 22, 2024

@krue81 check logs. It might be unavailable because of different reason, probably the camera is unavailable due to network issues.

This is the only error that appears on the log:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:280
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: January 21, 2024 at 12:45:24 PM (9 occurrences)
Last logged: 7:16:35 AM

[140609969316416] Option cuarto is not valid for select.escalas_move_to_preset
[140609969316416] Option privacy is not valid for select.escalas_move_to_preset
[140609969316416] Option escalas is not valid for select.escalas_move_to_preset

The camera has good network connection: I can toggle quickly between privacy and normal mode, and can watch the stream both via WebRTC card and the Tapo App.

This behavior started to appear like 3 or 4 months ago... before that, the cameras switched seamlessly from and to privacy mode and without any issue with the presets list

@JurajNyiri
Copy link
Owner

In the screenshot provided the entities are unavailable. That could be due to privacy mode turned on or the camera being unavailable (in which case there would be a log message).

@krue81
Copy link

krue81 commented Jan 22, 2024

In the screenshot provided the entities are unavailable. That could be due to privacy mode turned on or the camera being unavailable (in which case there would be a log message).

The camera is available:
image

Privacy mode is turned off:
image

But the select for move to preset is unavailable until I reinstall the camera:
image

If I check the state of the camera, it reports correctly the presets I have saved... it is only the select that is unavailable:

access_token: XXX
model_name: C200
brand: TP-Link
motion_detection: "on"
frontend_stream_type: hls
device_type: SMART.IPCAMERA
device_model: C200
device_name: C200 1.0
device_info: C200 1.0 IPC
hw_version: "1.0"
sw_version: 1.3.9 Build 231019 Rel.37378n(5553)
device_alias: Escalas
avatar: Entrance
longitude: 0
latitude: 0
has_set_location_info: 0
features: "3"
barcode: ""
mac: XXX
dev_id: XXX
oem_id: XXX
hw_desc: "XXX"
alarm: "on"
user: XXX
presets:
  "1": privacy
  "2": jorge
  "3": cuarto
  "4": piso
  "5": diana
  "6": escalas
record_plan:
  sunday: "[\"0000-2400:1\"]"
  monday: "[\"0000-2400:1\"]"
  tuesday: "[\"0000-2400:1\"]"
  wednesday: "[\"0000-2400:1\"]"
  thursday: "[\"0000-2400:1\"]"
  friday: "[\"0000-2400:1\"]"
  saturday: "[\"0000-2400:1\"]"
entity_picture: >-
  /api/camera_proxy/camera.escaleras_hd?token=XXX
icon: mdi:cctv
friendly_name: Escalas HD Stream
supported_features: 3

@JurajNyiri JurajNyiri reopened this Jan 22, 2024
@JurajNyiri
Copy link
Owner

I see, that shouldn't be the case. Could you please enable debug logs for the integration and post them when this happens?

@krue81
Copy link

krue81 commented Jan 22, 2024

I see, that shouldn't be the case. Could you please enable debug logs for the integration and post them when this happens?

logtapo.txt

This is the log for a couple of minutes... I see references to my other 3 cameras (that right now are working ok), but do not see any reference to the one that is showing this issue right now (it is called camera.escalas)

@sallygal1
Copy link

Hello, I'm having the same problems. The select is there, the presets are there but the select does not let me choose any presets. Also seeing the same errors Option privacy is not valid for.

@krue81
Copy link

krue81 commented Jan 24, 2024

I think, at least in my case, that this could be related to #488 ... as yesterday I reinstalled the problematic camera (I've been having the same problems with all my 4 cameras, randomly), and adjusted my home and away automations, so they send the commands to the cameras sequentially (turn privacy off then turn led on then move to defined preset, etc...) as they were configured to send the commands in parallel for each the 4 cameras. I did some testing and for the past 24h they been working as expected, with no issues going to and from privacy mode and always showing the preset list (for now).

Will be doing more testing to check if that indeed was the problem.

@krue81
Copy link

krue81 commented Jan 26, 2024

I think, at least in my case, that this could be related to #488 ... as yesterday I reinstalled the problematic camera (I've been having the same problems with all my 4 cameras, randomly), and adjusted my home and away automations, so they send the commands to the cameras sequentially (turn privacy off then turn led on then move to defined preset, etc...) as they were configured to send the commands in parallel for each the 4 cameras. I did some testing and for the past 24h they been working as expected, with no issues going to and from privacy mode and always showing the preset list (for now).

Will be doing more testing to check if that indeed was the problem.

Just a heads up... putting my automations with commands in parallel worked for a day and a half... today, I woke up with two of my four cameras missing the move-to-preset dropdown/select... So, the issue still remains and is not solved by sending single commands to the cameras (even with delay between them) to prevent the authentication error...

@JurajNyiri JurajNyiri removed the Invalid Bug/Enhancement not related to integration or already available. label Mar 2, 2024
@JurajNyiri
Copy link
Owner

To move this issue forwards we will need debug logs with the information of when the presets went unavailable as well as if there were any automations executed at that time.

@JurajNyiri JurajNyiri added the Help wanted Extra attention is needed label Mar 2, 2024
@MassiPi
Copy link

MassiPi commented Apr 28, 2024

to me this issue is sourcing when the integration is reloaded and if this happens too quick the cameras aren't loaded correctly.
Indeed, i get the error restarting HA but honestly (at least in my case) i get errors also reloading the single cams.
Could you please check if you can reload cameras without issues?
Thanks

@JurajNyiri
Copy link
Owner

I was looking at this again today trying to replicate, but I was not able to, I tried reloading, switching privacy mode, rebooting camera... it works in all the cases.

If we find a way how to reliably replicate this I can probably fix it.

@MassiPi
Copy link

MassiPi commented Jul 5, 2024

last time i tried it was almost 100% at an HA reboot to loose at least one camera (i have three)
let me try again this evening, i'll let you know

@viciovb
Copy link
Author

viciovb commented Jul 5, 2024

Can you try to:

  1. create 2 viewpoints
  2. on HA create an automation that moves the camera to viewpoint 1 and then turns privacy on
  3. create another automation that turns privacy off and move the camera to viewpoint 2

If you wait a few hours between step 2 and 3 when you turn privacy off the automation doesn't find the viewpoint 2 so the camera doesn't move (at least this is what happens to me)

@JurajNyiri
Copy link
Owner

JurajNyiri commented Jul 20, 2024

@viciovb trying this now, lets see how it goes, moved to one of the presets, turned on privacy mode...

Screenshot 2024-07-20 at 14 35 13

Trying with 2 cameras with very different fws.

C200
Firmware: 1.3.13 Build 240327 Rel.63336n(4555)
Hardware: 3.0

C200
Firmware: 1.1.16 Build 211209 Rel.37726n(4555)
Hardware: 1.0

@JurajNyiri
Copy link
Owner

I was not able to replicate this, even with it running the whole day and being in privacy mode.

@MassiPi
Copy link

MassiPi commented Jul 22, 2024

i still get random:

Error executing script. Error for if at pos 1: Option Normal is not valid for entity select.livingcamera_move_to_preset, valid options are:

and my automations have 30s delay between one step and another.

do you think we have any flag to check about completion of changing states?
i mean, for example, moving from one preset to another complete, toggling privacy mode complete. I assume when in privacy mode the camera is not returning the list of presets (is it?) and if the privacy toggling is not complete you can get the error (just brainstorming..)

@JurajNyiri
Copy link
Owner

It is returning presets when in privacy mode.

@MassiPi
Copy link

MassiPi commented Jul 22, 2024

i assumed not being visible in the web interface they were not returned..
well it seems at a certain point in any case presets are cleared out if i get those errors :)
i get errors when executing automations, i can't think about something different than when using the cam directly, but maybe you have some ideas..
and i put 30 seconds idle between each step (toggle privacy - move to preset - in both directions)

@JurajNyiri
Copy link
Owner

That is the issue I am failing to replicate - if they get cleared, camera did not return them at some point. I need to find the way to replicate this to find the root cause or someone else needs to find the fix who is experiencing this.

@MassiPi
Copy link

MassiPi commented Jul 22, 2024

i just need to put some attention to this being at home, i've been fighting with this error for months.. i'll try to put some debugging here and there..

@MassiPi
Copy link

MassiPi commented Jul 23, 2024

could you please try if you get the error:

  • put your cam in a preset position and enable privacy mode
  • setup an automation that 1) turns off privacy mode 2) turns the cam to another preset position

I commonly get error at this stage. Not every time, not for every cam, but i commonly find my cams with privacy mode disabled, in the old preset position and with the error in the log file. I partially fixed with a delay in the middle, but i still get the error now and then so maybe this can replicate the issue.. i hope :)

@lv913
Copy link

lv913 commented Jul 27, 2024

I don't know if this can be somehow related, if it's a bug or a feature, but when I restart HA while a camera is powered off all its preset positions are forgotten. I need to power on the camera, manually rediscover it from the integration and then it works again.
Is this a desired behaviour?

@JurajNyiri
Copy link
Owner

JurajNyiri commented Jul 28, 2024

@lv913 Yes that works as expected. If camera is offline, integration cannot load presets or any other data from it.

@lv913
Copy link

lv913 commented Jul 28, 2024

@JurajNyiri Would it be possible to allow the integration to remember those settings across reboots? Otherwise it's always needed for me to perform a manual rescan of devices, when they come back online, before being able to use them.

@JurajNyiri
Copy link
Owner

Manual rescan is not needed. Once the camera is online it should be picked up by ha automatically.

@MassiPi
Copy link

MassiPi commented Jul 30, 2024

for me it is enough to do a clean restart of ha (for example, after having updated a HACS integration) to lose presets of at least one of my tapos. So i need to manually reload the cam until it works. I understand i have to keep it this way, i'll see if i can schedule a reload somehow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants