jheling / freeathome

Free@Home component for Home Assistant
103 stars 37 forks source link

Thermostats detected incorrectly with hvac_mode "heat_cool" #146

Open marcokitzmann opened 1 year ago

marcokitzmann commented 1 year ago

I have noticed problems with the interaction between my BJ thermostats and the Scheduler integration.

The thermostat entities are created with these attributes:

hvac_modes: heat_cool, off min_temp: 7 max_temp: 35 target_temp_step: 0.5 preset_modes: none, eco current_temperature: 20.7 temperature: 20 preset_mode: null valve: 0 temperature_correction: 1 icon: mdi:thermometer-lines friendly_name: Thermostat Arbeitszimmer supported_features: 17

Apparently the hvac_mode "heat_cool" causes problems, because the thermostats actually only control the heating. "Heat" would therefore be the correct mode. In the Free@Home configuration the devices are also set up this way. But because of the mode "heat_cool" Scheduler passes a Target Temperature Range with min/max values. Therefore the control does not work and leads to error messages in the log.

Is this something I can fix myself?

jheling commented 1 year ago

Hello, my system doesn't contain a thermostat, so i can only give you some hints. All the code for the thermostat can be found in climate.py. This source also imports the different constants from the homeassistant climate component. Maybe you can try to change the HVAC_MODE_HEAT_COOL to HVAC_MODE_HEAT in this file. If this works, we can later match the mode in Free@Home with the mode of Home Assistant.

marcokitzmann commented 1 year ago

Yay, works like a charm! Let me know if I can help you with the implementation with information about my hardware.

jheling commented 1 year ago

Ok, that sounds good. Which options does the user interface have for setting the mode?

marcokitzmann commented 1 year ago

Available modes are (now) "heat" and "off". Preset modes "eco" and "none". Is that what you're asking for?

fl0kay commented 1 year ago

Hello, I've got a question on that: I changed the HVAC_MODE_HEAT_COOL to HVAC_MODE_HEAT in climate.py and it works fine. I can switch from eco mode to heating mode and vice versa now. But how can I set the thermostat to a certain temperature? Is this also possible?

marcokitzmann commented 1 year ago

Hmm, for me this works, even before that change. Only issue I have now is the climate entity is always in state 'heating' when thermostat is on, and never 'idle'. So HA stats are not fully correct. But it works.

fl0kay commented 1 year ago

Ok, could you give me an example how you set the temperature within an automation?

marcokitzmann commented 1 year ago

Action part should look like this: service: climate.set_temperature data: temperature: 19 hvac_mode: heat target: entity_id: climate.schlafzimmer

fl0kay commented 1 year ago

Thanks, that helped!