@andrew_ha wrote:
Hello,
my goal is to make an automation rule for my Z-wave Thermostat 014g0013 based on incoming data from another party (mqtt). The automation rule should set the given temperature at the given time. The incoming data are now represented as a state of an entity, because I am using the influxdb sensor that allows me to populate a sensor state from the database.The already parsed incoming data also represented as a state of an entity are in following data structure (number of dictionaries in list are variable):
[{'timeOfDay': '10:00', 'value': '25.5'}, {'timeOfDay': '10:58', 'value': '24'}, {'timeOfDay': '11:20', 'value': '23'}, {'timeOfDay': '12:40', 'value': '23'}]
The data is self-explanatory - at time of “timeOfDay” set temperature of “value”. I wrote a code in the template editor which gives me the correct value for my thermostat (as for climate.set_temperature):
{% set list = [{'timeOfDay': "10:32", 'value': '25.5'}, {'timeOfDay': "10:58", 'value': '24'}, {'timeOfDay': "10:00", 'value': '23'}, {'timeOfDay': "11:01", 'value': '23'}] %} {% for dict in list %} {% for y in dict.values() %} {% if y == now().strftime('%H:%M') %} {{ dict['value'] }} {% endif %} {% endfor %} {% endfor %}
Now the problem is how to automate this process. I am thinking about making a automation rule where the trigger part would be a time pattern for every 1 minute. However, I am struggling how to write the condition and action part. I would greatly appreciate any suggestions and comments.
Posts: 1
Participants: 1