arthurkrupa / gree-hvac-mqtt-bridge

MQTT Bridge for controlling Gree smart air conditioners, e.g. with Home Assistant or OpenHAB
GNU General Public License v3.0
128 stars 62 forks source link

Add ability to receive current temperature from HVAC #60

Open aivus opened 4 years ago

aivus commented 4 years ago

Hey.

I've noticed that HVAC may return current room temperature in TemSen property.

It may be backported to this project from https://github.com/inwaar/gree-hvac-client/pull/11

k8ieone commented 3 years ago

I was able to get the current temperature back into HASS in my fork. I just don't know how to deal with the +40 offset yet.

I tried dealing with it in the publishIfChanged function like this, but it doesn't seem to work.

const publishIfChanged = function (stateProp, newValue, mqttTopic) {
  if (newValue !== deviceState[stateProp]) {
    // I have no idea where else to subtract 40 so I just do it here
    if (mqttTopic == '/curtemperature/get') {
      deviceState[stateProp] = newValue - 40
    }
    else {
      deviceState[stateProp] = newValue
    }
    client.publish(mqttTopicPrefix + mqttTopic, newValue)
  }
}
k8ieone commented 3 years ago

Ok, I've actually fixed it now, I think I can make a PR.

k8ieone commented 2 years ago

I made a PR for this now #78.