Rule with blocky - once a day

Hi!
I need help for a blocky rule.
I am heating up my warm water.
I send a command to start the heating when the temperature is less than 60°C (Shelly).
When the temperature is >= 60°C the rule should stop.
This should only happen once a day, because the water is cooling down…and the rule starts again.
Is there a possibility for *once a day??

I think you misunderstand rule triggering.
When you trigger a rule, it runs and does whatever, then exits. It’s all event driven.

So yes of course you can set up a rule to trigger at 08:00. The rule will run at 8am, and then its all over until tomorrow.
Setting up rule triggers in GUI rule entry is the same for all languages - this is an openHAB thing, not a Blockly thing.

I don’t think that is what you are asking for, really?
If the water got cold at 08:30, the rule will do nothing.

Are you perhaps looking for something more like -
Trigger a rule when the water temp changes.
Inside the rule, check the time of day - if between 08:00 and 09:00 …
And if temperature < X …
Then do whatever it is.

No, that is not the Problem…(I have many rules and i understand them :wink: )
The Problem is:
The water is heating up. Sometimes the temperature is at 10:00 at 60°C, and
sometimes at 11:00 or 12:00…

  • When the water has a temperature of 60°C i want to stop the rule (that is not the Problem)
  • The water in the tank cools down, and the rule starts again,…that is the Problem.
    I want to heat up the water only once a day to 60°C and start another rule for example heating up my heating water…

I would:

  • Create a new Switch Item
  • Your rule checks this Switch Item
    • If OFF, allow heating, else do not allow heating.
    • After heating, turn new Switch Item ON
  • Create a new rule which runs once overnight, which turns this new Switch Item OFF.
1 Like

Wow, that is an good idea!!!
I will test ist.
Thank you :slight_smile:

If you have a problem with a rule it is really smart to show the rule

yes, you are right, but the rule is about two pages long…

@hafniumzinc’s approach would be the simplest and most generic approach. The only thing I’d add is to make your check for the state of the Switch Item in a Condition (“but only if section” of the rule). That will simplify your script action since it can assume it’s allowed to run if you get that far and in some cases it can add opportunities when you have rules that call other rules where the calling rule gets to choose whether or not the conditions are applied.

Thank you all! :slight_smile: :slight_smile:
The Idea with the switch was the best…so simple but genius…
Here is my rule as script (blocky was to big to show), because @rossko57 want to see it :wink:

Rule 1: Heizung & Warmwasser

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: Shelly3EMSHEM3_KumulierterVerbrauch
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/javascript
      script: >-
        if (itemRegistry.getItem('Temperatur_Schalter').getState() == 'OFF') {
                  if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() > '-100' || itemRegistry.getItem('Sma_ActivePowerWatt').getState() < '500' || itemRegistry.getItem('Shelly_Temperatur_HW_Puffer').getState() >= '60') {
                    events.sendCommand('Shelly4Heizpatrone_Relay0', 'OFF');
                    events.sendCommand('Shelly4Heizpatrone_Relay1', 'OFF');
                    events.sendCommand('Shelly4Heizpatrone_Relay2', 'OFF');
                    events.sendCommand('Shelly4Heizpatrone_Relay3', 'OFF');
                    events.sendCommand('ShellyHeizstab1_Betrieb', 'OFF');
                  } else {
                    if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'OFF' && itemRegistry.getItem('ShellyHeizstab1_Betrieb').getState() == 'OFF') {
                      events.sendCommand('Shelly4Heizpatrone_Relay1', 'OFF');
                      events.sendCommand('Shelly4Heizpatrone_Relay2', 'OFF');
                      events.sendCommand('ShellyHeizstab1_Betrieb', 'OFF');
                      events.sendCommand('Shelly4Heizpatrone_Relay0', 'ON');
                    } else {
                      if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'ON' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'OFF' && itemRegistry.getItem('ShellyHeizstab1_Betrieb').getState() == 'OFF') {
                        events.sendCommand('Shelly4Heizpatrone_Relay2', 'OFF');
                        events.sendCommand('Shelly4Heizpatrone_Relay0', 'OFF');
                        events.sendCommand('ShellyHeizstab1_Betrieb', 'OFF');
                        events.sendCommand('Shelly4Heizpatrone_Relay1', 'ON');
                      } else {
                        if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'ON' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'OFF' && itemRegistry.getItem('ShellyHeizstab1_Betrieb').getState() == 'OFF') {
                          events.sendCommand('Shelly4Heizpatrone_Relay2', 'OFF');
                          events.sendCommand('ShellyHeizstab1_Betrieb', 'OFF');
                          events.sendCommand('Shelly4Heizpatrone_Relay0', 'ON');
                          events.sendCommand('Shelly4Heizpatrone_Relay1', 'ON');
                        } else {
                          if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'ON' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'ON' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'OFF' && itemRegistry.getItem('ShellyHeizstab1_Betrieb').getState() == 'OFF') {
                            events.sendCommand('Shelly4Heizpatrone_Relay0', 'OFF');
                            events.sendCommand('Shelly4Heizpatrone_Relay1', 'OFF');
                            events.sendCommand('Shelly4Heizpatrone_Relay2', 'OFF');
                            events.sendCommand('ShellyHeizstab1_Betrieb', 'ON');
                          } else {
                            if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'OFF' && itemRegistry.getItem('ShellyHeizstab1_Betrieb').getState() == 'ON') {
                              events.sendCommand('Shelly4Heizpatrone_Relay1', 'OFF');
                              events.sendCommand('Shelly4Heizpatrone_Relay2', 'OFF');
                              events.sendCommand('Shelly4Heizpatrone_Relay0', 'ON');
                              events.sendCommand('ShellyHeizstab1_Betrieb', 'ON');
                            } else {
                              if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'ON' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'OFF' && itemRegistry.getItem('ShellyHeizstab1_Betrieb').getState() == 'ON') {
                                events.sendCommand('Shelly4Heizpatrone_Relay0', 'OFF');
                                events.sendCommand('Shelly4Heizpatrone_Relay2', 'OFF');
                                events.sendCommand('Shelly4Heizpatrone_Relay1', 'ON');
                                events.sendCommand('ShellyHeizstab1_Betrieb', 'ON');
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                } else if (itemRegistry.getItem('Temperatur_Schalter').getState() == 'ON') {
                  if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() > '-100' || itemRegistry.getItem('Sma_ActivePowerWatt').getState() < '500' || itemRegistry.getItem('Shelly_Temperatur_HW_Puffer').getState() >= '60') {
                    events.sendCommand('Shelly4Heizpatrone_Relay0', 'OFF');
                    events.sendCommand('Shelly4Heizpatrone_Relay1', 'OFF');
                    events.sendCommand('Shelly4Heizpatrone_Relay2', 'OFF');
                    events.sendCommand('Shelly4Heizpatrone_Relay3', 'OFF');
                    events.sendCommand('ShellyHeizstab1_Betrieb', 'OFF');
                  } else {
                    if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'OFF') {
                      events.sendCommand('Shelly4Heizpatrone_Relay1', 'OFF');
                      events.sendCommand('Shelly4Heizpatrone_Relay2', 'OFF');
                      events.sendCommand('Shelly4Heizpatrone_Relay0', 'ON');
                    } else {
                      if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'ON' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'OFF') {
                        events.sendCommand('Shelly4Heizpatrone_Relay2', 'OFF');
                        events.sendCommand('Shelly4Heizpatrone_Relay0', 'OFF');
                        events.sendCommand('Shelly4Heizpatrone_Relay1', 'ON');
                      } else {
                        if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'ON' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'OFF') {
                          events.sendCommand('Shelly4Heizpatrone_Relay2', 'OFF');
                          events.sendCommand('Shelly4Heizpatrone_Relay0', 'ON');
                          events.sendCommand('Shelly4Heizpatrone_Relay1', 'ON');
                        } else {
                          if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'ON' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'ON' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'OFF') {
                            events.sendCommand('Shelly4Heizpatrone_Relay0', 'OFF');
                            events.sendCommand('Shelly4Heizpatrone_Relay1', 'OFF');
                            events.sendCommand('Shelly4Heizpatrone_Relay2', 'ON');
                          } else {
                            if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'ON') {
                              events.sendCommand('Shelly4Heizpatrone_Relay1', 'OFF');
                              events.sendCommand('Shelly4Heizpatrone_Relay2', 'ON');
                              events.sendCommand('Shelly4Heizpatrone_Relay0', 'ON');
                            } else {
                              if (itemRegistry.getItem('Shelly3EMSHEM3_KumulierterVerbrauch').getState() < '-600' && itemRegistry.getItem('Shelly4Heizpatrone_Relay0').getState() == 'ON' && itemRegistry.getItem('Shelly4Heizpatrone_Relay1').getState() == 'OFF' && itemRegistry.getItem('Shelly4Heizpatrone_Relay2').getState() == 'ON') {
                                events.sendCommand('Shelly4Heizpatrone_Relay0', 'OFF');
                                events.sendCommand('Shelly4Heizpatrone_Relay2', 'ON');
                                events.sendCommand('Shelly4Heizpatrone_Relay1', 'ON');
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
    type: script.ScriptAction

Rule 2: Übertemperatur

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: Shelly3EMSHEM3_KumulierterVerbrauch
    type: core.ItemStateChangeTrigger
conditions:
  - inputs: {}
    id: "4"
    configuration:
      itemName: ShellyHeizstab1_Temp1
      state: "62"
      operator: ">="
    type: core.ItemStateCondition
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: Temperatur_Schalter
      command: ON
    type: core.ItemCommandAction
  - inputs: {}
    id: "3"
    configuration:
      itemName: ShellyHeizstab1_Betrieb
      command: OFF
    type: core.ItemCommandAction

Rule 3: Untertemperatur

configuration: {}
triggers:
  - id: "1"
    configuration:
      time: 00:00
    type: timer.TimeOfDayTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: Temperatur_Schalter
      command: OFF
    type: core.ItemCommandAction