i8beef / HomeAutio.Mqtt.GoogleHome

MIT License
215 stars 29 forks source link

Respect Thermostat Temperature Unit #68

Closed diabl0w closed 3 years ago

diabl0w commented 4 years ago

Google asks manufacturers to report whether their temperature devices operate in farenheit or celsius so that they can handle payloads they receive. However google only communicates its payloads in Celsius including the payloads they send back. Let HomeAutio do the heavy lifting of conversions so that we receive mqtt payloads in our desired format.

Thanks @i8beef

i8beef commented 4 years ago

I have a sample for this finally, but it requires changing all you ValueMaps to make all the Google specific values to strings instead of regular JSON types. Ill try and get a release and documentation update together this week.

diabl0w commented 4 years ago

amazing! thanks!

i8beef commented 4 years ago

Should be published soon. Fixing a bug real quick.

Usage for this should be

            "valueMap": [
              {
                "type": "celcius"
              }
            ]

Only needed on values that are not already celcius, obviously.

diabl0w commented 4 years ago

great!

Should be published soon. Fixing a bug real quick.

Usage for this should be

            "valueMap": [
              {
                "type": "celcius"
              }
            ]

Only needed on values that are not already celcius, obviously.

great! possible typo though... celsius*?

just to clarify, if we are using farenheit for our communications we should be using "type: farenheit" correct? and the default value if not set is "celsius", or if a user chooses "type: celsius" then it just does no conversion

i8beef commented 4 years ago

Crap! Yes. Hold on I'll correct.

No, if the MQTT measurement is already in Celsius you just dont need a valueMap. If the MQTT measurement is in Fahrenheit then you just add the celsius valueMap to make sure it converts back and forth.

Edit: Note if you have a better name suggestion, now's the time to make it... I named it celsius because "temperature" seemed too generic to the fact it was standardizing the Google side to Celsius specifically... whereas if Google suddenly decided they needed Fahrenheit for something (I put nothing beyond them at this point sadly) I'd add another one for doing that conversion. It couldn't come up with a good way to indicate directionality of the conversion...

diabl0w commented 4 years ago

Crap! Yes. Hold on I'll correct.

No, if the MQTT measurement is already in Celsius you just dont need a valueMap. If the MQTT measurement is in Fahrenheit then you just add the celsius valueMap to make sure it converts back and forth.

okay yes, i just reread what valuemap was (its been awhile since i messed with config), and that sounds intuitive. sounds good!

i8beef commented 3 years ago

Did you get a chance to try this out? Working for you?

diabl0w commented 3 years ago

Did you get a chance to try this out? Working for you?

Unfortunately I don't currently have it implemented anymore. I can't really remember why I removed it, but I think I had an issue related to rounding numbers and properly communicating with other MQTT GUI's that I have. Nothing wrong with the implementation here, I just decided to handle all rounding/conversion myself from all sources on my central server in a python script.

For me, I would mark this issue as solved