Hive R3 update (#13357)

* Rebase

* Update version number to 0.2.14

* Remove Blank Line

* Added period to docstring

* Update Tox Fix

* Removed Lines
This commit is contained in:
Khole 2018-04-16 20:00:13 +01:00 committed by Martin Hjelmare
parent 595600dea5
commit e0c5b44994
7 changed files with 72 additions and 7 deletions

View file

@ -28,6 +28,7 @@ class HiveDevicePlug(SwitchDevice):
self.node_name = hivedevice["Hive_NodeName"]
self.device_type = hivedevice["HA_DeviceType"]
self.session = hivesession
self.attributes = {}
self.data_updatesource = '{}.{}'.format(self.device_type,
self.node_id)
self.session.entities.append(self)
@ -42,6 +43,11 @@ class HiveDevicePlug(SwitchDevice):
"""Return the name of this Switch device if any."""
return self.node_name
@property
def device_state_attributes(self):
"""Show Device Attributes."""
return self.attributes
@property
def current_power_w(self):
"""Return the current power usage in W."""
@ -67,3 +73,5 @@ class HiveDevicePlug(SwitchDevice):
def update(self):
"""Update all Node data from Hive."""
self.session.core.update_data(self.node_id)
self.attributes = self.session.attributes.state_attributes(
self.node_id)