Not Valid message sub-type error



  • Hi folks,

    Just resurrected my home assistant setup after a hiatus (previous install was early HA from 2021), I had my heatpump working before. But with the newer version of HA I'm getting the following logged.

    2022-07-12 09:54:18 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;255;0;0;17;2.3.2                   
    2022-07-12 09:54:18 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 250 child 255                                                                                                                            
    2022-07-12 09:54:18 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;255;0;0;17;2.3.2                                                                                                                                                 
    2022-07-12 09:54:18 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 250 child 255
    2022-07-12 09:54:18 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;255;3;0;6;0
    2022-07-12 09:54:18 DEBUG (MainThread) [mysensors.gateway_mqtt] Publishing 250;255;3;0;6;M                       
    2022-07-12 09:54:19 DEBUG (SyncWorker_5) [mysensors.persistence] Saving sensors to persistence file /config/mysensors_9efc8d723297a2c52c4ecf34999e35c7.json
    2022-07-12 09:54:19 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;255;3;0;11;Heatpump Control                                                                                                                                      
    2022-07-12 09:54:19 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 250 child 255
    2022-07-12 09:54:20 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;255;3;0;12;1.4                     
    2022-07-12 09:54:20 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 250 child 255                                                                                                                            
    2022-07-12 09:54:20 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;255;3;0;12;1.4                                                                                                                                                   
    2022-07-12 09:54:20 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 250 child 255
    2022-07-12 09:54:21 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;0;0;0;3;Power                      
    2022-07-12 09:54:21 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 250 child 0                                                                                                                              
    2022-07-12 09:54:21 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mygateway1-out/250/0/1/+/+, qos: 0                                                                                                                             
    2022-07-12 09:54:21 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mygateway1-out/250/0/2/+/+, qos: 0
    2022-07-12 09:54:21 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mygateway1-out/250/+/4/+/+, qos: 0
    2022-07-12 09:54:21 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;0;0;0;3;Power                                                                                                                                                    
    2022-07-12 09:54:21 WARNING (MainThread) [mysensors.sensor] child_id 0 already exists in children of node 250, cannot add child                            
    2022-07-12 09:54:22 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;1;0;0;29;HVAC
    2022-07-12 09:54:22 WARNING (MainThread) [mysensors] Invalid <Message data="250;1;0;0;29;HVAC">: Not valid message sub-type: 29 for object value @ data['sub_type']. Got 29
    not a valid value for object value @ data['payload']. Got 'HVAC'                                                                                                                                                                               
    2022-07-12 09:54:22 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;1;0;0;29;HVAC                                                                                                                                                    
    2022-07-12 09:54:22 WARNING (MainThread) [mysensors] Invalid <Message data="250;1;0;0;29;HVAC">: Not valid message sub-type: 29 for object value @ data['sub_type']. Got 29
    not a valid value for object value @ data['payload']. Got 'HVAC'                                                 
    2022-07-12 09:54:22 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;5;0;0;36;Vane Dir                                                                                                                                                
    2022-07-12 09:54:22 WARNING (MainThread) [mysensors] Invalid <Message data="250;5;0;0;36;Vane Dir">: Not valid message sub-type: 36 for object value @ data['sub_type']. Got 36
    not a valid value for object value @ data['payload']. Got 'Vane Dir'                   
    2022-07-12 09:54:22 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;6;0;0;36;Operating                 
    2022-07-12 09:54:22 WARNING (MainThread) [mysensors] Invalid <Message data="250;6;0;0;36;Operating">: Not valid message sub-type: 36 for object value @ data['sub_type']. Got 36
    not a valid value for object value @ data['payload']. Got 'Operating' 
    022-07-12 09:54:29 DEBUG (SyncWorker_5) [mysensors.persistence] Saving sensors to persistence file /config/mysensors_9efc8d723297a2c52c4ecf34999e35c7.json
    2022-07-12 09:54:29 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 250;0;1;0;2;1                          
    2022-07-12 09:54:29 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 250 child 0                                                                                                                              
    2022-07-12 09:54:29 DEBUG (MainThread) [homeassistant.components.mysensors.helpers] Discovering platform switch with devIds: [('9efc8d723297a2c52c4ecf34999e35c7', 250, 0, 2)]
    2022-07-12 09:54:29 INFO (MainThread) [homeassistant.components.mysensors] Adding new devices: [<Entity Power: off>]
    2022-07-12 09:54:29 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Power: value_type 2, value = 1                                          
    2022-07-12 09:54:29 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.mysensors entity: switch.power
    2022-07-12 09:54:39 DEBUG (SyncWorker_6) [mysensors.persistence] Saving sensors to persistence file /config/mysensors_9efc8d723297a2c52c4ecf34999e35c7.json                                                                                               
    

    I'm guessing my presentation is wonky, attached is my sketch
    [0_1657580859486_ard_hvac.ino](Uploading 100%)



  • // -*- mode: c -*-
    
    #include "HeatPump.h"
    
    HeatPump hp;
    
    #define MY_NODE_ID 250
    
    // Enable and select radio type attached 
    #define MY_RADIO_RFM69
    #define MY_RFM69_NEW_DRIVER
    #define MY_RFM69_FREQUENCY (RFM69_433MHZ)
    #define MY_IS_RFM69HW 1
    
    #define MY_RFM69_IRQ_PIN 3
    
    #include <MySensors.h>
    
    #define CHILD_POWER 0
    #define CHILD_HVAC  1
    #define CHILD_VANE  5
    #define CHILD_STAT  6
    
    bool metric = true;
    
    unsigned long lastTempSend;
    const unsigned long SEND_ROOM_TEMP_INTERVAL_MS = 120000;
    
    // Power  [ON,OFF]
    MyMessage msgPower(CHILD_POWER, V_STATUS);
    // Temp set point
    MyMessage msgSTemp(CHILD_HVAC, V_HVAC_SETPOINT_HEAT);
    // Room Temp
    MyMessage msgRTemp(CHILD_HVAC, V_TEMP);
    // Fan Speed [QUIET,2,4,AUTO]
    // my sensors -> HA ("Min", "Normal", "Max", "Auto")
    MyMessage msgFanSp(CHILD_HVAC, V_HVAC_SPEED);
    // Mode [Heat,Dry,Cool,Auto,?IDLE?]
    // mysensors -> HA "Off", "HeatOn", "CoolOn", or "AutoChangeOver"
    MyMessage msgMode(CHILD_HVAC, V_HVAC_FLOW_STATE);
    // Vane Direction [AUTO,1,2,3,4,5,SWING]
    // mysensors -> HA ????
    MyMessage msgVane(CHILD_VANE, V_VAR1);
    // Operating [YES, NO]
    // mysensors -> HA TEXT
    MyMessage msgStat(CHILD_STAT, V_TEXT);
    
    const char* fanHA2HP(const char* val) {
      if (strcmp(val,"Min") == 0) return "QUIET";
      if (strcmp(val,"Normal") == 0) return "2";
      if (strcmp(val,"Max") == 0) return "4";
      if (strcmp(val,"Auto") == 0) return "AUTO";
      return "2";
    }
    
    const char* fanHP2HA(const char* val) {
      if (strcmp(val,"QUIET") == 0) return "Min";
      if ((strcmp(val,"1") == 0) || (strcmp(val,"2") == 0)) return "Normal";
      if ((strcmp(val,"3") == 0) || (strcmp(val,"4") == 0)) return "Max";
      if (strcmp(val,"AUTO") == 0) return "Auto";
      return "Normal";
    }
    
    const char* modeHA2HP(const char* val) {
      const char* mode;
      if (strcmp(val,"HeatOn") == 0) mode = "HEAT";
      if (strcmp(val,"CoolOn") == 0) mode = "COOL";
      if (strcmp(val,"AutoChangeOver") == 0) mode = "AUTO";
      return mode;
    }
    
    const char* modeHP2HA(const char* val) {
      if (strcmp(val,"HEAT") == 0) return "HeatOn";
      if (strcmp(val,"COOL") == 0) return "CoolOn";
      if (strcmp(val,"AUTO") == 0) return "AutoChangeOver";
      return "HeatOn";
    }
    
    void publish(heatpumpSettings currentSettings) {
      bool power = hp.getPowerSettingBool();
      send(msgPower.set(power));
      send(msgSTemp.set((int)currentSettings.temperature));
      send(msgFanSp.set(fanHP2HA(currentSettings.fan)));
      send(msgMode.set(power ? modeHP2HA(currentSettings.mode) : "Off"));
      send(msgVane.set(currentSettings.vane));
    }
    
    void publish(heatpumpStatus currentStatus) {
      send(msgRTemp.set((int)currentStatus.roomTemperature));
      send(msgStat.set(currentStatus.operating ? "YES" : "NO"));
    }
    
    void hpSettingsChanged() {
      heatpumpSettings currentSettings = hp.getSettings();
      publish(currentSettings);
    }
    
    void hpStatusChanged(heatpumpStatus currentStatus) {
      publish(currentStatus);
    }
    
    void setup() {
      lastTempSend = millis();
    
      // Create the callbacks
      hp.setSettingsChangedCallback(hpSettingsChanged);
      hp.setStatusChangedCallback(hpStatusChanged);
      
      hp.connect(&Serial); // connect to the heatpump
      hp.sync(); // Update settings
    }
    
    void before() {
      // Reset the board to activate the radio
      pinMode(9, OUTPUT);
      digitalWrite(9, LOW);
      digitalWrite(9, HIGH);
      delay(10);
      digitalWrite(9, LOW);
      delay(10);
    }
    
    void presentation() {
      sendSketchInfo("Heatpump Control", "1.4");
      present(CHILD_POWER, S_BINARY, "Power");
      present(CHILD_HVAC, S_HVAC, "HVAC");
      present(CHILD_VANE, S_INFO, "Vane Dir");
      present(CHILD_STAT, S_INFO, "Operating");
    }
    
    void receive(const MyMessage &msg) {
      switch(msg.sensor) {
      case CHILD_HVAC:
        switch(msg.type) {
        case V_HVAC_FLOW_STATE: {
          const char* data = msg.getString();
          bool power;
          if (strcmp(data,"Off") == 0) {
    	power = false;
            hp.setPowerSetting(power);
          } else {
    	power = true;
            hp.setModeSetting(modeHA2HP(data));
            hp.setPowerSetting(power);
          }
          break;
        }
        case V_HVAC_SETPOINT_HEAT: {
          hp.setTemperature(msg.getInt());
          break;
        }
        case V_HVAC_SPEED: {
          hp.setFanSpeed(fanHA2HP(msg.getString()));
          break;
        }
        }
        break;
      case CHILD_VANE:
        hp.setVaneSetting(msg.getString());
        break;
      case CHILD_POWER: // ON or OFF
        hp.setPowerSetting(msg.getBool());
        break;
      default : // do nothing!
        break;
      }
      hp.update();
      hpStatusChanged(hp.getStatus());
    }
    
    void loop() {
      hp.sync();
    
      if (millis() > (lastTempSend + SEND_ROOM_TEMP_INTERVAL_MS)) {
        // only send the temperature every 60s
        hpStatusChanged(hp.getStatus());
        hpSettingsChanged();
        lastTempSend = millis();
      }
    
      wait(1000);
    }
    
    
    


  • Ignore me... the mysensors API version was set to 1.4 🤦


Log in to reply
 

Suggested Topics

  • 1
  • 3
  • 3
  • 1
  • 5
  • 8

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts