Merge pull request #1451 from MartinHjelmare/mysensors-assumed-state

Add assumed_state to mysensors switch and light
pull/1449/merge
Martin Hjelmare 2016-03-01 03:37:40 +01:00
commit 2823d8f0d8
3 changed files with 11 additions and 5 deletions

View File

@ -116,6 +116,11 @@ class MySensorsLight(Light):
"""Return True if entity is available."""
return self.value_type in self._values
@property
def assumed_state(self):
"""Return True if unable to access real state of entity."""
return self.gateway.optimistic
@property
def is_on(self):
"""True if device is on."""

View File

@ -1,9 +1,5 @@
"""
homeassistant.components.mysensors.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MySensors component that connects to a MySensors gateway via pymysensors
API.
Connect to a MySensors gateway via pymysensors API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.mysensors/

View File

@ -149,6 +149,11 @@ class MySensorsSwitch(SwitchDevice):
"""Return True if entity is available."""
return self.value_type in self._values
@property
def assumed_state(self):
"""Return True if unable to access real state of entity."""
return self.gateway.optimistic
def update(self):
"""Update the controller with the latest value from a sensor."""
node = self.gateway.sensors[self.node_id]