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

poll sensors/switches when the plugin starts. #5

Open
lolorc opened this issue Feb 5, 2018 · 4 comments
Open

poll sensors/switches when the plugin starts. #5

lolorc opened this issue Feb 5, 2018 · 4 comments

Comments

@lolorc
Copy link

lolorc commented Feb 5, 2018

when HA starts, is there a way to make it poll every registered sensors ?
Sensors don’t talk quite often if there’s no significant changes, I guess I could restore states from before but I’d prefer to poll them instead.
Is that possible ?

@alexbarcelo
Copy link
Contributor

expanding on this issue, I use Xiaomi Aqara wall switches and sometimes the messages are lost. That means that Home Assistant tells a certain state (switch on) but the real state is the other way around. It is cumbersome.

I was planning to add this feature, but was unable to find the command of "get state of a switch" here. Any advice on how to support that feature? Easiest way to achieve that? A safe poll (say, every 5 minutes, and make the interval configurable) seems to be robust and IMHO it would not saturate the zigbee network.

@ISO-B
Copy link
Collaborator

ISO-B commented Feb 16, 2018

You can ask values from device using command 0x0100. You need to know endpoint, cluster and parameter id. You can find cluster id and parameter from Zigbee cluster documentation (I have been using document JN-UG-3115)

pyzigate has function for that, its called read_attribute. It should have good enough comment to get you started. (https://github.com/elric91/ZiGate/blob/54bc898b00d692a0183e8f7cd354b40ca0a103a8/pyzigate/commands_helpers.py#L5)

If you need to findout which cluster and endpoints your device have, take a look for issue #1. There is commands for those.

@ISO-B
Copy link
Collaborator

ISO-B commented Feb 18, 2018

It could be possible to send polling command after device is initialized on hass. There is two problems:

  1. Some devices won't process zigbee commands without pushing button, example Heiman motion sensor. Xiaomi Aqara motion sensor gives response 8702 : APS Data Confirm Fail. I don't have any switches so I cant test how those work.
  2. User would have to specify cluster and attribute to configuration file so we could request right parameter. Most cases probably sensor type would be enough, since basic data almost always is on same attribute.

Anyone having any progress with this?

@cmorlok
Copy link
Contributor

cmorlok commented Apr 10, 2018

Not exactly your preferred solution, but good enough for me: #22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants