PJCzx/homebridge-thermostat

CurrentTemperature rounded to whole number

JamesKnevitt opened this issue · 7 comments

Current temperature value displayed in HomeKit only displays whole number temperature values by rounding down I.e 22.8DegC is displayed as 22.0DegC.

PJCzx commented

Can you compare with the value from the logs ? The value is well defined as a float
this.currentTemperature = parseFloat(json.currentTemperature);

This is partly to do with the HomeKit and partly to do with the plugin. HomeKit currently has a maximum resolution of 0.5 °C so you can't expect anything more than this.

However, the plugin is currently setting the resolution to 1 °C on line 276: minStep: 1. Thus, this issue can be partially resolved by changing the line to: minStep: 0.5.

It is worth noting that you could change the line to: minStep: 0.1 as I have done in my homebridge-web-thermostat plugin but this will have no further effect but could be useful in future versions of HomeKit where finer resolutions are supported.

If I run Homebridge from command line then the output shows the following when getting status.
0|homebridge | [8/20/2019, 8:24:29 PM] [Thermostat-Livingroom] [*] currentTemperature: 22.4
but HomeKit shows 22.0.


Just seen your message @Tommrodrigues , that is interesting to know, I will look at that now.

ok, I have updated this line as you suggested, now it works (to nearest 0.5), good enough for me for now.

Thanks 👍

PJCzx commented

Hello guys,

I just updated the code and published on NPM a version were both values are 0.5 instead of 1

Don't hesitate to perform pull request in such a situation ;)

Best,

Hello @PJCzx

I could adjust minStep value but couldn't solve the temperature rounding issue yet.
Currently, the temperatures are rounded. As example if homebridge finds 21.28°C from the API , it still shows 21.5 in the home app.
Someone reported me that it is possible to show temperatures without rounding in Apple Home App. Do you have any idea to fix this? Thanks in advance.

PJCzx commented

Hello @smartechru, Unfortunately I have no more information than what @Tommrodrigues mentioned in his comment bellow.

#42 (comment)

Best,
@PJCzx