-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C vs F For Temperature #106
Comments
So it looks like when the display units are set to Celsius in Domoticz settings, the JSON from There's the "Result/Data" element in the JSON which could probably tell us if the data we're getting is F or C. I'm a bit scared to try to work this into the code and do a PR, but I figured it might be easier for someone more handy ? The regex only works for something returning both temp and humidity, so I guess it'd have to be more generalized for other types of temperature-reading devices. I know, us in the states need to get with the rest of the world and switch to Celsius :( |
So the answer from gizmocuz is to query /json.htm?type=command¶m=getconfig for |
Here's my latest idea. There's an element in the I think eDomoticz's domoticz.js grabs an object called settings with these values. So if I'm thinking right, a way to do it would be in the Something like (pseudocode) Assuming I added a quick function to
Solid reasoning ? |
Sorry - just read over your code... yes, that should work. Your pseudocode is correct. Shorthand if ... else is in the format Shorthand check for a variable being true is just the variable itself... so:
And in JS, 1 === true === !0 === !false With all that in mind, add:
...to your config.json, then change line 449 of edomoticz_accessory.js to:
and line 462 to:
The above are both single lines of code for reference (they may copy and paste with linebreaks). And in helper.js...
(I just refactored your code down a bit) The knock on effects of this on items such as Thermostat SetPoint devices however is unknown... ie: what unit will those commands be sent in, and what would domoticz be expecting... (and in my case a further translation for the scripts that drive my physical thermostat currently attached to Domoticz). There may be further places that would need translations, but the above should get you started. Without investigating in much greater depth questions such as the above I can’t add it into the main repo yet. |
If I have Domoticz'
Setup>Settings>Meters/Counters>Temperature Display
set to Celsius, then HomeKit translates correctly to Fahrenheit for me, and shows it in the home app correctly.However, if I set the setting in Domoticz to Fahrenheit, HomeKit shows the value as if it was translated from Celsius.
Is there a way to have eDomoticz accept F or C as the incoming unit type from Domoticz, and then convert to C when it sends it to homekit/homebridge (because it seems to expect C) ?
Ideally, I'd like to be able to view F temperatures in Domoticz' web interface, but have it send C temperatures in MQTT, JSON, etc. But I haven't found a way to do that.
Thanks !
The text was updated successfully, but these errors were encountered: