Baldhor / Homey-ESPhome-Enhanced

This is an Homey app which adds support for ESPHome devices. ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems. More information on their homepage: https://www.esphome.io/
GNU General Public License v3.0
5 stars 3 forks source link

step of target_temperature is not working as expected #65

Closed Baldhor closed 7 months ago

Baldhor commented 7 months ago

When you set the target temperature native napability, there is an option to define the step. This is default at 0,5, but it doesen't look like this affects the "thermostat view" of the Homey device, when I adjust the temperature there the step is 1 degree.

Originally posted by @Nettopp in https://github.com/Baldhor/Homey-ESPhome-Enhanced/issues/42#issuecomment-1765828828

Baldhor commented 7 months ago

(copy from another issue thread)

You mean that the step is ignored? Can you try to set a step of 2 :)

Setting it to 2 worked, but its not possible to input 0,5/0.5 after you have changed it from the default value. And do not try as I did to set it to 0... almost crashed Homey! You might remove that option if possible.

Baldhor commented 7 months ago

Need to investigate, there are no reason it doesn't works like for measure_temperature

Nettopp commented 7 months ago

I figured this out, you need to increase precision on the viritual device holding the target temperature to 1. This enables one decimal place, and the step can then be set to 0,5. After a restart of the ESPhome app this is working correctly.

I guess you could consider setting the precision/decimals to 1 as default for measure_temperature and target_temperature devices.

Baldhor commented 7 months ago

I figured this out, you need to increase precision on the viritual device holding the target temperature to 1. This enables one decimal place, and the step can then be set to 0,5. After a restart of the ESPhome app this is working correctly.

I guess you could consider setting the precision/decimals to 1 as default for measure_temperature and target_temperature devices.

I see what you mean, step and precision are related, if you change one it should adapt the other one if needed. If precision reduce (1 to 0, ...), step should be modified to mmatch the precision.

For precision from 1 to 0, step should go from 0.5 to 1 (not 0)

If precision increase: step doesn't need to be modified, it's up to the user.


I have that processing when analyzing the native capabilities, there are could be a bug inside. But it should also apply to the Wizard interface itself.

Baldhor commented 7 months ago

Also, if the user increase the step precision, the precision itself should also be increased.

If step goes from 1 to 0.5, the precision should automatically goes from 0 to 1.

The bonus question is what's the compatibility of the native capability.

If the native capability (ie. the device) support max a precision of 2, we should not allow the user to set a bigger precision. In, such cases, the step modification done by the user should probably be reverted. Or at least, make sure the user cannot input a step value that is not compatible.

Baldhor commented 7 months ago

As a sire note, but I think it is related:

      {
        "nativeCapabilityId": "290099816:targetTemperature",
        "entityId": "290099816",
        "attribut": "targetTemperature",
        "entityName": "Panasonic AC",
        "type": "Climate",
        "used": 1,
        "value": 21.5,
        "configs": {},
        "constraints": {
          "step": 0.5,
          "type": "number"
        },
        "specialCase": null
      },

In your debug info, I can see that the target_temperature has a "step" constraint, but no precision. It is missing:

        "configs": {
          "precision": 1,
        }

I'm 100% sure it's the main issue and explain why measure_temperature doesn't behave the same.

The relationship between step and precision is of lower priority

Baldhor commented 7 months ago

Implementing 3 rules:

Also fixed calculation of default decimals (precision) for Climate target temperature (it's calculated from the default step received from the device)

Baldhor commented 7 months ago

https://homey.app/fr-fr/app/nl.inversion.esphome/ESPhome/test/

Certification will be for tomorrow