Add binary sensors for netatmo NIS and NACamDoorTag devices
Proposed change
Add binary sensors for NIS and NACamDoorTag devices, Device NIS: reachable monitoring: On/Off sound: True if the siren souding (alert) (webhook with the event home_alarm)
Device NACamDoorTag: reachable opening : True if the window/door is open or webhook tag_open is received motion: True if webhook tag_big_move is received vibration: True if webhook tag_small_move is received
After, I'll update sensors.py for these devices, if you are ok with these updates First commit: binary sensors Second commit: sensors
I have done this update for my heating
Type of change
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [x ] New feature (which adds functionality to an existing integration)
- [ ] Deprecation (breaking change to happen in the future)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ x] Code quality improvements to existing code or addition of tests
Additional information
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request:
Checklist
- [ x] The code change is tested and works locally.
- [ x] Local tests pass. Your PR cannot be merged unless tests pass
- [ x] There is no commented out code in this PR.
- [ x] I have followed the development checklist
- [ x] I have followed the perfect PR recommendations
- [ x] The code has been formatted using Ruff (
ruff format homeassistant tests) - [ x] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for www.home-assistant.io
If the code communicates with devices, web services, or third-party tools:
- [ ] The manifest file has all fields filled out correctly.
Updated and included derived files by running:python3 -m script.hassfest. - [ ] New or updated dependencies have been added to
requirements_all.txt.
Updated by runningpython3 -m script.gen_requirements_all. - [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
To help with the load of incoming pull requests:
- [ ] I have reviewed two other open pull requests in this repository.
Hey there @cgtobi, mind taking a look at this pull request as it has been labeled with an integration (netatmo) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of netatmo can trigger bot actions by commenting:
@home-assistant closeCloses the pull request.@home-assistant rename Awesome new titleRenames the pull request.@home-assistant reopenReopen the pull request.@home-assistant unassign netatmoRemoves the current integration label and assignees on the pull request, add the integration domain after the command.@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.
Nuts !!!! Will make happy tons of netatmo users !
💯 I've been using this change proposal in a custom component for a few weeks now, it works fine ! Thanks
To me those are not sensors in a state kind of way since they represent events. That is the only issue that I have with this.
Hello,
my first goal is to have the status for a window, because I'm using this state for my heating. So, it's required to have the status givent by the API homestatus and updated by the events.
I use a custom component with theses sensors and some binary sensors (DOORTAG: => OPENING, MOTION, VIBRATION, SIREN => SAFETY, SOUND) (these sensors are not yet delivered).
I can update and push the binary sensors.
So, how can we advanced on this topic ? Have you an another way to implement this goal ?
Thanks
Again, in my opinion those are momentary events and not states that persist. That is the reason that they were removed quite a while ago. What qualifies this as sensors to you?
Hello,
the call /homestatus on the Netatmo's API return for:
NIS:
- reachable:true
- status:"no_sound" (enum values: "now_news", "no_sound", "warning", "sound", "playing_record_0", "playing_record_1", "playing_record_2", "playing_record_3")
- monitoring:"off"
NACamDoorTag:
- reachable:true
- status:"open" (enum : "no_news", "calibrating", "undefined", "closed", "open", "calibration_failed", "maintenance", "weak_signal")
So, I thinks these attributes can be seen as diagnostic sensors.
So, theses states are given by homestatus and by some events:
- tag_open, tag_big_move and tag_small_move for NACamDoorTag
- home_alarm when the state of the siren change (on/off) in the app "Netatmo Security". Require a force_update in the Netamo component.
After, about the binary sensors. Depend the reachbility, we can compute a state for the opening, motion and vibration sensors. And these sensors can be used for alerts and heating products (aka Versatile Thermostat and opened/closed windows)
But, If I follow yours ideas, I'm ok with the fact that the motion and vibration are not sensors. But, for the others (OPENING (=NACamDoorTag.status) , SAFETY (NIS.monitoring) and SOUND (NIS.status), they can be used as binary sensors.
And If i remember, (I can check later), when the camera is deactivated, the webhooks does'nt work. The only way to update a windows's state is the call homestatus.
Hello, so, I confirm when the camera is off, the webhook are not received. So, the status for a Door Tag can be updated by the call 'api/homestatus'
Now, I confirm that these status must be sensors.
It's does'nt work only by webhook.
Thanks for your responses.
This would be so awesome to have :) Thanks for the work.
I've marked this PR, as changes are requested that need to be processed. Please un-draft it once it is ready for review again by clicking the "Ready for review" button.
Thanks! 👍
../Frenck
I still don’t agree that binary sensors are the right way. Please consider implementing event entities instead.