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

[BUG]: Camera State (Idle, Streaming, Recording) doesn't update as features are enabled / disabled #232

Closed
NickM-27 opened this issue Mar 28, 2022 · 4 comments · Fixed by #233
Assignees
Labels
bug Something isn't working

Comments

@NickM-27
Copy link
Sponsor Collaborator

Steps to reproduce:

  1. HA starts with camera recording disabled so state is set to idle.
  2. Recording is enabled
  3. The camera state remains at idle when it should be recording

@dermotduffy You can assign to me as I intend to fix this, still brainstorming a good way to key in to other entities / state in general to trigger an update since currently the state is only set in init.

@dermotduffy
Copy link
Collaborator

Thanks @NickM-27 . Yes, I noticed this in the past also. Sounds good, thanks for taking a look!

@dermotduffy dermotduffy added the bug Something isn't working label Mar 28, 2022
@NickM-27
Copy link
Sponsor Collaborator Author

@dermotduffy do you have any recommendations? Is it possible / good idea to link into the recording switch or use the recording switch updates to trigger updates in other entities?

@dermotduffy
Copy link
Collaborator

Two spur-of-moment ideas:

  • In the switch code, detect the change and send a HA signal (example) using a dispatcher. Connect/Listen for that signal from the camera.

  • Or have the camera subscribe to MQTT separately (I'd first try to have the camera just inherit from FrigateMQTTEntity and see if I can get that to work, or otherwise re-use/abstract some code out and integrate it into the camera, e.g. using async_subscribe_topics by hand).

Whilst the second option may be more duplication (e.g. if you can't get just inheriting from FrigateMQTTEntity to work), I think it's the better option. Otherwise, if you directly link the entity functionality like option 1, the camera state would not longer change when/if the user disables the switch entity (and so that's generally not a recommended path).

@NickM-27
Copy link
Sponsor Collaborator Author

NickM-27 commented Mar 28, 2022

The second one works implementing FrigateMQTTEntity Also seeing a bug where the mqtt state was coming back in format b'OFF' which is weird. Will fix that in this PR as well

EDIT: Seems to be behaving differently in the camera class for some reason 🤔

dermotduffy pushed a commit that referenced this issue Mar 28, 2022
* Frigate camera to inherit mqtt entity to get updates to record topic

* Supply frigate_config

* Fix reading of payload property

* Fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants