I write because I modified the rule a little to be able to activate it and deactivate it according to my needs, so I created an item switch in items:
// Activación-desactivación enchufe horario placa solar
Switch Horario_caldera "Está[MAP(horariocaldera.map):%s]" <switch> (Home, Escenas)
I’ve added it to the previous rule:
rule "Calentar tanque placa solar - Mañana encendido"
when
Time cron "0 24 18 ? * MON,TUE,WED,THU,FRI,SAT,SUN *"
then
if(Horario_placa_solar.state == ON) {
(TemperaturaAguaPlacaSolar_Temperatura_Temperature.state < 62 && PotenciaPlacaSolar_Est_Power.state != ON)
PotenciaPlacaSolar_Est_Power.sendCommand(ON)
}
end
rule "Calentar tanque placa solar - Mañana apagado"
when
Item TemperaturaAguaPlacaSolar_Temperatura_Temperature changed
then
if(Horario_placa_solar.state == ON) {
(TemperaturaAguaPlacaSolar_Temperatura_Temperature.state > 65 && PotenciaPlacaSolar_Est_Power.state != OFF)
PotenciaPlacaSolar_Est_Power.sendCommand(OFF)
}
end
And I have written in the sitemap the following:
Group item=Escenas {
Frame label="Horario placa solar"
Default item=Horario_placa_solar
}
The problem I have is that when I activate the item, the rule starts the first part (turns on the resistances) but just at the moment it turns them off again as you can see in the log:
2019-04-12 18:24:00.071 [ome.event.ItemCommandEvent] - Item 'PotenciaPlacaSolar_Est_Power' received command ON
2019-04-12 18:24:00.091 [nt.ItemStatePredictedEvent] - PotenciaPlacaSolar_Est_Power predicted to become ON
==> /var/log/openhab2/openhab.log <==
2019-04-12 18:24:00.147 [INFO ] [smarthome.model.script.notifications] - Sending notification via Telegram.
==> /var/log/openhab2/events.log <==
2019-04-12 18:24:00.162 [vent.ItemStateChangedEvent] - PotenciaPlacaSolar_Est_Power changed from OFF to ON
2019-04-12 18:24:02.283 [vent.ItemStateChangedEvent] - PotenciaPlacaSolar_Voltaje_Voltage changed from 0 to 220
2019-04-12 18:24:02.293 [vent.ItemStateChangedEvent] - PotenciaPlacaSolar_ConsumidoHoy_Today changed from 0.091 to 0.096
2019-04-12 18:24:02.296 [vent.ItemStateChangedEvent] - PotenciaPlacaSolar_CargaDeEnergA_POW_Load changed from 0 to 2144
2019-04-12 18:24:02.298 [vent.ItemStateChangedEvent] - PotenciaPlacaSolar_Actual_Current changed from 0.0 to 9.761
2019-04-12 18:24:10.906 [vent.ItemStateChangedEvent] - TemperaturaAguaPlacaSolar_PotenciaSeAlWifi changed from 62 to 68
2019-04-12 18:24:10.966 [vent.ItemStateChangedEvent] - TemperaturaAguaPlacaSolar_Temperatura_Temperature changed from 61.5 to 61.4
2019-04-12 18:24:11.006 [ome.event.ItemCommandEvent] - Item 'PotenciaPlacaSolar_Est_Power' received command OFF
2019-04-12 18:24:11.021 [nt.ItemStatePredictedEvent] - PotenciaPlacaSolar_Est_Power predicted to become OFF
2019-04-12 18:24:11.035 [vent.ItemStateChangedEvent] - PotenciaPlacaSolar_Est_Power changed from ON to OFF
==> /var/log/openhab2/openhab.log <==
2019-04-12 18:24:11.068 [INFO ] [smarthome.model.script.notifications] - Sending notification via Telegram.
==> /var/log/openhab2/events.log <==
2019-04-12 18:24:13.289 [vent.ItemStateChangedEvent] - PotenciaPlacaSolar_Voltaje_Voltage changed from 220 to 0
2019-04-12 18:24:13.295 [vent.ItemStateChangedEvent] - PotenciaPlacaSolar_ConsumidoHoy_Today changed from 0.096 to 0.101
2019-04-12 18:24:13.298 [vent.ItemStateChangedEvent] - PotenciaPlacaSolar_CargaDeEnergA_POW_Load changed from 2144 to 0
2019-04-12 18:24:13.315 [vent.ItemStateChangedEvent] - PotenciaPlacaSolar_Actual_Current changed from 9.761 to 0.0
2019-04-12 18:24:20.239 [vent.ItemStateChangedEvent] - PotenciaPlacaSolar_PotenciaSeAlWifi_RSSI changed from 78 to 74
I did the same process in another rule and it works well for me:
rule "Encender enchufe caldera"
when
//De lunes a viernes a las 6:45
Time cron "0 45 6 ? * MON,TUE,WED,THU,FRI *" or
//De lunes a viernes y domingo a las 19:00
Time cron "0 0 19 ? * MON,TUE,WED,THU,FRI,SUN *" or
//Sábado a las 8:00
Time cron "0 0 8 ? * SAT *"
then
if(Horario_caldera.state == ON) {
sendCommand(EnchufeCalderaPatioDeLuces_Switch, "ON")
}
end
rule "Apagar enchufe caldera"
when
//De lunes a viernes a las 7:45
Time cron "0 45 7 ? * MON,TUE,WED,THU,FRI *" or
//De lunes a viernes y domingo a las 20:45
Time cron "0 45 20 ? * MON,TUE,WED,THU,FRI,SUN *" or
//Sábado a las 9:00
Time cron "0 0 9 ? * SAT *"
then
if(Horario_caldera.state == ON) {
sendCommand(EnchufeCalderaPatioDeLuces_Switch, "OFF")
}
end
I’m sure I’ve screwed up something but I can not see it …