diff --git a/neohubapi/neohub.py b/neohubapi/neohub.py index bd1bd85..36e1227 100644 --- a/neohubapi/neohub.py +++ b/neohubapi/neohub.py @@ -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))