Fix wrapper and S_BINARY and bump req. version

* Wrap existing SerialGateway instance instead of subclassing
	SerialGatewat class.
* Add S_BINARY in switch platform only in version 1.5 of mysenors api.
* Use version 0.4 of pymysensors.
* Show gateway port as state attribute.
This commit is contained in:
MartinHjelmare 2016-01-10 04:10:38 +01:00
parent 4c4e5d5f47
commit 2d8cf7de44
4 changed files with 46 additions and 30 deletions

View file

@ -78,14 +78,14 @@ class MySensorsSensor(Entity):
"""Setup class attributes on instantiation.
Args:
gateway (str): Gateway.
gateway (GatewayWrapper): Gateway object.
node_id (str): Id of node.
child_id (str): Id of child.
name (str): Entity name.
value_type (str): Value type of child. Value is entity state.
Attributes:
gateway (str): Gateway.
gateway (GatewayWrapper): Gateway object.
node_id (str): Id of node.
child_id (str): Id of child.
_name (str): Entity name.
@ -154,6 +154,7 @@ class MySensorsSensor(Entity):
def state_attributes(self):
"""Return the state attributes."""
data = {
mysensors.ATTR_PORT: self.gateway.port,
mysensors.ATTR_NODE_ID: self.node_id,
mysensors.ATTR_CHILD_ID: self.child_id,
ATTR_BATTERY_LEVEL: self.battery_level,