@SinisteR wrote:
Hi there, this is my first post and I hope it will not be very dumb
I’ve successfully finished a project for using an water accumulation tank as an energy storage for photo voltaic panels. However I have had bad luck when I was editing my automation with visual studio plugin. I’ve got a connection drop and visual studio for some reason wiped my automation file blank. Now I am trying to write the code again with the same logic (or at least I think it was like that) but I am crashing on “Invalid data for call_service at pos 2: not a valid value for dictionary value @ data[‘entity_id’]” in the log. I am aware that my templates can produce an empty entity_id for the service, that’s because to omit the service action in some cases. I don’t know if this is allowed but also I think it was working like this before.
Here is the code:
- alias: Solar Water Heating Power Injection # The purpose of the automation is to use the accumulation tank of the house as a battery. # There are two 3-phase heating elements top/bottom (heating wires) in the 700l accumulatioln tank. # There is digitally controlled SCR installed in L3 phase. trigger: platform: state entity_id: sensor.solaredge_current_power, sensor.house_current_power condition: condition: state entity_id: binary_sensor.solar_overproduction state: 'on' action: # The first part of action should roughly set the power feed to the water heating elements by setting the power phases # Variables ht1 and ht2 are the tresholds for phases. ht1 is equal to the power of the single phase heating element power, ht2 = ht1 * 2 # turn off the non-needed phases or do nothing (empty entity_id) - service: switch.turn_off data_template: entity_id: "{% if (states('sensor.solaredge_current_power') | int - states('sensor.house_current_power_without_heating') | int) < states.variable.ht1.state | int %} switch.water_heating_L1, switch.water_heating_L2 {% elif (states('sensor.solaredge_current_power') | int - states('sensor.house_current_power_without_heating') | int) < states.variable.ht2.state | int %} switch.water_heating_L1 {% endif %}" # turnd on needed phases or do nothing (empty entity_id) - service: switch.turn_on data_template: entity_id: "{% if (states('sensor.solaredge_current_power') | int - states('sensor.house_current_power_without_heating') | int) > states.variable.ht2.state | int %} switch.water_heating_L1, switch.water_heating_L2 {% elif (states('sensor.solaredge_current_power') | int - states('sensor.house_current_power_without_heating') | int) > states.variable.ht1.state | int %} switch.water_heating_L1 {% endif %}" # this section regulates SCR attached to L3 phase for fine adjustment of the heating power # SCR has range from 0 to 100 steps and two +/- buttons # The purpose with this code is to press +/- buttons until the photovoltaic production = house consumption +/- 10W # press + or - button, or do nothing if the power is in balance - service: switch.turn_on data_template: entity_id: "{% if (states('sensor.solaredge_current_power') | int - states('sensor.house_current_power') | int) > 10 %} switch.Water_Heating_L3_power_step_up {% elif (states('sensor.house_current_power') | int - states('sensor.solaredge_current_power') | int ) > 10 %} switch.Water_Heating_L3_power_step_down {% endif %}" # release the button press, no matter which one was pressed - service: switch.turn_off entity_id: switch.Water_Heating_L3_power_step_up, switch.Water_Heating_L3_power_step_down # get the instant re-measurement (this sould also loop the whole automation as it will change sensor.house_current_power state) - service: mqtt.publish data_template: topic: 'cmnd/water_heating_L3/STATUS' payload: 10 id: 53a32e3e3b69477e96e5edc082634dc9
Thanks in advance for your opinions!
Posts: 2
Participants: 2