Closed n8henrie closed 2 years ago
mysensors documentation mysensors source (message by IssueLinks)
Hey there @martinhjelmare, @functionpointer, mind taking a look at this issue as it has been labeled with an integration (mysensors
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
Are you converting the temperature to the controller metric setting like in this example sketch?
The mysensors integration expects the device to report in Celsius or Fahrenheit matching the setting done by the user in the central Home Assistant settings.
Thanks for your response.
The mysensors integration expects the device to report in Celsius or Fahrenheit matching the setting done by the user in the central Home Assistant settings.
I assume you're referring to your PR from last fall: https://github.com/home-assistant/core/pull/58476
The mysensors integration expects the device to report in Celsius or Fahrenheit matching the setting done by the user in the central Home Assistant settings.
Which settings?
As far as I can tell there is no user-configurable settings to tell hass what units the gateway is reporting in. Is there no escape hatch for devices that are properly reporting Celsius data, but I would like to display in homeassistant.unit_system
units (whatever that may be)?
I did try making a custom mysensors
component that overrode that PR, and it didn't seem to fix the behavior. I might have done something wrong.
Are you converting the temperature to the controller metric setting like in this example sketch?
I will need to check, I think it's just set to bool metric = true;
EDIT: but to be clear, I haven't changed the sketch, which has been working without issues for years, and to re-flash the chip in my sensor would be difficult, so I'm hoping there's a better solution. I do like it to be reporting in Celsius, as I'd like to become more accustomed to metric units over time, but I'm not there yet.
That PR fixed something that had gone missing after a refactor. But the behavior has been like that for the last 6 years.
I'm referring to the general unit system setting in Home Assistant: https://www.home-assistant.io/docs/configuration/basic/
You can set a custom unit of measurement for your sensor by using V_UNIT_PREFIX in your sketch.
https://www.home-assistant.io/integrations/mysensors/#custom-unit-of-measurement
I'm referring to the general unit system setting in Home Assistant:
Correct, looks like we're both talking about homeassistant.unit_system
.
But the behavior has been like that for the last 6 years.
Huh, I wonder what change may have caused this to suddenly start working abnormally.
The bug for gateway metric setting was present between 2021.3 and 2021.10 core releases. Fixed in 2021.11.0.
If you created the sensor during the time the bug was present it may have appeared to be working correctly, as it always defaulted to metric gateway setting.
If you created the sensor during the time the bug was present
Hmmm, no I think I made it in 2016 or 2017.
I'm suspicious it has something to do with these other issues that cropped up around the same time:
Perhaps I'll try adding state_class
?
Mysensors temperature sensors have device class and state class set.
If the device is not reporting in the unit system of the controller it's not following the expected behavior of the controller.
Ah, thanks for that link. My device does set V_TEMP
.
If the device is not reporting in the unit system of the controller it's not following the expected behavior of the controller.
Sorry, just to verify terminology -- controller is homeassistant, right? https://www.mysensors.org/controller
I'm also still confused as to what changes broke the expected behavior after many years of working perfectly. I'm happy to work on a PR to perhaps make this configurable if I can figure out what changed. It would seem surprising if, after a change to homeassistant, the best solution were for me to reflash my sensor.
Yes, the controller is Home Assistant.
We already offer the user the custom unit of measurement via V_UNIT_PREFIX. We won't accept further options.
We already offer the user the custom unit of measurement via V_UNIT_PREFIX
It's not a "custom unit of measurement," it's Celsius for goodness' sake.
We won't accept further options.
Why would it be bad to allow HomeAssistant to interface with a sensor that reports values in different units than the user's preference for display? Isn't that the point of homeassistant.unit_system
?
I guess I'll see if I can sort out V_UNIT_PREFIX
in order to restore prior functionality, though I'm not sure that I understand the documentation.
https://www.home-assistant.io/integrations/mysensors#sensor-example-sketch-for-mysensors-2x
#define CHILD_ID 1
...
MyMessage msgPrefix(CHILD_ID, V_UNIT_PREFIX); // Custom unit message.
Would I change this to something like below?
MyMessage msgPrefix("F", V_UNIT_PREFIX);
No, the value of the message is set as normal.
msgPrefix.set("custom_lux")
send(msgPrefix.set("custom_lux")); // Set custom unit.
Well, I am somewhat ashamed to admit that deleting and re-adding the integration solved the issue without other changes, so it seems that hass does indeed convert from Celsius sensor data to Fahrenheit as one would hope.
I have removed everything from customize.yaml
and restarted and it continues to show proper Fahrenheit data.
Thank you @MartinHjelmare for your time and attention, sorry for the wild goose chase.
The problem
I've been running a MySensors temperature sensor for years without issue. It collects and reports data in Celsius to an arduino serial gateway connected by USB., which reports the data in Celsius to HomeAssistant. However, my HomeAssistant is configured to use Imperial units.
A summary the situation that has been working well for years: sensor takes temperature, reports this to my gateway in Celsius. HomeAssistant is configured to display in imperial, so it does so, and in my frontend I see a correct Fahrenheit temperature.
It seemed to be fine until a couple of months ago, when suddenly the values reported changed to Celsius, though they were still labelled as if they were Fahrenheit; in short, it looked almost exactly like https://github.com/home-assistant/core/issues/72625
The actual temperature is in the 70s F, but I see: ↓
If I use the entity editor to change
Unit of Measurement
to *C, the situation is even worse:I've tried adding
device_class: temperature
to mycustomize.yaml
as well asunit_of_measurement: "ºC"
-- neither of these resolve the issue. Settingunit_of_measurement: "ºC"
can sometimes get it to display the correct temperature inºC
(as opposed to the negative number you see above), but I want it to display inºF
like it used to.What version of Home Assistant Core has the issue?
2022.6.5
What was the last working version of Home Assistant Core?
unclear, around 2021.11 or so I got hung up trying to get zwavejs set up, was working then
What type of installation are you running?
Home Assistant Container
Integration causing the issue
MySensors
Link to integration documentation on our website
https://www.home-assistant.io/integrations/mysensors/
Diagnostics information
No response
Example YAML snippet
In
customize.yaml
, I haveI have also tried:
Anything in the logs that might be useful for us?
Not much:
Additional information
I think these may be relevant issues / PRs