oischinger / ha_vicare

Inofficial Home Assistant custom component for Viessmann ViCare API
61 stars 33 forks source link

climate.pyvicare_heating current_temperature rounded #87

Open Pampasgras opened 2 years ago

Pampasgras commented 2 years ago

The climate.pyvicare_heating entity is showing:

current_temperature: 21
room_temperature: 20.6

I want my lovelace thermostat to show 20.6 (not 21)

current_temperature & room_temperature are set in climate.py (line 188) to the same value

            if _room_temperature is not None:
                self._current_temperature = _room_temperature
...
            self._attributes["room_temperature"] =  _room_temperature

I have to change PRECISION_WHOLE to PRECISION_TENTHS in climate.py (line 26) from homeassistant.const import ATTR_TEMPERATURE, PRECISION_WHOLE, TEMP_CELSIUS and climate.py (line 309)

    @property
    def precision(self):
        """Return the precision of the system."""
        return PRECISION_WHOLE

When I do that, I can see the current_temperature in my thermostat with tenth precision: image (also resulting in nicer history graphs)

Is there a reason for using PRECISION_WHOLE and not PRECISION_TENTHS?

oischinger commented 2 years ago

Did you try to set a temperature? I assume it will also change temp in 0.1 steps now which the api does not support. Can you please check?

Pampasgras commented 2 years ago

The thermostat target temperature always changes in steps of 0.5°C, both with the PRECISION_WHOLE and PRECISION_TENTHS configuration. My vicare app allows only whole target temperatures, but setting a target temperature to 20,5°C in lovelace thermostat for example results in 20°C in my vicare app. (and will reflect back as 20°C in my thermostat setting within a minute) No errors are generated in my logfiles when I specify 20,5°C using the thermostat.

I also tried using Service climate.set_temperature with setting 21,9°C, no errors are generated and target temperature in vicare changes to 21°C

(My vicare app supports tenth precision for current_temperature and whole precision for target temperatures)

oischinger commented 2 years ago

This is thightly connected to https://github.com/home-assistant/core/issues/64282 I just found out that HA supports different precisions for current and target temperature. I'll create a PR to test it out a bit.

oischinger commented 2 years ago

Please see https://github.com/oischinger/ha_vicare/pull/88 This is a proposal which should resolve the current problems but as a result it will only allow whole precision when setting the temperature.

adorobis commented 2 years ago

I've just noticed that the same applies to the water_heater entity. The API returns current temperature value with .1 precision but the entity config is defined as PRECISION_WHOLE. Could we also separate the target temperature precision from current temperature for water_heater?

adorobis commented 2 years ago

Btw, I've just tested and adjusting water_heater.py in exactly the same way works :)

adorobis commented 2 years ago

Just a small observation after several hour with the decimals for current room and water heater temperature. Although the room temperature seems to be updated pretty ok, with recorded entry for every 0.1 degree change the water heater is not getting updates every 0.1 see below graph for water_heater: image and for comparison the climate entity one: image In theory on the first graph the new value should be coming after every 0.1 change or at least in 1 minute intervals - this is not the case, overnight the temp was droping every 1 degree and the interval was almost 1 hour. Is that someting in the design of the integration or PyViCare modules?