Home Assistant HVAC Serial gateway (fan speed)
-
Hi there,
Can someone confirm that a setup with Serial Gateway using local connected HVAC sensor should work in Home Assistant? Especially in regards to the V_HVAC_SPEED variable?
Also, I'm using an Arduino micro (Atmega32u4) to test this. Sometimes I see that a heater entity is added, but it does not support V_HVAC_SPEED variable, only the HVAC state.
It seems the same problem as described here: link!
The code I'm using:
// Enable serial gateway #define MY_GATEWAY_SERIAL #define MY_BAUD_RATE 38400 #include <MySensors.h> #define CHILD_ID_HVAC 0 #define SN "Test sketch" #define SV "2.3.2" MyMessage msgHVACSpeed(CHILD_ID_HVAC, V_HVAC_SPEED); MyMessage msgHVACSetPointC(CHILD_ID_HVAC, V_HVAC_SETPOINT_COOL); MyMessage msgHVACFlowState(CHILD_ID_HVAC, V_HVAC_FLOW_STATE); String MODE_STATE_TXT; String FAN_STATE_TXT; int FAN_STATE; int TEMP_STATE; bool initialValueSent = false; void setup() { // Setup locally attached sensors //pinMode(LED_BUILTIN, OUTPUT); } void presentation() { // Present locally attached sensors sendSketchInfo(SN, SV); present(CHILD_ID_HVAC, S_HVAC, "Thermostat"); } void loop() { // Send locally attached sensor data here if (!initialValueSent) { FAN_STATE_TXT = "Min"; // default fan start state TEMP_STATE = 20; // default start temperature MODE_STATE_TXT = "CoolOn"; // default mode state send(msgHVACSpeed.set(FAN_STATE_TXT.c_str())); send(msgHVACSetPointC.set(TEMP_STATE)); send(msgHVACFlowState.set(MODE_STATE_TXT.c_str())); initialValueSent = true; } //wait(1000); } void receive(const MyMessage &message) { if (message.isAck()) { //Serial.println("This is an ack from gateway"); return; } //Serial.print("Incoming message for: "); //Serial.print(message.sensor); String recvData = message.data; recvData.trim(); //Serial.print(", New status: "); //Serial.println(recvData); switch (message.type) { case V_HVAC_SPEED: //Serial.println("V_HVAC_SPEED"); if(recvData.equalsIgnoreCase("auto")) FAN_STATE = 0; else if(recvData.equalsIgnoreCase("min")) FAN_STATE = 1; else if(recvData.equalsIgnoreCase("normal")) FAN_STATE = 2; else if(recvData.equalsIgnoreCase("max")) FAN_STATE = 3; FAN_STATE_TXT = recvData; break; } //sendHeatpumpCommand(); // apply setting! sendNewStateToGateway(); } void sendNewStateToGateway() { /* Serial.println("Status update send to HA:"); Serial.println("*************************"); Serial.println("Mode = " + MODE_STATE_TXT + "(" + (String)MODE_STATE + ")"); Serial.println("Fan = " + FAN_STATE_TXT + "(" + (String)FAN_STATE + ")"); Serial.println("Temp = " + (String)TEMP_STATE); */ send(msgHVACSpeed.set(FAN_STATE_TXT.c_str())); }