From ec700c2cd6e60b255570a8ba7a3d655df68d3bcc Mon Sep 17 00:00:00 2001 From: Steve Easley Date: Wed, 3 Jan 2018 15:48:36 -0500 Subject: [PATCH] Fix errors in zigbee push state (#11386) * Fix errors in zigbee push state * Fix formatting * Added comment --- homeassistant/components/zigbee.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 homeassistant/components/zigbee.py diff --git a/homeassistant/components/zigbee.py b/homeassistant/components/zigbee.py old mode 100644 new mode 100755 index 95b0971373d..3a84e963841 --- a/homeassistant/components/zigbee.py +++ b/homeassistant/components/zigbee.py @@ -288,12 +288,15 @@ class ZigBeeDigitalIn(Entity): """ if not frame_is_relevant(self, frame): return - sample = frame['samples'].pop() + sample = next(iter(frame['samples'])) pin_name = DIGITAL_PINS[self._config.pin] if pin_name not in sample: # Doesn't contain information about our pin 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() async_dispatcher_connect(