bigbadblunt / homeassistant-lightwave2

Lightwave RF custom component for Home Assistant. Requires generation 2 ("Link Plus") hub, but will control both generation 1 ("Connect Series") and generation 2 ("Smart Series") devices.
41 stars 11 forks source link

Lightwave smart motion sensors LP70 only expose battery level #98

Closed jjl109 closed 2 years ago

jjl109 commented 2 years ago

The new Lightwave Gen2 motion sensors (LP70) are discovered by Home Assistant but do not expose any sensor entity for motion/no motion detection.

They show up in HA with only a diagnostic battery level sensor.

bigbadblunt commented 2 years ago

Can you turn on additional logging and send me the logs from the startup of the component?

jjl109 commented 2 years ago

ha_lwrf2_2022-10-30-17-54.log

I've set debug on custom_components.lightwave2 but not sure this shows anything useful. See attached. Interestingly, these logs don't show the binary sensor for my two door sensors even though they are working in HA.

jjl109 commented 2 years ago

Sorry ignore last sentence - the log does show the magnetic door binary sensors being added, I missed this as was looking in the sensor section. So I would expect to see 5 additional binary sensors there as there are 5 motion detectors.

bigbadblunt commented 2 years ago

Can you also please set debug on lightwave2.lightwave2?

jjl109 commented 2 years ago

ha_lwrf2_2022-11-01-09-55.log

See attached. Presumably the relevant lightwave "feature" is this one of type movement:

"61dc5c2c18685a0a5f6a4f02-221-3157344058+1":{
   "featureId":"61dc5c2c18685a0a5f6a4f02-221-3157344058+1",
   "name":"Kitchen motion",
   "deviceId":"61dc5c2c18685a0a5f6a4f02-51-3157344058+1",
   "groups":[
      "61dc5c2c18685a0a5f6a4f02-6355806eca43974156867845"
   ],
   "createdDate":"2022-10-23T17:57:02.260Z",
   "attributes":{
      "featureId":221,
      "deviceId":51,
      "type":"movement",
      "channel":0,
      "writable":false,
      "stateless":false,
      "virtual":false,
      "status":"init",
      "name":"Kitchen motion"
   }
}
bigbadblunt commented 2 years ago

I've just pushed a new beta release where I've tried to include this. I also noticed there is a "lightlevel" sensor which I've tried to include too. Can you test and feed back please?

jjl109 commented 2 years ago

That's great thanks, I won't be able to test till next week so will feed back then.

jjl109 commented 2 years ago

I have tested this - I'm afraid it seems to add only the lightlevel sensor but not the actual motion binary sensor.

I had a look in the code, and I think this is what needs to be fixed up: https://github.com/bigbadblunt/lightwave2/pull/5/files https://github.com/bigbadblunt/homeassistant-lightwave2/pull/103/files

I have raised these as draft PRs because I haven't tested this code, and I'm new to both Home Assistant and Python.

I'll happily test if I can work out how to get this code into my HA instance. I could drop in the custom component easily, but I can't work out where home assistant stores the underlying library to drop that in.

bigbadblunt commented 2 years ago

Code looks fine, I have included in a new beta release. Thanks!

Getting your edits to the lightwave2 library into your local HA instance is not something I know how to do. Lightwave automatically pulls the libraries using pip. The version number for the library is included in manifest.json. I have to fix the underlying library, upload to pypi, change the version number in the manifest and then HA automatically pulls the new library version. Obviously you can't do this without access to pypi. How to make the changes locally is beyond me.

jjl109 commented 2 years ago

Yay it works now! I have just made one further PR because I noticed HA wasn't showing the correct icon for motion: https://github.com/bigbadblunt/homeassistant-lightwave2/pull/104