mirror of
https://github.com/home-assistant/core.git
synced 2025-05-28 17:57:08 +00:00
Fix errors in zigbee push state (#11386)
* Fix errors in zigbee push state * Fix formatting * Added comment
This commit is contained in:
parent
75a39352ff
commit
ec700c2cd6
7
homeassistant/components/zigbee.py
Normal file → Executable file
7
homeassistant/components/zigbee.py
Normal file → Executable file
@ -288,12 +288,15 @@ class ZigBeeDigitalIn(Entity):
|
|||||||
"""
|
"""
|
||||||
if not frame_is_relevant(self, frame):
|
if not frame_is_relevant(self, frame):
|
||||||
return
|
return
|
||||||
sample = frame['samples'].pop()
|
sample = next(iter(frame['samples']))
|
||||||
pin_name = DIGITAL_PINS[self._config.pin]
|
pin_name = DIGITAL_PINS[self._config.pin]
|
||||||
if pin_name not in sample:
|
if pin_name not in sample:
|
||||||
# Doesn't contain information about our pin
|
# Doesn't contain information about our pin
|
||||||
return
|
return
|
||||||
self._state = self._config.state2bool[sample[pin_name]]
|
# Set state to the value of sample, respecting any inversion
|
||||||
|
# logic from the on_state config variable.
|
||||||
|
self._state = self._config.state2bool[
|
||||||
|
self._config.bool2state[sample[pin_name]]]
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
async_dispatcher_connect(
|
async_dispatcher_connect(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user