Core: After upgrade to .112.1 Lutron-Caseta occupancy sensor is no longer recognized at startup

Created on 4 Jul 2020  Â·  20Comments  Â·  Source: home-assistant/core

The problem


HA started up error free in version 0.111.4. As soon as I upgraded to 0.112 the lutron-caseta threw an error during startup. See trace log below.

Environment

  • Home Assistant Core release with the issue: 0 .112
  • Last working Home Assistant Core release (if known): 0 .111.4
  • Operating environment (OS/Container/Supervised/Core):
    arch | armv7l
    -- | --
    chassis |  
    dev | false
    docker | true
    docker_version | 19.03.9
    hassio | true
    host_os | Raspbian GNU/Linux 10 (buster)
    installation_type | Home Assistant Supervised
    os_name | Linux
    os_version | 4.19.97-v7l+
    python_version | 3.7.7
    supervisor | 228
    timezone | America/Denver
    version | 0.112.1
    virtualenv | false

  • Integration causing this issue: lutron_caseta

  • Link to integration documentation on our website:

Problem-relevant configuration.yaml


lutron_caseta:
host: 192.168.4.53
keyfile: caseta.key
certfile: caseta.crt
ca_certs: caseta-bridge.crt


Traceback/Error logs


2020-07-02 20:51:33 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up lutron_caseta platform for binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform
await asyncio.gather(pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in async_add_entities
await asyncio.gather(tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 343, in _async_add_entity
device_info = entity.device_info
File "/usr/src/homeassistant/homeassistant/components/lutron_caseta/init.py", line 134, in device_info
"identifiers": {(DOMAIN, self.serial)},
File "/usr/src/homeassistant/homeassistant/components/lutron_caseta/init.py", line 123, in serial
return self._device["serial"]
KeyError: 'serial'


Additional information

lutron_caseta

Most helpful comment

I do have the same issue with 112. I hope this get fixed soon. I can`t upgrade to 112 until this is fixed. :(

All 20 comments

Im having the same problem, I believe it has to do with this:
Lutron systems report occupancy and vacancy statuses only in occupancy groups – that is, groups of one or more sensors., so it is not a device

Im having the same problem, I believe it has to do with this:
Lutron systems report occupancy and vacancy statuses only in occupancy groups – that is, groups of one or more sensors., so it is not a device

But this does not explain why it used recognize the device as a binary_sensor in HA version .111.4

This change was made in 112
https://github.com/home-assistant/core/pull/36706

Before this change, this integration (Lutron Caseta) only adds entities, NOT devices.
After this change, this integration will add a device to device registry for every physical device unit and relate the entities to the corresponding devices.

it is this new code that is failing

I do have the same issue with 112. I hope this get fixed soon. I can`t upgrade to 112 until this is fixed. :(

Same issue here; had to rollback to 111 for it to work properly. #36706 seems to have broken it

@MartinHjelmare issue opened as requested. @ShaneQi

@xtian47 @dablais @jsb5151
I'm the author of the PR that broke it, I apologize for not being able to test it thoroughly. I'm not a core contribution but I will try to fix it if nobody else picks up this issue.

Since I don't have any sensors in my Caseta setup, I may need to ask some questions or debug/test in a setup w/ sensor(s).
So if any of you could give me your contact, it'd definitely expedite the fix.

My Discord: Shane Qi#4477
My Telegram: ShaneQi

Hi Shane,
I would be happy to assist you. I have one Lutron-Caseta occupancy sensor
in my HA system.
Larry Sloman

On Fri, Jul 10, 2020 at 10:07 AM Shane Qi notifications@github.com wrote:

@xtian47 https://github.com/xtian47 @dablais
https://github.com/dablais @jsb5151 https://github.com/jsb5151
I'm the author of the PR that broke it, I apologize for not being able to
test it thoroughly. I'm not a core contribution but I will try to fix it
if nobody else picks up this issue.

Since I don't have any sensors in my Caseta setup, I may need to ask some
questions or debug/test with a sensor.
So if any of you could give me your contact, it'd definitely expedite the
fix.

My Discord: Shane Qi#4477
My Telegram: ShaneQi

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/core/issues/37449#issuecomment-656755561,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADFGQSYB7KHSLFAX5RSA3SLR244C3ANCNFSM4OQFVXFQ
.

Leaving a quick update on the issue (thanks to plomdawg@discord's help):

  1. the issue is straightforward: motion sensors don't have a serial
  2. reason being that Caseta combines sensors (no matter how many) in the same room into a single entity therefore the entity doesn't have a serial
  3. even there is only one motion sensor in a single room, the entity still doesn't have a serial.

an example of a sensor:
{'occupancy_group_id': '3', 'name': 'The Bathroom Occupancy', 'status': 'Unoccupied'}

IMO if the sensor entities in Caseta are all 'combined entity', they technically don't belong to any physical devices, so I think we should NOT create devices for Caseta sensor entities.

But that'd make it impossible to assign the Caseta sensor entities to areas. That shouldn't be a big deal since people have been using them this way since the beginning, even though I personally would like to be able to assign them to areas.

Could you generate a serial based in the group id and name? So that you can assign the "device" to an area and always generate the same "serial".
If you guys need testing I can help too.

@xtian47 that should work, but it doesn't live up to the definition of 'device'.

I'll fix the issue by not giving devices to the combined sensor entities for now.

If I own a Caseta sensor in the future, I'll definitely look into exposing individual physical sensors separately (it might not be possible though).

I love the caseta sensors, they are so sensitive, I also have z-wave PIR sensors but not as good as the caseta, so I don't use them. The only problem is that you can't program a schedule for the sensors in the app, so it turns on the light even during the day. I use HA-NodeRed to turn them on only at night.
You might be right that you can't use the individual sensors, because they are not even exposed on the telnet interface and you can't use any sensor that way.

Any update on this? I received my sensor and am testing this using another control system and it works fine. I can assist with debugging on the LEAP interface if required.

@jsb5151 I've finished the code change, haven't submitted PR. Would you like to help me test it? If your testing result is good, I will submit it to a PR.

My Discord: Shane Qi#4477
My Telegram: ShaneQi

Yes, I am willing to test.

Yes, I am willing to test.

@jsb5151 Could you contact me via Discord or Telegram or provide me your proffered IM?

@ShaneQi wrote a fix and I tested it. Works nicely now. I believe he’s going to submit the PR soon. Thanks Shane!

Guys, the PR is up: https://github.com/home-assistant/core/pull/38255

Many thanks to plomdawg@discord @jsb5151 @slomanl1 !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Elmardus picture Elmardus  Â·  3Comments

aweb-01 picture aweb-01  Â·  3Comments

neonandu picture neonandu  Â·  3Comments

sogeniusio picture sogeniusio  Â·  3Comments

YellowMonster76 picture YellowMonster76  Â·  3Comments