Adding Engineering data to Live Data
Adds Engineers data to Live Data to be surfaced in Home-Assistant to be able to correctly act against DEVICE_TYPE.
This commit is contained in:
parent
54ca38d4d6
commit
3ad3a73bb8
|
@ -435,16 +435,33 @@ class NeoHub:
|
|||
"""
|
||||
|
||||
message = {"GET_LIVE_DATA": 0}
|
||||
|
||||
hub_data = await self._send(message)
|
||||
|
||||
# We need the engineers data to get things like Device Type, Sensor Mode etc.
|
||||
get_eng_data_msg = {"GET_ENGINEERS": 0}
|
||||
eng_hub_data = await self._send(get_eng_data_msg)
|
||||
|
||||
devices = hub_data.devices
|
||||
delattr(hub_data, "devices")
|
||||
|
||||
# Combine the live data and engineers data to produce a full dataset to work from.
|
||||
# Start by working through each device in the devices
|
||||
for index, device in enumerate(devices):
|
||||
|
||||
# Find matching device ID in Engineers data
|
||||
for key, value in eng_hub_data.__dict__.items():
|
||||
if device.DEVICE_ID == value.DEVICE_ID:
|
||||
|
||||
# Now add the engineers data dictionary entries to the existing device dictionary.
|
||||
for x in value.__dict__.items():
|
||||
setattr(device, x[0], x[1])
|
||||
|
||||
thermostat_list = list(filter(lambda device: hasattr(device, 'THERMOSTAT') and device.THERMOSTAT, devices))
|
||||
timeclock_list = list(filter(lambda device: hasattr(device, 'TIMECLOCK') and device.TIMECLOCK, devices))
|
||||
|
||||
thermostats = []
|
||||
timeclocks = []
|
||||
|
||||
for thermostat in thermostat_list:
|
||||
thermostats.append(NeoStat(self, thermostat))
|
||||
|
||||
|
|
Loading…
Reference in New Issue