Fixed zigbee.mqtt light entity conversion

This commit is contained in:
Fabio Manganiello 2022-11-02 23:07:12 +01:00
parent 636d1ced3a
commit d5f8d55b4b
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -201,7 +201,7 @@ class ZigbeeMqttPlugin(MqttPlugin): # lgtm [py/missing-call-to-init]
if light_info: if light_info:
compatible_entities.append( compatible_entities.append(
Light( Light(
id=f'{dev["ieee_address"]}|light', id=f'{dev["ieee_address"]}:light',
name=dev.get('friendly_name'), name=dev.get('friendly_name'),
on=dev.get('state', {}).get('state') on=dev.get('state', {}).get('state')
== switch_info.get('value_on'), == switch_info.get('value_on'),
@ -214,14 +214,14 @@ class ZigbeeMqttPlugin(MqttPlugin): # lgtm [py/missing-call-to-init]
saturation_min=light_info.get('saturation_min'), saturation_min=light_info.get('saturation_min'),
saturation_max=light_info.get('saturation_max'), saturation_max=light_info.get('saturation_max'),
brightness=( brightness=(
dev.get('state', {}) dev.get('state', {}).get(
.get('color', {}) light_info.get('brightness_name', 'brightness')
.get(light_info.get('brightness_name', 'brightness')) )
), ),
temperature=( temperature=(
dev.get('state', {}) dev.get('state', {}).get(
.get('color', {}) light_info.get('temperature_name', 'temperature')
.get(light_info.get('temperature_name', 'temperature')) )
), ),
hue=( hue=(
dev.get('state', {}) dev.get('state', {})