def on_message(self, client, userdata, msg):
    decoded_payload = str(msg.payload.decode('utf-8'))
    message = ((msg.topic + ' ') + decoded_payload)
    if (str(msg.topic) == 'AirconControl'):
        parsed_json = json.loads(decoded_payload)
        if (parsed_json['service'] == 'Off'):
            self.process_thermo_off_command()
        elif (parsed_json['service'] == 'Ventilate'):
            self.process_ventilate_mode()
        elif (parsed_json['service'] == 'Thermostat Heat'):
            self.process_thermo_heat_command()
        elif (parsed_json['service'] == 'Thermostat Cool'):
            self.process_thermo_cool_command()
        elif (parsed_json['service'] == 'Thermostat Auto'):
            self.process_thermo_auto_command()
        elif (parsed_json['service'] == 'Heat Mode'):
            self.process_heat_command()
        elif (parsed_json['service'] == 'Cool Mode'):
            self.process_cool_command()
        elif (parsed_json['service'] == 'Fan Mode'):
            self.process_fan_command()
        elif (parsed_json['service'] == 'Fan Hi'):
            self.process_fan_hi_command()
        elif (parsed_json['service'] == 'Fan Med'):
            self.process_fan_med_command()
        elif (parsed_json['service'] == 'Fan Lo'):
            self.process_fan_lo_command()
        elif (parsed_json['service'] == 'Damper Percent'):
            self.requested_damper_percent = parsed_json['value']
            self.print_status('Damper Command Received on ')
            print('Requested Damper Percent is', self.requested_damper_percent, 'Current Damper Percent is', self.reported_damper_percent)
        elif (parsed_json['service'] == 'Update Status'):
            self.print_status('Status Update Requested on ')
            self.update_status()
        elif (parsed_json['service'] == 'Heartbeat Ack'):
            self.heartbeat_ack()
        else:
            print('Received unknown message', str(parsed_json))
def on_message(self, client, userdata, msg):
    decoded_payload = str(msg.payload.decode('utf-8'))
    message = ((msg.topic + ' ') + decoded_payload)
    if (str(msg.topic) == 'AirconControl'):
        parsed_json = json.loads(decoded_payload)
        if (parsed_json['service'] == 'Off'):
            self.process_thermo_off_command()
        elif (parsed_json['service'] == 'Ventilate'):
            self.process_ventilate_mode()
        elif (parsed_json['service'] == 'Thermostat Heat'):
            self.process_thermo_heat_command()
        elif (parsed_json['service'] == 'Thermostat Cool'):
            self.process_thermo_cool_command()
        elif (parsed_json['service'] == 'Thermostat Auto'):
            self.process_thermo_auto_command()
        elif (parsed_json['service'] == 'Heat Mode'):
            self.process_heat_command()
        elif (parsed_json['service'] == 'Cool Mode'):
            self.process_cool_command()
        elif (parsed_json['service'] == 'Fan Mode'):
            self.process_fan_command()
        elif (parsed_json['service'] == 'Fan Hi'):
            self.process_fan_hi_command()
        elif (parsed_json['service'] == 'Fan Med'):
            self.process_fan_med_command()
        elif (parsed_json['service'] == 'Fan Lo'):
            self.process_fan_lo_command()
        elif (parsed_json['service'] == 'Damper Percent'):
            self.requested_damper_percent = parsed_json['value']
            self.print_status('Damper Command Received on ')
            print('Requested Damper Percent is', self.requested_damper_percent, 'Current Damper Percent is', self.reported_damper_percent)
        elif (parsed_json['service'] == 'Update Status'):
            self.print_status('Status Update Requested on ')
            self.update_status()
        elif (parsed_json['service'] == 'Heartbeat Ack'):
            self.heartbeat_ack()
        else:
            print('Received unknown message', str(parsed_json))