@@ -40,32 +40,25 @@ sensor:
4040 - script.execute : regulation_control
4141
4242switch :
43- # Define is router is active or not
44- # When switch is ON, pooling timer will trigger every seconds
45- - platform : template
43+ # Reset values when router based on router activation
44+ - platform : copy
4645 name : " Activate Solar Routing"
47- optimistic : true
48- restore_mode : RESTORE_DEFAULT_OFF
49- id : activate
46+ internal : True
47+ source_id : activate
48+ id : internal_activate
5049 on_turn_on :
5150 then :
52- - light.turn_on : green_led
5351 - lambda : |-
5452 id(relay1_tempo_counter).publish_state(id(full_power_duration).state);
5553 id(relay2_tempo_counter).publish_state(id(full_power_duration).state);
5654 id(relay3_tempo_counter).publish_state(id(full_power_duration).state);
57- id(power_meter_activated) = 1;
5855 on_turn_off :
5956 then :
60- - light.turn_off : green_led
6157 - lambda : |-
6258 id(router_level).publish_state(0);
63- id(real_power).publish_state(NAN);
64- id(consumption).publish_state(NAN);
6559 id(relay1_tempo_counter).publish_state(0);
6660 id(relay2_tempo_counter).publish_state(0);
6761 id(relay3_tempo_counter).publish_state(0);
68- id(power_meter_activated) = 0;
6962 id(energy_divertion1).turn_off();
7063 id(energy_divertion2).turn_off();
7164 id(energy_divertion3).turn_off();
@@ -183,7 +176,7 @@ number:
183176 - light.turn_off : green_led
184177 - if :
185178 condition :
186- - switch.is_on : activate
179+ - lambda : return id(power_meter_activated) == 1;
187180 then :
188181 - light.turn_on : green_led
189182
@@ -204,7 +197,7 @@ number:
204197 then :
205198 - if :
206199 condition :
207- - switch.is_on : activate
200+ - lambda : return id(power_meter_activated) == 1;
208201 then :
209202 - lambda : |-
210203 id(relay1_tempo_counter).publish_state(id(full_power_duration).state);
0 commit comments