I do have my gas heater connected via MQTT to Homeassistant. I delivers two values, the boiler temperature and the position of the valve. The valve switches between the heating system and the hotwater system. What I want to do now is to calculate the daily average temperature, but count only the values when the valve is switched to heating. At the moment I am using the average sensor to calculate the values:
Any ideas how this can be done?
Best regards from Germany
Florian
Note: you will probably have to change the valve sensor, I don’t know if it is a binary sensor or a sensor and if it is off or on when heating or some other value if a sensor as you did not provide this state information. Entity ids are good info to provide in future questions too.
Then feed this new sensor (sensor.heating_temperature) to your average integration.
I have two additional question:
I want to do a long term analysis and therefore want to compare the average heating temperature and the outside temperature. How can I trigger the calculation of the averages only once a day (e.g. 23:59) and store it?
The second question is can there be a plot daily average heating temp vs. Outside temperature? If this is not possible in Homeassistant I will export the daily averages and analyse them in Excel or MATLAB.
I’m failing in defining a triggered template sensor as I already have a state triggered template sensor. Can someone explain me how this need to be combined?
#template sensors
template:
- sensor:
name: "Heizung_Kessel_bereinigt"
device_class: temperature
state_class: measurement
unit_of_measurement: "°C" # or °F
state: >
{% if (states('sensor.heizung_ventil')|int > 1500) %}
{{ states('sensor.heizung_kessel') }}
{% else %}
unknown
{% endif %}
- trigger:
- platform: time
at: '23:59:59'
sensor:
- name: "mean_heizung_kessel_daily"
device_class: temperature
state_class: measurement
unit_of_measurement: "°C" # or °F
state: >
{{ states('sensor.vl_temp_gemittelt_ohneww') }}
- trigger:
- platform: time
at: '23:59:59'
sensor:
name: "mean_aussentemp_daily"
device_class: temperature
state_class: measurement
unit_of_measurement: "°C" # or °F
state: >
{{ states('sensor.aussentemp_gemittelt') }}
I want to use the template sensor to store the average over the whole day to another sensor which only contains one value per day. Then I want to create a plot which shows the daily average outside temperature on the x-axis a d the daily average heating temperature on the x-axis with one data points per day.
Thanks for your reply, that will help for the visualisation in home assistant. But is there a way to create a sensor that holds one value per day? Because my thoughts are that this is much easier to store only that single average value to influxdb and then to make long-term visualisation within grafana.
Okay thanks, I’ll try this in grafana.
Just for my understanding: Can you tell me what should be the right syntax for the definition of both time and stat triggered template sensors I posted above?
This is the error message I see in the logfile after restarting Home Assistant:
Logger: homeassistant.config
Source: config.py:464
First occurred: 7. Dezember 2021, 22:25:39 (8 occurrences)
Last logged: 7. Dezember 2021, 22:35:21
Invalid config for [template]: [sensor] is an invalid option for [template]. Check: template->sensor. (See ?, line ?).