Have HA running for a couple of months and using manual UI automations mostly but works fine.
Have a Devolo / Danfoss room thermostat and its setup and reporting fine, but now want to use it for switching on and off a switch for an electric room heater according to the current temperature and temperature set point of the thermostat.
Can get the current temperature fine (it has its own sensor) but the temperature set point is within the climate entity of âclimate.study_thermostatâ entity.
I was planning to setup a template sensor to call âtemperatureâ so I can use the temperature set point in automations:
study_temperatureSP:
friendly_name: Study Temperature Set Point
unit_of_measurement: '°C'
value_template: "{{ state_attr('climate.study_thermostat', 'temperature') }}"
This works in the template test box, but where do I putt this code to make it a sensor or how do I use this in the automaton UI?
Have tried template in the automation UI but it throws a float @ data error.
Hi there, to make a template sensor with this, you need to copy and paste the following in the configuration.yaml, which can be found in config folder.
template:
- sensor:
- name: 'Study Temperature Set Point'
unit_of_measurement: '°C'
state: "{{ state_attr('climate.study_thermostat', 'temperature') }}"
Now in case of using this for automations, you really dont need to create this sensor but you can use the template itself for that. To help you more with this, could you explain what is it that you are looking for in detail?
If you have trouble editing the configuration.yaml, you need to first install an addon File editor from the addon store. Open it and mostly it will just open the configuration.yaml file. If it is not opened just click on the folder icon on the top left and select configuration.yaml from it.
I would rather do this in an automation, but can I do this in the UI?
I want to do the following automations:
Switch on heater socket âswitch.study_heater_socketâ when âsensor.study_thermostat_air_temperatureâ is lower than the temperature set point in the template above
Switch off heater socket âswitch.study_heater_socketâ when âsensor.study_thermostat_air_temperatureâ is higher than the temperature set point in the template above
Based on your reply, I get the impression you may not understand what the Generic Thermostat integration does. Basically, it will do (using your switch and sensor) what you plan to do using automations.
Anyway, you know best so good luck with your automations.
If you review the Generic Thermostatâs documentation, you will see it is configured by adding information to the configuration.yaml file.
FWIW, itâs not âcodingâ. Think of it as writing a list of ingredients for a recipe or shopping list. The main difference is that the indentation is critical.
If you have any doubt regarding copying automation yaml, please refer the below gif.
Second would be to make a generic thermostat and an automation. You will have to copy and paste the following to your config to create a thermostat component.
This would make a new thermostat that would switch on the heater whenever the target sensor temperature is below the target_temp. The target_temp mentioned in above config is relevant only during startup. In our case we have to set this target temperature to the temperature of the template. For this to happen we need to create on more automation like below.
alias: Set Target Temperature
description: ''
mode: single
trigger:
- platform: state
entity_id: climate.study_thermostat
attribute: temperature
condition: []
action:
- service: climate.set_temperature
data_template:
temperature: '{{ state_attr(''climate.study_thermostat'', ''temperature'') |float}}'
target:
entity_id: climate.study_thermostat
The climate entity defined by the Generic Thermostat integration shouldnât have the same name as the the Danfoss thermostat. In your example it is the same and so the last automation becomes self-referential: it is setting the temperature of climate.study_thermostat whenever thereâs a temperature change reported by climate.study_thermostat.
You want the automation to detect changes in the target temperature of the Danfoss thermostat and use that value to set the target temperature of the Generic Thermostat. The two climate entities must have unique names.
Probably because you arenât familiar with the Generic Thermostat and opted to go with what you know which happens to involve more code yet produces less functionality.