update temperature unit to work in HA#768
update temperature unit to work in HA#7681technophile merged 3 commits into1technophile:developmentfrom
Conversation
|
Edit: This works, but it seems like home assistant fixes correct unit regardless if it is Celsius or Fahrenheit so This would work for both Celsius and Fahrenheit char* MiJiasensor[MiJiaparametersCount][8] = {
{"sensor", "MiJia-batt", mac, "battery", jsonBatt, "", "", "%"},
{"sensor", "MiJia-temp", mac, "temperature", jsonTemp, "", "", "°C"},
{"sensor", "MiJia-hum", mac, "humidity", jsonHum, "", "", "%"}
//component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement
};TestsMQTTtem{
"stat_t": "home/OpenMQTTGateway/BTtoMQTT/582D3432D799",
"name": "MiJia-tem",
"uniq_id": "582D3432D799-MiJia-tem",
"dev_cla": "temperature",
"val_tpl": "{{ value_json.tempc | is_defined }}",
"unit_of_meas": "°C"
}tempc{
"stat_t": "home/OpenMQTTGateway/BTtoMQTT/582D3432D799",
"name": "MiJia-tempc",
"uniq_id": "582D3432D799-MiJia-tempc",
"dev_cla": "temperature",
"val_tpl": "{{ value_json.tempc | is_defined }}",
"unit_of_meas": "°C"
}tempf{
"stat_t": "home/OpenMQTTGateway/BTtoMQTT/582D3432D799",
"name": "MiJia-tempf",
"uniq_id": "582D3432D799-MiJia-tempf",
"dev_cla": "temperature",
"val_tpl": "{{ value_json.tempf | is_defined }}",
"unit_of_meas": "°F"
}In Home AssistantMetric system configured in Home AssistantImperial system configured in Home Assistant |
|
Thanks for the PR. @jmw6773 as you already worked on this. Could you give your point of view about this PR ? |
|
@1technophile, I made the recommendation to remove the From my understanding, which could be wrong, Home Assistant converts temperature values to what the user has set in the In my Home Assistant setup I have the following set in the basic setup. This is an image from my OMG running current dev branch (just compiled) with an AHT10 sensor. Below is an image of the same device recompiled only adding the If we want, we could remove the |
|
Home assistant seems to kind of understand without the ° symbol. I notice the problem when I used the homekit integration, then home assistant couldn't pass any value to the sensor.
This sounds good, should I then close this PR, create a new PR or juste remove all tempC and tempF and keep temp with "°C"? |
Congratulations for you and your family !!!
Just remove
|
|
I tested your branch last night and it is crashing at startup. It's a remote device, so I couldn't get any logs. However I believe it's because the count of parameters for each of the sensors needs to be updated to match. For example, with the MiFlora sensor, the
OpenMQTTGateway/main/ZgatewayBT.ino Lines 186 to 188 in e23eb1b |
Strange, mine is working. But anyway it seems like a smart thing to fix! |
|
Thanks! |
* update temperature unit to work in HA * use only one temperature sensor for HA


from "C" and "F" to "°C and "°F"