Not sure, but I believe the system automatically converts temperature values to the unit_system you define in your configuration.yaml - i.e., metric or imperial.
I couldn’t see anything wrong, so I tried this in a test machine and both temperature sensors were filled in with the centigrade values. I am on metric measurements so pnbruckner may be on to something.
I was able to get the correct values inserted by removing the unit_of measurement: line from both of them, but this hardly seems a solution.
This isn’t a solution, it’s an excuse. If the user is specifically transmitting data, why auto-convert it without their knowledge. Or, at least include a flag within sensor function to disable this from happening.
I tend to agree with @fabaff on this one. If you want to have it ignore the system unit, just make a custom component. 99.9% of the user base is going to want ºC or ºF, not both. I’d like anyone to find me a weather or thermostat that allows users to configure temperatures on an individual basis. They are all ‘one ºunit to control them all’. That’s not an excuse to make home assistant that way but it begs the question, why do you want to have both units?
Simply user customization. If the user is specifying ºC then show them ºC, and same for ºF. If unspecific, then default to system settings.
In my specific case I am using it for validation, developing of technology for a broader audience. I am working on a code base for MQTT sensors that which code can be shared with the community. Allow individuals to use my code as a plug-in-play but not limit their temperature choice. I cannot validate that I am receiving the other temperature data correctly because HA is “auto-correcting” and representing values I didn’t specifically call out.
If this auto-correction is going to be standard for all instances, please note this in the mqtt.sensor documentation.
I have changed “ºC” to just “º” for my purposes, it presents my data accurately however depicting degrees rotation.
I don’t think this is limited to just mqtt sensors. From what I gather, its all units everywhere determined by the optional parameter in the basic home assistant setup: unit_system.
For testing purposes you could always use debug statements.