I've got a heating system that I'd like to publish all the information from on MQTT. The output from the system is an array of objects for each device currently included into the system.
What I'd like to do is iterate through the key/value pairs and publish them to my MQTT Broker, such that they look something like this:
MQTT Topic: devices/[n]/varOrSetting
MQTT Value: value
Where n is the device number, varOrSetting is each config/variable/setting for the device and value the value currently assigned to it.
Note: I know there's a few gotchas like names with "/" in them, I'm happy to deal with that later. I'm just at a loss to work out how to actually get this information published in MQTT.
Here is an example output message from the system:
{"devices":[{"AWAY":false,"COOLING":false,"COOLING_ENABLED":false,"COOLING_TEMPERATURE_IN_WHOLE_DEGREES":24,"COOL_INP":false,"COUNT_DOWN_TIME":"0:00","CRADLE_PAIRED_TO_REMOTE_SENSOR":false,"CRADLE_PAIRED_TO_STAT":false,"CURRENT_FLOOR_TEMPERATURE":30,"CURRENT_SET_TEMPERATURE":"16.0","CURRENT_TEMPERATURE":"19.3","DEMAND":false,"DEVICE_TYPE":12,"ENABLE_BOILER":false,"ENABLE_COOLING":false,"ENABLE_PUMP":false,"ENABLE_VALVE":false,"ENABLE_ZONE":false,"FAILSAFE_STATE":false,"FAIL_SAFE_ENABLED":false,"FLOOR_LIMIT":true,"FULL/PARTIAL_LOCK_AVAILABLE":false,"HEAT/COOL_MODE":false,"HEATING":false,"HOLD_TEMPERATURE":5,"HOLD_TIME":"0:00","HOLIDAY":false,"HOLIDAY_DAYS":0,"HUMIDITY":0,"LOCK":false,"LOCK_PIN_NUMBER":"0000","LOW_BATTERY":false,"MAX_TEMPERATURE":"16.0","MIN_TEMPERATURE":"15.0","MODULATION_LEVEL":0,"NEXT_ON_TIME":"2 days 22:05","OFFLINE":false,"OUPUT_DELAY":false,"OUTPUT_DELAY":0,"PREHEAT":false,"PREHEAT_TIME":"21:18","PROGRAM_MODE":"5DAY/2DAY","PUMP_DELAY":false,"RADIATORS_OR_UNDERFLOOR":false,"SENSOR_SELECTION":"BUILT_IN_AND_FLOOR","SET_COUNTDOWN_TIME":0,"STANDBY":false,"STAT_MODE":{"6_HEAT_LEVELS":true,"MANUAL_OFF":true,"THERMOSTAT":true},"TEMPERATURE_FORMAT":false,"TEMP_HOLD":false,"TIMECLOCK_MODE":false,"TIMER":false,"TIME_CLOCK_OVERIDE_BIT":false,"ULTRA_VERSION":0,"VERSION_NUMBER":35,"WRITE_COUNT":41,"ZONE_1PAIRED_TO_MULTILINK":true,"ZONE_1_OR_2":false,"ZONE_2_PAIRED_TO_MULTILINK":false,"device":"Bedroom"},{"AWAY":false,"COOLING":false,"COOLING_ENABLED":false,"COOLING_TEMPERATURE_IN_WHOLE_DEGREES":127,"COOL_INP":false,"COUNT_DOWN_TIME":"0:00","CRADLE_PAIRED_TO_REMOTE_SENSOR":false,"CRADLE_PAIRED_TO_STAT":false,"CURRENT_FLOOR_TEMPERATURE":20,"CURRENT_SET_TEMPERATURE":"10.0","CURRENT_TEMPERATURE":"20.0","DEMAND":false,"DEVICE_TYPE":12,"ENABLE_BOILER":false,"ENABLE_COOLING":false,"ENABLE_PUMP":false,"ENABLE_VALVE":false,"ENABLE_ZONE":false,"FAILSAFE_STATE":false,"FAIL_SAFE_ENABLED":false,"FLOOR_LIMIT":false,"FULL/PARTIAL_LOCK_AVAILABLE":false,"HEAT/COOL_MODE":false,"HEATING":false,"HOLD_TEMPERATURE":5,"HOLD_TIME":"0:00","HOLIDAY":false,"HOLIDAY_DAYS":0,"HUMIDITY":0,"LOCK":false,"LOCK_PIN_NUMBER":"0000","LOW_BATTERY":false,"MAX_TEMPERATURE":"19.0","MIN_TEMPERATURE":"18.0","MODULATION_LEVEL":0,"NEXT_ON_TIME":"255 days 255:255","OFFLINE":false,"OUPUT_DELAY":false,"OUTPUT_DELAY":0,"PREHEAT":false,"PREHEAT_TIME":"255:255","PROGRAM_MODE":"5DAY/2DAY","PUMP_DELAY":false,"RADIATORS_OR_UNDERFLOOR":false,"SENSOR_SELECTION":"BUILT_IN_AND_FLOOR","SET_COUNTDOWN_TIME":0,"STANDBY":true,"STAT_MODE":{"6_HEAT_LEVELS":true,"MANUAL_OFF":true,"THERMOSTAT":true},"TEMPERATURE_FORMAT":false,"TEMP_HOLD":false,"TIMECLOCK_MODE":false,"TIMER":false,"TIME_CLOCK_OVERIDE_BIT":false,"ULTRA_VERSION":0,"VERSION_NUMBER":35,"WRITE_COUNT":7,"ZONE_1PAIRED_TO_MULTILINK":true,"ZONE_1_OR_2":false,"ZONE_2_PAIRED_TO_MULTILINK":false,"device":"Hallway"},{"AWAY":false,"COOLING":false,"COOLING_ENABLED":false,"COOLING_TEMPERATURE_IN_WHOLE_DEGREES":23,"COOL_INP":false,"COUNT_DOWN_TIME":"0:00","CRADLE_PAIRED_TO_REMOTE_SENSOR":false,"CRADLE_PAIRED_TO_STAT":false,"CURRENT_FLOOR_TEMPERATURE":20,"CURRENT_SET_TEMPERATURE":"19.0","CURRENT_TEMPERATURE":"20.8","DEMAND":false,"DEVICE_TYPE":12,"ENABLE_BOILER":false,"ENABLE_COOLING":false,"ENABLE_PUMP":false,"ENABLE_VALVE":false,"ENABLE_ZONE":false,"FAILSAFE_STATE":false,"FAIL_SAFE_ENABLED":false,"FLOOR_LIMIT":false,"FULL/PARTIAL_LOCK_AVAILABLE":false,"HEAT/COOL_MODE":false,"HEATING":false,"HOLD_TEMPERATURE":21,"HOLD_TIME":"0:00","HOLIDAY":false,"HOLIDAY_DAYS":0,"HUMIDITY":0,"LOCK":false,"LOCK_PIN_NUMBER":"0000","LOW_BATTERY":false,"MAX_TEMPERATURE":"21.0","MIN_TEMPERATURE":"18.0","MODULATION_LEVEL":0,"NEXT_ON_TIME":"2 days 22:00","OFFLINE":false,"OUPUT_DELAY":false,"OUTPUT_DELAY":0,"PREHEAT":false,"PREHEAT_TIME":"255:255","PROGRAM_MODE":"5DAY/2DAY","PUMP_DELAY":false,"RADIATORS_OR_UNDERFLOOR":false,"SENSOR_SELECTION":"BUILT_IN_AND_FLOOR","SET_COUNTDOWN_TIME":0,"STANDBY":false,"STAT_MODE":{"6_HEAT_LEVELS":true,"MANUAL_OFF":true,"THERMOSTAT":true},"TEMPERATURE_FORMAT":false,"TEMP_HOLD":false,"TIMECLOCK_MODE":false,"TIMER":false,"TIME_CLOCK_OVERIDE_BIT":false,"ULTRA_VERSION":0,"VERSION_NUMBER":35,"WRITE_COUNT":59,"ZONE_1PAIRED_TO_MULTILINK":true,"ZONE_1_OR_2":false,"ZONE_2_PAIRED_TO_MULTILINK":false,"device":"Front Room"},{"AWAY":false,"COOLING":false,"COOLING_ENABLED":false,"COOLING_TEMPERATURE_IN_WHOLE_DEGREES":23,"COOL_INP":false,"COUNT_DOWN_TIME":"0:00","CRADLE_PAIRED_TO_REMOTE_SENSOR":false,"CRADLE_PAIRED_TO_STAT":false,"CURRENT_FLOOR_TEMPERATURE":127,"CURRENT_SET_TEMPERATURE":"21.0","CURRENT_TEMPERATURE":"20.6","DEMAND":false,"DEVICE_TYPE":12,"ENABLE_BOILER":false,"ENABLE_COOLING":false,"ENABLE_PUMP":false,"ENABLE_VALVE":false,"ENABLE_ZONE":false,"FAILSAFE_STATE":false,"FAIL_SAFE_ENABLED":false,"FLOOR_LIMIT":false,"FULL/PARTIAL_LOCK_AVAILABLE":false,"HEAT/COOL_MODE":false,"HEATING":false,"HOLD_TEMPERATURE":21,"HOLD_TIME":"0:00","HOLIDAY":false,"HOLIDAY_DAYS":0,"HUMIDITY":0,"LOCK":false,"LOCK_PIN_NUMBER":"0000","LOW_BATTERY":false,"MAX_TEMPERATURE":"21.0","MIN_TEMPERATURE":"17.0","MODULATION_LEVEL":0,"NEXT_ON_TIME":"2 days 22:00","OFFLINE":false,"OUPUT_DELAY":false,"OUTPUT_DELAY":0,"PREHEAT":false,"PREHEAT_TIME":"255:255","PROGRAM_MODE":"5DAY/2DAY","PUMP_DELAY":false,"RADIATORS_OR_UNDERFLOOR":false,"SENSOR_SELECTION":"BUILT_IN_AIR_SENSOR","SET_COUNTDOWN_TIME":0,"STANDBY":false,"STAT_MODE":{"6_HEAT_LEVELS":true,"MANUAL_OFF":true,"THERMOSTAT":true},"TEMPERATURE_FORMAT":false,"TEMP_HOLD":false,"TIMECLOCK_MODE":false,"TIMER":false,"TIME_CLOCK_OVERIDE_BIT":false,"ULTRA_VERSION":0,"VERSION_NUMBER":35,"WRITE_COUNT":51,"ZONE_1PAIRED_TO_MULTILINK":true,"ZONE_1_OR_2":false,"ZONE_2_PAIRED_TO_MULTILINK":false,"device":"Bathroom"}]}