From Blockly to Node-RED: migration of irrigation flow

Hi all, in Domoticz Blockly I have defined the following Blockly (see below). However, I want to migrate this to Node-RED in Home Assistant.

This function is triggered when a switch (beregening handmatig) is switched on and one of the predefined values (Off (= Uit), 30, 60 or 90 minutes) is selected. During the selected time period, another switch (beregeningspomp) is switched on. After this time period this switch (beregeningspomp) is switched off. Besides that, it is possible to stop the program when running by putting the switch (beregening handmatig) to ‘uit’.

At this moment, I have added a ‘input_select’ switch to Lovelace. I can put this switch to the predefined values.

I am looking for a solution to migrate this flow to Node-RED. I have a couple of questions:

  • How can I use the input_select switch in Node-RED as trigger?
  • How can I add the predefined time periods to Node-RED, so that the pump is only switched on during the predefined time period.
  • How can I add an override function, so that I can stop the flow during execution?

Thanks in advance for your support!

1 Like

I don't use home assistant, so don't know how your "beregeningspomp" is turned on, but I think the complete flow could be easily moved to node-red (without the need of homeassistant) and I would control it via node-red-dashboard where needed (or even homekit if you use an i-device).

In dashboard you would get something like


And the flow, when the pulldown is changed, all triggers are reset and new timer is set (or off)

1 Like

Hi,

I have spend more time to convert the flow. However, based on your info this was a lot easier. Below you can see the current version which is working. Thanks!

I have not used the dropdown node, because I want to have the selection button displayed in Home Assistant. This switch is called "beregeningsduur".

The only thing which is not working yet, is the reset function. When I select one of the options (30, 60 or 90), the pump "beregeningspomp" is enabled during 30, 60 or 90 minutes. However, when I want to disable the function during the execution (e.g. when I have selected 30 but I had to choose 60), I can put the selector switch to "Uit" (off). The pump is switched off. When I select 60 after that, the pump is switched on again. The only problem is that the "delay 30" is not stopped yet, so within 30 minutes the pump is switched off again, which is not OK.

I have tried to change the delay nodes by trigger nodes and have added a change node which converts the msg.payload to msg.reset, to be able to switch off the trigger nodes, but that is not working yet.

Do you know how to handle this? Thanks in advance for your reaction.

The only thing which is not working yet, is the reset function.

The reason is because you use "delay" nodes, you don't need delays, but triggers. Delays are for "sliding windows", triggers are for triggering. (note that I use delay nodes to send the reset message first followed by the message for the trigger)

See example flow:

[{"id":"ee3863a5.7d7338","type":"debug","z":"f4c451b9.1e4b1","name":"Pomp Uit","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":636,"y":264,"wires":[]},{"id":"65ab1ac1.24ab1c","type":"switch","z":"f4c451b9.1e4b1","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Off","vt":"str"},{"t":"eq","v":"30","vt":"num"},{"t":"eq","v":"60","vt":"num"},{"t":"eq","v":"90","vt":"num"}],"checkall":"true","repair":false,"outputs":4,"x":386,"y":384,"wires":[["ee3863a5.7d7338","757de5ac.42d994"],["757de5ac.42d994","94245960.3b3878"],["757de5ac.42d994","330ee386.cb3a6c"],["757de5ac.42d994","31840901.ddc2b6"]]},{"id":"c69254dc.1bd42","type":"trigger","z":"f4c451b9.1e4b1","op1":"","op2":"Off","op1type":"pay","op2type":"str","duration":"30","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":886,"y":336,"wires":[["f6525791.e1bde8"]]},{"id":"9b936561.60bcc","type":"trigger","z":"f4c451b9.1e4b1","op1":"","op2":"Off","op1type":"pay","op2type":"str","duration":"60","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":886,"y":384,"wires":[["f6525791.e1bde8"]]},{"id":"475d4281.d01f1c","type":"trigger","z":"f4c451b9.1e4b1","op1":"","op2":"Off","op1type":"pay","op2type":"str","duration":"90","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":886,"y":432,"wires":[["f6525791.e1bde8"]]},{"id":"757de5ac.42d994","type":"change","z":"f4c451b9.1e4b1","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":656,"y":480,"wires":[["c69254dc.1bd42","9b936561.60bcc","475d4281.d01f1c"]]},{"id":"94245960.3b3878","type":"delay","z":"f4c451b9.1e4b1","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":591,"y":336,"wires":[["c69254dc.1bd42"]],"l":false},{"id":"330ee386.cb3a6c","type":"delay","z":"f4c451b9.1e4b1","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":591,"y":384,"wires":[["9b936561.60bcc"]],"l":false},{"id":"31840901.ddc2b6","type":"delay","z":"f4c451b9.1e4b1","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":591,"y":432,"wires":[["475d4281.d01f1c"]],"l":false},{"id":"f6525791.e1bde8","type":"debug","z":"f4c451b9.1e4b1","name":"Pomp Aan","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1198,"y":384,"wires":[]},{"id":"ba7021fd.0847e8","type":"inject","z":"f4c451b9.1e4b1","name":"","topic":"","payload":"30","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":360,"wires":[["65ab1ac1.24ab1c"]]},{"id":"f91a89ef.d9eaa8","type":"inject","z":"f4c451b9.1e4b1","name":"","topic":"","payload":"60","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":408,"wires":[["65ab1ac1.24ab1c"]]},{"id":"9a83fd40.d1fa1","type":"inject","z":"f4c451b9.1e4b1","name":"","topic":"","payload":"90","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":456,"wires":[["65ab1ac1.24ab1c"]]},{"id":"ebf14e6b.d4f5e","type":"inject","z":"f4c451b9.1e4b1","name":"","topic":"","payload":"Off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":312,"wires":[["65ab1ac1.24ab1c"]]}]
1 Like

Hi, I have updated the flow and replaced the 'delay nodes' by 'trigger nodes'. Besides that, I have updated the 'change node'. It is working now! If you still see any possibilities to optimise this flow, please let me know.

To make sure that other people can use this flow, I have attached the detailed configuration.

To create a selection switch for setting the duration time for the “beregening handmatig” function, the following code needs to be added to configuration.yaml:

beregening_handmatig:
    name: Duur Handmatige Beregening
    options:
      - Uit
      - 30 minuten
      - 60 minuten
      - 90 minuten
    initial: Uit

Node-RED configuration:

  • Events state: Beregeningsduur: Uit? / 30 min? / 60 min? / 90 min?

    • Server: Home Assistant

    • Entity ID: input_select.beregening_handmatig

    • If State: is Uit / 30 minuten / 60 minuten / 90 minuten

    • Enable ‘Output only on state change’

  • Switch

    • == Uit

    • == 30 minuten

    • == 60 minuten

    • == 90 minuten

  • Call Service: Beregeningspomp: Uit

    • Server: Home Assistant

    • Domain: homeassistant

    • Service: turn_off

    • Entity ID: switch.fibaro_fgs222_beregeningspomp

  • Call Service: Beregeningspomp: Aan (3x)

    • Server: Home Assistant

    • Domain: homeassistant

    • Service: turn_on

    • Entity ID: switch.fibaro_fgs222_beregeningspomp

  • Change Node: Reset

    • Set msg.reset to true
  • Trigger: 30 min / 60 min / 90 min

    • Send: nothing

    • Then wait for

    • 30 minutes / 60 minutes / 90 minutes

    • Then send 0

  • Call Service: Beregeningspomp: Uit

    • Server: Home Assistant

    • Domain: homeassistant

    • Service: turn_off

    • Entity ID: switch.fibaro_fgs222_beregeningspomp

  • Call Service: Beregeningsduur: Uit

    • Server: Home Assistant

    • Domain: input_select

    • Service: select_option

    • Entity ID: input_select.beregening_handmatig

    • Data: {"option": "Uit"}

I think you might end up with race conditions, as you do not decide which message arrives quicker, the reset or the message from the "Beregeningspomp" (which I why used additional delay nodes to get the reset first, followed by the trigger).

Also do you need 4 * Beregeningspomp nodes, cannot not reuse them ?
And you should be able to connect only a single "Beregeningsduur" from home assistant and filter for the value.

I don’t understand what you mean with race conditions and what exactly can go wrong. Can you please explain what you mean? Or give me an example.

Do I need to add delays just before the triggers to prevent this issue?

Do you know a way how I can filter beregeningsduur based on the selection so that I don’t need to add this four times?

Thanks in advance for your help.

Ik doe het even in het Nederlands
Ik ben niet thuis in home assistant zoals gezegd, alles in node-red :wink:

Maar die "Beregeningsduur" homeassistant node, kun je daar niet direct de opties van uitlezen (zonder er 4 te hoeven gebruiken) ?

Voor de "Beregeningspomp" node, die zijn allemaal hetzelfde toch ? Daar kun je er ook 1 van maken en die doorsturen naar de trigger (of delay -> trigger).

Zou je je flow kunnen posten, dan kan ik wat beter zien waar je naar toe werkt.

Hi, ik werk nog maar drie weken met Node-RED, kan dus nog genoeg leren. Ik weet niet of de beregeningsduur omgezet kan worden naar Ă©Ă©n node, maar ik begrijp dat dat de flow wel vereenvoudigt. Ik ben benieuwd naar de mogelijkheden.

De 'beregeningspomp: Aan' zijn inderdaad allemaal hetzelfde en zorgen ervoor dat de pomp wordt aangezet.

Hieronder de flow:

[{"id":"de88e96c.433c7","type":"tab","label":"Beregening","disabled":false,"info":""},{"id":"7d20aaa.73ed054","type":"switch","z":"de88e96c.433c7","name":"Switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Uit","vt":"str"},{"t":"eq","v":"30 minuten","vt":"str"},{"t":"eq","v":"60 minuten","vt":"str"},{"t":"eq","v":"90 minuten","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":350,"y":210,"wires":[["7911543f.296774"],["6c029897.9d6ca"],["406a4b93.482b24"],["81612243.4b5aa8"]]},{"id":"10fea9aa.bf56de","type":"server-state-changed","z":"de88e96c.433c7","name":"Beregeningsduur: Uit?","server":"ab0c7805.ea8858","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_select.beregening_handmatig","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"Uit","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":160,"y":120,"wires":[["7d20aaa.73ed054"],[]]},{"id":"6c029897.9d6ca","type":"api-call-service","z":"de88e96c.433c7","name":"Beregeningspomp: Aan","server":"ab0c7805.ea8858","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"switch.fibaro_fgs222_beregeningspomp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":550,"y":180,"wires":[["8c7ad2fc.317e7"]]},{"id":"b7c32034.6c03b","type":"server-state-changed","z":"de88e96c.433c7","name":"Beregeningsduur: 30 min?","server":"ab0c7805.ea8858","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_select.beregening_handmatig","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"30 minuten","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":150,"y":180,"wires":[["7d20aaa.73ed054"],[]]},{"id":"1e78af24.05b219","type":"server-state-changed","z":"de88e96c.433c7","name":"Beregeningsduur 60 min?","server":"ab0c7805.ea8858","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_select.beregening_handmatig","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"60 minuten","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":150,"y":240,"wires":[["7d20aaa.73ed054"],[]]},{"id":"c2f169b8.0a6008","type":"server-state-changed","z":"de88e96c.433c7","name":"Beregeningsduur 90 min?","server":"ab0c7805.ea8858","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_select.beregening_handmatig","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"90 minuten","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":150,"y":300,"wires":[["7d20aaa.73ed054"],[]]},{"id":"406a4b93.482b24","type":"api-call-service","z":"de88e96c.433c7","name":"Beregeningspomp: Aan","server":"ab0c7805.ea8858","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"switch.fibaro_fgs222_beregeningspomp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":550,"y":240,"wires":[["e6f6797a.45d53"]]},{"id":"81612243.4b5aa8","type":"api-call-service","z":"de88e96c.433c7","name":"Beregeningspomp: Aan","server":"ab0c7805.ea8858","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"switch.fibaro_fgs222_beregeningspomp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":550,"y":300,"wires":[["e0f6584e.6dcac8"]]},{"id":"7911543f.296774","type":"api-call-service","z":"de88e96c.433c7","name":"Beregeningspomp: Uit","server":"ab0c7805.ea8858","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_off","entityId":"switch.fibaro_fgs222_beregeningspomp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":540,"y":120,"wires":[["439b69da.1fbe"]]},{"id":"cab977a1.5fb678","type":"comment","z":"de88e96c.433c7","name":"Beregening Handmatig","info":"","x":140,"y":60,"wires":[]},{"id":"732594f6.c76a5c","type":"api-call-service","z":"de88e96c.433c7","name":"Beregeningspomp: Uit","server":"ab0c7805.ea8858","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_off","entityId":"switch.fibaro_fgs222_beregeningspomp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":960,"y":210,"wires":[[]]},{"id":"d3517ad5.e261a8","type":"api-call-service","z":"de88e96c.433c7","name":"Beregeningsduur: Uit","server":"ab0c7805.ea8858","version":1,"debugenabled":false,"service_domain":"input_select","service":"select_option","entityId":"input_select.beregening_handmatig","data":"{\"option\": \"Uit\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":960,"y":269,"wires":[[]]},{"id":"439b69da.1fbe","type":"change","z":"de88e96c.433c7","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":120,"wires":[["8c7ad2fc.317e7","e6f6797a.45d53","e0f6584e.6dcac8"]]},{"id":"8c7ad2fc.317e7","type":"trigger","z":"de88e96c.433c7","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"30","extend":false,"units":"min","reset":"","bytopic":"all","name":"30 min","x":750,"y":180,"wires":[["732594f6.c76a5c","d3517ad5.e261a8"]]},{"id":"e6f6797a.45d53","type":"trigger","z":"de88e96c.433c7","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"60","extend":false,"units":"min","reset":"","bytopic":"all","name":"60 min","x":750,"y":240,"wires":[["732594f6.c76a5c","d3517ad5.e261a8"]]},{"id":"e0f6584e.6dcac8","type":"trigger","z":"de88e96c.433c7","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"90","extend":false,"units":"min","reset":"","bytopic":"all","name":"90 min","x":750,"y":300,"wires":[["732594f6.c76a5c","d3517ad5.e261a8"]]},{"id":"ab0c7805.ea8858","type":"server","z":"","name":"Home Assistant","addon":true}]

Nogmaals bedankt voor het meedenken!

Sluit eens een debug node aan op 1 van die "beregeningsduur:x" nodes, wat is de output daarvan als je de pulldown veranderd in home assistant ?

Dit is het resultaat:

Schermafbeelding 2020-03-16 om 19.34.42

En als je m veranderd naar “60 minuten” dan krijg je “60 minuten”?

en wat voor input verwacht "Beregeningspomp" ?

Probeer deze flow:

[{"id":"14402736.425229","type":"trigger","z":"e7da55c7.1c95b","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"30","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":550,"y":336,"wires":[["e16f2fd5.53fbe"]]},{"id":"9bdc55d5.42ddd8","type":"trigger","z":"e7da55c7.1c95b","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"60","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":550,"y":384,"wires":[["e16f2fd5.53fbe"]]},{"id":"9308e26e.31542","type":"trigger","z":"e7da55c7.1c95b","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"90","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":550,"y":432,"wires":[["e16f2fd5.53fbe"]]},{"id":"b8108a64.a5bfe8","type":"switch","z":"e7da55c7.1c95b","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"uit","vt":"str"},{"t":"cont","v":"30","vt":"str"},{"t":"cont","v":"60","vt":"str"},{"t":"cont","v":"90","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":303,"y":384,"wires":[["1ce435f9.2297ea"],["1ce435f9.2297ea","8bc20b12.ce9e58"],["9bdc55d5.42ddd8","1ce435f9.2297ea"],["1ce435f9.2297ea","d1400d23.af46e8"]],"l":false},{"id":"1ce435f9.2297ea","type":"change","z":"e7da55c7.1c95b","name":"reset trigger","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":399,"y":288,"wires":[["14402736.425229","9bdc55d5.42ddd8","9308e26e.31542"]],"l":false},{"id":"f4900389.3d259","type":"change","z":"e7da55c7.1c95b","name":"uit","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"option\": \"Uit\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":408,"wires":[[]]},{"id":"ae0c9a66.89b4b","type":"comment","z":"e7da55c7.1c95b","name":"van HA: beregeningsduur","info":"","x":158,"y":384,"wires":[]},{"id":"606368cf.7b5b5","type":"comment","z":"e7da55c7.1c95b","name":"naar HA: Beregeningspomp","info":"","x":984,"y":384,"wires":[]},{"id":"e16f2fd5.53fbe","type":"switch","z":"e7da55c7.1c95b","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":663,"y":384,"wires":[["1a62be81.7fca79"],["f4900389.3d259"]],"l":false},{"id":"1a62be81.7fca79","type":"change","z":"e7da55c7.1c95b","name":"Aan","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"option\": \"Aan\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":360,"wires":[[]]},{"id":"8bc20b12.ce9e58","type":"delay","z":"e7da55c7.1c95b","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":399,"y":336,"wires":[["14402736.425229"]],"l":false},{"id":"9742c58a.66be78","type":"delay","z":"e7da55c7.1c95b","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":399,"y":384,"wires":[[]],"l":false},{"id":"d1400d23.af46e8","type":"delay","z":"e7da55c7.1c95b","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":399,"y":432,"wires":[["9308e26e.31542"]],"l":false}]

Dan hoef je alleen:

  • 1x Beregeningsduur aan het begin en
  • 1x Beregeningspomp aan het eind vast te maken

Maar goed ik weet niet hoe die pomp uit gaat in home assistant en wat voor data hij daar voor nodig heeft.

Bedankt voor je reactie!

Als ik de switch op 60 minuten zet, dan geeft deze inderdaad '60 minuten door'. Ik heb de flow getest en de meeste functies werken prima. Alleen de reset functie werkt niet. De msg.reset komt wel binnen bij de trigger, deze wordt gereset. Alleen gebeurt er verder niets meer. Ik heb een debug node toegevoegd achter de trigger node. Bij een reset gebeurt er niet. Weet je hier nog een oplossing voor?

De switch node is case-senstive, ging niet helemaal goed.

Probeer dit, deze flow werkt (al de inject nodes kun je vervangen met de enkele beregenings duur). Komt er dan uit wat je nodig hebt (uit de debug node)?

[{"id":"b668bf08.9ccb28","type":"debug","z":"e7da55c7.1c95b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":890,"y":648,"wires":[]},{"id":"a8634b8b.ad44c8","type":"trigger","z":"e7da55c7.1c95b","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"30","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":502,"y":600,"wires":[["3029c32b.71cad4"]]},{"id":"260df08e.68ddc8","type":"trigger","z":"e7da55c7.1c95b","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"60","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":502,"y":648,"wires":[["3029c32b.71cad4"]]},{"id":"b76483ef.95aae","type":"trigger","z":"e7da55c7.1c95b","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"90","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":502,"y":696,"wires":[["3029c32b.71cad4"]]},{"id":"60c990e8.f49288","type":"switch","z":"e7da55c7.1c95b","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"Uit","vt":"str"},{"t":"cont","v":"30","vt":"str"},{"t":"cont","v":"60","vt":"str"},{"t":"cont","v":"90","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":255,"y":648,"wires":[["f0c74c5e.a72f08","8d7e6874.530d98"],["f0c74c5e.a72f08","7283ab91.7103ac"],["260df08e.68ddc8","f0c74c5e.a72f08"],["f0c74c5e.a72f08","297538b.3031ac8"]],"l":false},{"id":"f0c74c5e.a72f08","type":"change","z":"e7da55c7.1c95b","name":"reset trigger","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":351,"y":552,"wires":[["a8634b8b.ad44c8","260df08e.68ddc8","b76483ef.95aae"]],"l":false},{"id":"8d7e6874.530d98","type":"change","z":"e7da55c7.1c95b","name":"uit","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"option\": \"Uit\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":722,"y":672,"wires":[["b668bf08.9ccb28"]]},{"id":"3029c32b.71cad4","type":"switch","z":"e7da55c7.1c95b","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":615,"y":648,"wires":[["2fda1427.713aa4"],["8d7e6874.530d98"]],"l":false},{"id":"2fda1427.713aa4","type":"change","z":"e7da55c7.1c95b","name":"Aan","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"option\": \"Aan\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":722,"y":624,"wires":[["b668bf08.9ccb28"]]},{"id":"7283ab91.7103ac","type":"delay","z":"e7da55c7.1c95b","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":351,"y":600,"wires":[["a8634b8b.ad44c8"]],"l":false},{"id":"2dde87af.6cef28","type":"delay","z":"e7da55c7.1c95b","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":351,"y":648,"wires":[[]],"l":false},{"id":"297538b.3031ac8","type":"delay","z":"e7da55c7.1c95b","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":351,"y":696,"wires":[["b76483ef.95aae"]],"l":false},{"id":"d869f7f0.efe87","type":"inject","z":"e7da55c7.1c95b","name":"","topic":"","payload":"30 minuten","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":108,"y":624,"wires":[["60c990e8.f49288"]]},{"id":"5fc2b274.8f52f4","type":"inject","z":"e7da55c7.1c95b","name":"","topic":"","payload":"60 minuten","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":108,"y":672,"wires":[["60c990e8.f49288"]]},{"id":"48f0c89c.adba58","type":"inject","z":"e7da55c7.1c95b","name":"","topic":"","payload":"90 minuten","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":108,"y":720,"wires":[["60c990e8.f49288"]]},{"id":"9e7226f8.a54e58","type":"inject","z":"e7da55c7.1c95b","name":"","topic":"","payload":"Uit","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":98,"y":576,"wires":[["60c990e8.f49288"]]}]
1 Like

Het werkt nu! Super blij mee! Dankjewel! Hieronder het eindresultaat:

Events state: Beregeningsduur:

  • Server: Home Assistant

  • Entity ID: input_select.beregening_handmatig

  • If State: is

  • ‘Tweede veld van If State leeg laten’

  • Enable ‘Output only on state change’

Switch

  • == 30 minuten  1

  • == 60 minuten  2

  • == 90 minuten  3

  • == Uit  4

Delay (3x)

  • Action: Delay each message

  • Fixed delay

  • For 250 milliseconds

Change Node: Reset

  • Set msg.reset to true

Trigger: 30 min / 60 min / 90 min

  • Send: true

  • Then wait for

  • 30 minutes / 60 minutes / 90 minutes

  • Then send false

  • Handling: all messages

Switch

  • == true  1

  • == false  2

Change Node: Aan

  • Set msg.payload

  • To: {"option": "Aan"}

Change Node: Uit

  • Set msg.payload

  • To: {"option": "Uit"}

Call Service: Pomp: Aan

  • Server: Home Assistant

  • Domain: homeassistant

  • Service: turn_on

  • Entity ID: switch.fibaro_fgs222_beregeningspomp

Call Service: Pomp: Uit

  • Server: Home Assistant

  • Domain: homeassistant

  • Service: turn_off

  • Entity ID: switch.fibaro_fgs222_beregeningspomp

Nice!

Denk dat je ook nog een pomp:aan/uit kan verwijderen. En die aan/uit beide naar die enkele node, ligt er een beetje aan wat die node verwacht qua input.

Hi, next step is to build a flow for automatic irrigation. On a predefined start-time, the pump will start. Based on a input_number in home assistant's configuration.yaml, I have build a way to set the duration in minutes (see below). I would like to enable the pump during this duration. After this, the pump needs to switch off again.

I have read different articles on the internet how to deal with this. Based on that, I have build the attached flow. However it doesn't work. The pump goes on, however will not go off after the defined duration. Can anybody help me? Thanks.

[{"id":"38a25e3d.997a72","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"6b5434bf.abd75c","type":"api-call-service","z":"38a25e3d.997a72","name":"Tuinverlichting: Aan","server":"ab0c7805.ea8858","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"switch.tuinverlichting","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":450,"y":240,"wires":[["105934d6.c77223"]]},{"id":"9bfacdd8.e4d2d","type":"bigtimer","z":"38a25e3d.997a72","outtopic":"","outpayload1":"On","outpayload2":"Off","name":"Big Timer","comment":"","lat":"51.766547","lon":"5.578379","starttime":"1230","endtime":"10001","starttime2":0,"endtime2":0,"startoff":"0","endoff":0,"startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":120,"y":260,"wires":[["f3ec4be3.565438"],[],[]]},{"id":"f3ec4be3.565438","type":"switch","z":"38a25e3d.997a72","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":270,"y":240,"wires":[["6b5434bf.abd75c"],[]]},{"id":"d976830d.f86728","type":"delay","z":"38a25e3d.997a72","name":"","pauseType":"delayv","timeout":"1","timeoutUnits":"hours","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":500,"y":380,"wires":[["c674030.13bf78"]]},{"id":"105934d6.c77223","type":"api-current-state","z":"38a25e3d.997a72","name":"","server":"5c4a405b.a230e","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_number.duration","state_type":"str","state_location":"","override_payload":"none","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":710,"y":240,"wires":[["db668cd9.ba8e48","d340e925.8c786"]],"outputLabels":["msg.delay"]},{"id":"bdaf9b7d.db9f","type":"change","z":"38a25e3d.997a72","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"delay","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":380,"wires":[["d976830d.f86728"]]},{"id":"db668cd9.ba8e48","type":"function","z":"38a25e3d.997a72","name":"convert time","func":"msg.payload = parseFloat(msg.payload) * 60000;\nreturn msg;","outputs":1,"noerr":0,"x":150,"y":380,"wires":[["bdaf9b7d.db9f","4c8f1409.f53edc"]]},{"id":"c674030.13bf78","type":"api-call-service","z":"38a25e3d.997a72","name":"Tuinverlichting: Uit","server":"ab0c7805.ea8858","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_off","entityId":"switch.tuinverlichting","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":670,"y":380,"wires":[[]]},{"id":"d340e925.8c786","type":"debug","z":"38a25e3d.997a72","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":800,"y":160,"wires":[]},{"id":"4c8f1409.f53edc","type":"debug","z":"38a25e3d.997a72","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":240,"y":500,"wires":[]},{"id":"ab0c7805.ea8858","type":"server","z":"","name":"Home Assistant","addon":true},{"id":"5c4a405b.a230e","type":"server","z":"","name":"Home Assistant"}]

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.