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

ZHA: Hue Motion sensors report temp/luminosity but not motion #19200

Closed
irl opened this issue Dec 11, 2018 · 42 comments
Closed

ZHA: Hue Motion sensors report temp/luminosity but not motion #19200

irl opened this issue Dec 11, 2018 · 42 comments

Comments

@irl
Copy link

irl commented Dec 11, 2018

Home Assistant release with the issue:
0.83.3

Operating environment (Hass.io/Docker/Windows/etc.):
Debian 9.

Component/platform:
https://www.home-assistant.io/components/zha/

Description of problem:
I am using an Elelabs stick with the ZHA component. I have joined two Phillips Hue Motion Sensors to the network successfully. They happily report luminosity and temperature at regular intervals. The motion is stuck on always detected. These did work when I first joined them, but have been stuck since the first restart of Home Assistant.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

zha:
    usb_path: /dev/ttyUSB0
    database_path: /home/homeassistant/.homeassistant/zigbee.db

Traceback (if applicable):

Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
    result = coro.throw(exc)
  File "/srv/homeassistant/lib/python3.5/site-packages/bellows/zigbee/application.py", line 241, in request
    v = await send_fut
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
zigpy.exceptions.DeliveryError: Message send failure: EmberStatus.DELIVERY_FAILED
2018-12-11 18:37:14 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
    result = coro.throw(exc)
  File "/srv/homeassistant/lib/python3.5/site-packages/bellows/zigbee/application.py", line 241, in request
    v = await send_fut
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
zigpy.exceptions.DeliveryError: Message send failure: EmberStatus.DELIVERY_FAILED

Additional information:

@dmulcahey
Copy link
Contributor

Can you remove and rejoin one of these and add the simple descriptor log entry here for the device so I can see its signature?

@irl
Copy link
Author

irl commented Dec 12, 2018

Where would the log entry appear? Is that in home-assistant.log?

@irl
Copy link
Author

irl commented Dec 12, 2018

2018-12-12 15:10:28 INFO (MainThread) [homeassistant.components.zha] Permitting joins for 60s
2018-12-12 15:10:36 INFO (MainThread) [zigpy.application] Device 0xdf04 (00:17:88:01:02:02:66:b4) joined the network
2018-12-12 15:10:36 INFO (MainThread) [zigpy.device] [0xdf04] Discovering endpoints
Tries remaining: 3
2018-12-12 15:10:37 INFO (MainThread) [zigpy.application] Device 0xdf04 (00:17:88:01:02:02:66:b4) left the network
2018-12-12 15:10:37 INFO (MainThread) [zigpy.device] [0xdf04] Discovered endpoints: [2, 1]
2018-12-12 15:10:37 INFO (MainThread) [zigpy.endpoint] [0xdf04:1] Discovering endpoint information
Tries remaining: 3
2018-12-12 15:10:37 INFO (MainThread) [zigpy.application] Device 0xdf04 (00:17:88:01:02:02:66:b4) left the network
2018-12-12 15:10:47 INFO (MainThread) [zigpy.application] Device 0xdf04 (00:17:88:01:02:02:66:b4) joined the network
2018-12-12 15:10:47 INFO (MainThread) [zigpy.application] Device 0xdf04 (00:17:88:01:02:02:66:b4) joined the network
2018-12-12 15:10:47 INFO (MainThread) [zigpy.application] Device 0xdf04 (00:17:88:01:02:02:66:b4) joined the network
Tries remaining: 2
2018-12-12 15:10:53 INFO (MainThread) [zigpy.endpoint] [0xdf04:1] Discovered endpoint information: <SimpleDescriptor endpoint=1 profile=49246 device_type=2128 device_version=2 input_clusters=[0] output_clusters=[0, 3, 4, 6, 8, 768, 5]>
2018-12-12 15:10:54 INFO (MainThread) [zigpy.endpoint] [0xdf04:2] Discovering endpoint information
Tries remaining: 3
2018-12-12 15:10:54 INFO (MainThread) [zigpy.endpoint] [0xdf04:2] Discovered endpoint information: <SimpleDescriptor endpoint=2 profile=260 device_type=263 device_version=0 input_clusters=[0, 1, 3, 1030, 1024, 1026] output_clusters=[25]>
2018-12-12 15:10:55 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.zha
2018-12-12 15:10:55 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zha
2018-12-12 15:10:55 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zha
2018-12-12 15:11:09 WARNING (MainThread) [zigpy.zcl] Data remains after deserializing ZCL frame
2018-12-12 15:10:57 WARNING (MainThread) [zigpy.zcl] Data remains after deserializing ZCL frame
2018-12-12 15:11:22 WARNING (MainThread) [zigpy.zcl] Data remains after deserializing ZCL frame

@dmulcahey
Copy link
Contributor

Thanks... this needs a code change I believe. Occupancy clusters need to be mapped to entities for this because this device implements the Occupancy cluster and not On/Off or IAS Zone. I have this working locally and I will get a PR open to support Occupancy devices as soon as the others that I have open are accepted / merged. Stay tuned!

@irl
Copy link
Author

irl commented Dec 12, 2018

Thanks!

As a data point, disconnecting and rejoining it did not cause it to start working again, still stuck on always triggered.

I am happy to test out a patch if you have one, to see it with the real device.

@irl
Copy link
Author

irl commented Dec 12, 2018

I figured out why it looked like it worked but actually wasn't working. The assumed state at startup is clear, which then goes to triggered as soon as the first update happens, so it actually never worked, I was just rebooting it a lot when I first set it up (but the temp+luminosity still did work fine). So yes, your explanation makes sense @dmulcahey.

@dmulcahey
Copy link
Contributor

Awesome. I’ll let you know when you I have the PR opened

@dmulcahey
Copy link
Contributor

dmulcahey commented Dec 14, 2018

wanna try the changes from this commit: dmulcahey@e3b99d9

You'll have to add a line here too:
https://github.com/home-assistant/home-assistant/blob/1c147b5c5f0de12044c02fe76053e3736d171862/homeassistant/components/zha/const.py#L109

zcl.clusters.measurement.OccupancySensing: 'binary_sensor',

I should hopefully have time tonight to get this and a few other PR's open

@irl-erg
Copy link

irl-erg commented Dec 14, 2018

I'm now seeing two binary_sensors, one for motion and one for occupancy. Is that expected?

@dmulcahey
Copy link
Contributor

Maybe an unintended consequence... I’ll peek in a bit. Do either work??

@irl-erg
Copy link

irl-erg commented Dec 14, 2018

They both agree with the Z-Wave sensors that there is no motion in the house, so that is an improvement. Unfortunately I do not currently have a way to induce motion.

@dmulcahey
Copy link
Contributor

did you have a chance to check on this when you got home?

@irl-erg
Copy link

irl-erg commented Dec 15, 2018

I'm afraid that will be on Monday. I will let you know as soon as I can though.

@dmulcahey
Copy link
Contributor

dmulcahey commented Dec 15, 2018 via email

@irl
Copy link
Author

irl commented Dec 18, 2018

Just using the patch caused the new occupancy sensors to show up. When I got home, it looks like the motion sensor (the old one) triggered and then never cleared. Removing and re-adding the device still gives me two sensors (1x motion and 1x occupancy for each) but now the occupancy sensor does correctly report occupancy! Temperature and luminosity also continue to work.

While it's a little annoying to have the extra dummy binary_sensor in there it is very nice to have a useful motion sensor.

@dmulcahey
Copy link
Contributor

I can fix the other one too. Will take a device handler to do it. Had to do the same thing for the Aqara body sensor. Stay tuned

@irl
Copy link
Author

irl commented Dec 18, 2018

Awesome! Let me know if you need any more log output.

@dmulcahey
Copy link
Contributor

@irl can I have the exact make / model for this? I am going to try to get one of these to make sure I get it set up correctly.

@irl
Copy link
Author

irl commented Jan 11, 2019

Phillips Hue Motion Sensor

https://fccid.io/2AGBW9290012607X

@dmulcahey
Copy link
Contributor

Can you try this against current dev and let me know if motion triggers and clears now?

@irl
Copy link
Author

irl commented Apr 29, 2019

Will look shortly.

@irl
Copy link
Author

irl commented Apr 29, 2019

@dmulcahey Which commit?

@dmulcahey
Copy link
Contributor

@irl #23190

@irl
Copy link
Author

irl commented Apr 29, 2019

Thanks, looking now.

@dmulcahey
Copy link
Contributor

@irl I am curious to see if that sensor implements the "on with timed off command"

@irl
Copy link
Author

irl commented Apr 29, 2019

So this is the motion as opposed to the presence?

Edit: taking a while because of pyozw upgrades building.

@dmulcahey
Copy link
Contributor

dmulcahey commented Apr 29, 2019

Just looked at the sig posted above... should have looked before posting :S I don't think this is going to help at all.

edit that said, when is the last time you tested this? We may have actually fixed this w/ the rewrite in late December / early January. If you don't mind... remove one and rejoin it against dev or .92.1. What version of HA are you on??

@irl
Copy link
Author

irl commented Apr 29, 2019

I was on .92.1 now upgraded to the HEAD of dev. I'm removing and rejoining one of the sensors just now.

@dmulcahey
Copy link
Contributor

cool... there are a few attrs I want to try reading too if they don't just work.

@irl
Copy link
Author

irl commented Apr 29, 2019

First thing to note is that if you join the device without resetting it first (holding down the setup button until LED goes out) then it joins to the network without any clusters discovered which isn't great.

The "occupancy" sensor works nicely. It clears after seconds of non-activity, which is exactly what I want for my use case (I do timing in my automations). The "motion" sensor is always clear.

Edit: temp and luminance are also reading out ok

@dmulcahey
Copy link
Contributor

@irl that's good. can I have a screenshot of the device in the ZHA config panel?

@irl
Copy link
Author

irl commented Apr 29, 2019

Philips SML001
zha.zha_philips_sml001_020266b4
Philips SML001
binary_sensor.philips_sml001_020266b4_1
Philips SML001
sensor.philips_sml001_020266b4_2_1026
Philips SML001
binary_sensor.philips_sml001_020266b4_2_1030
Philips SML001
sensor.philips_sml001_020266b4_2_1024
 
Clusters
Basic (Endpoint id: 1, Id: 0x0000, Type: in)
Basic (Endpoint id: 1, Id: 0x0000, Type: out)
Basic (Endpoint id: 2, Id: 0x0000, Type: in)
Color (Endpoint id: 1, Id: 0x0300, Type: out)
Groups (Endpoint id: 1, Id: 0x0004, Type: out)
Identify (Endpoint id: 1, Id: 0x0003, Type: out)
Identify (Endpoint id: 2, Id: 0x0003, Type: in)
IlluminanceMeasurement (Endpoint id: 2, Id: 0x0400, Type: in)
LevelControl (Endpoint id: 1, Id: 0x0008, Type: out)
OccupancySensing (Endpoint id: 2, Id: 0x0406, Type: in)
OnOff (Endpoint id: 1, Id: 0x0006, Type: out)
Ota (Endpoint id: 2, Id: 0x0019, Type: out)
PowerConfiguration (Endpoint id: 2, Id: 0x0001, Type: in)
Scenes (Endpoint id: 1, Id: 0x0005, Type: out)
TemperatureMeasurement (Endpoint id: 2, Id: 0x0402, Type: in)

Screenshots are hard.

@dmulcahey
Copy link
Contributor

dmulcahey commented Apr 29, 2019

Ah, I see what's happening here... you're getting a remote entity from this I think: 2018-12-12 15:10:53 INFO (MainThread) [zigpy.endpoint] [0xdf04:1] Discovered endpoint information: <SimpleDescriptor endpoint=1 profile=49246 device_type=2128 device_version=2 input_clusters=[0] output_clusters=[0, 3, 4, 6, 8, 768, 5]> Not sure what the best way to handle that is atm... @Adminiuga any ideas off the top of your head? I'll check the device type there... maybe there is some combination of values we can use to skip that part...

EDIT @Adminiuga maybe it is time to seriously consider removing the binary sensors for remotes? most don't work anyway and events provide all of the functionality. Thoughts?

@irl
Copy link
Author

irl commented Apr 29, 2019

@dmulcahey Do you mean that there should just not be a "motion" sensor there at all? I don't know the protocol that well, so not sure what a remote entity is.

@dmulcahey
Copy link
Contributor

@irl yes

@dmulcahey
Copy link
Contributor

@irl we are gathering lux info for another ticket: #23290 can you provide details on what these show on the screen for lux readings please? Thanks.

@ghost
Copy link

ghost commented Jun 27, 2019

Just wanted to watch this one and also say thanks for getting the Occupancy Sensor to work. I hope there will be a way to hide the non-functional motion sensor soon.
I have a little question that is off topic slightly. Will there be an option added to disable the LED when occupancy is detected? At the moment it comes on red for a second when detected.

@stale
Copy link

stale bot commented Sep 26, 2019

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 26, 2019
@paviro
Copy link

paviro commented Dec 21, 2020

The hue sensors still show two binary_sensors for me, not a big deal but can be confusing at first. Is there any chance this will still be addressed?

@APTX
Copy link

APTX commented Apr 17, 2021

I think the "Motion-activated Light" blueprint uses the motion sensor instead of the occupancy sensor. I could not get that blueprint to work, but when I wrote my own automation that basically did the same thing, only using the occupancy sensor, it worked.

Is there a point for HA to expose the motion sensor if it doesn't work?

@Adminiuga
Copy link
Contributor

In blueprint, switch to yaml and enter the entity id of the occupancy sensor. Or just enter the entity id of the occupancy sensor in ui, instead of picking up from the drop down.

@APTX
Copy link

APTX commented Apr 17, 2021

I did not know it was possible to use a value not listed in the drop down or otherwise not allowed by the blueprint. The blueprint says:

      name: Motion Sensor
      selector:
        entity:
          domain: binary_sensor
          device_class: motion

I guess the occupancy sensor is not part of the motion device_class?

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

7 participants