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 for your support!

There is a Blockly plug-in node available for NodeRED. Does that help ?

Hi,

I have spend more time to convert the flow. Below you can see the current version which is working.

The switch in Lovelace to select the time period is called ā€œberegeningsduurā€. The pump is called ā€œberegeningspompā€.

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. After, that, when I select 60, 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.

Iā€™m sorry I canā€™t help on this - what I meant was there is a Blockly node for NodeRED that might allow you to exactly match your implementation

1 Like

EDIT This works: image
Otherwise, you can also use a stoptimer node for that.
In my opinion they are easier to handle with external payloads :slight_smile:

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ā€}

Hi Kevin, thanks for your help. I want to learn more about Node-RED and its configuration. Therefore I have chosen to create this flow from scratch in Node-RED. I am happy that it is working now.

Can you export the flow please? I think you can severly reduce the amount of required nodes. For example, the 4 State nodes on the left, all get the state from one input_select correct? So this could all be made into one.

Hi Marcus, I hereby send you the flow. The 4 states on the left all receive the state from one input_select.

[{"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}]

Thanks in advance for your help!

Hi Marcus, I have received this flow from somebody else on the Node-RED forum. However, I am not able to add the "beregeningsduurā€™ node on the left and the ā€˜beregeningspompā€™ on the right. Do you know how to deal with this?

[{"id":"b106be9c.6eec78","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"22d73cd0.89c82c","type":"trigger","z":"b106be9c.6eec78","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"30","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":550,"y":240,"wires":[["a57e6079.d2c628"]]},{"id":"5b8ecc11.fb3364","type":"trigger","z":"b106be9c.6eec78","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"60","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":550,"y":288,"wires":[["a57e6079.d2c628"]]},{"id":"613bede9.2218b4","type":"trigger","z":"b106be9c.6eec78","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"90","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":550,"y":336,"wires":[["a57e6079.d2c628"]]},{"id":"9d00a87b.14f5f8","type":"switch","z":"b106be9c.6eec78","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":288,"wires":[["78019600.a37258"],["78019600.a37258","e900646b.86ca18"],["5b8ecc11.fb3364","78019600.a37258"],["78019600.a37258","84c695f2.0e9d58"]],"l":false},{"id":"78019600.a37258","type":"change","z":"b106be9c.6eec78","name":"reset trigger","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":395,"y":180,"wires":[["22d73cd0.89c82c","5b8ecc11.fb3364","613bede9.2218b4"]],"l":false},{"id":"47f904af.47df84","type":"change","z":"b106be9c.6eec78","name":"uit","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"option\": \"Uit\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":312,"wires":[[]]},{"id":"5df7b9b2.6e3278","type":"comment","z":"b106be9c.6eec78","name":"van HA: beregeningsduur","info":"","x":158,"y":288,"wires":[]},{"id":"5e42c02e.9270b","type":"comment","z":"b106be9c.6eec78","name":"naar HA: Beregeningspomp","info":"","x":984,"y":288,"wires":[]},{"id":"a57e6079.d2c628","type":"switch","z":"b106be9c.6eec78","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":663,"y":288,"wires":[["1ecc3d49.13961b"],["47f904af.47df84"]],"l":false},{"id":"1ecc3d49.13961b","type":"change","z":"b106be9c.6eec78","name":"Aan","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"option\": \"Aan\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":264,"wires":[[]]},{"id":"e900646b.86ca18","type":"delay","z":"b106be9c.6eec78","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":399,"y":240,"wires":[["22d73cd0.89c82c"]],"l":false},{"id":"c2d32afc.b49e6","type":"delay","z":"b106be9c.6eec78","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":399,"y":288,"wires":[[]],"l":false},{"id":"84c695f2.0e9d58","type":"delay","z":"b106be9c.6eec78","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":[["613bede9.2218b4"]],"l":false}]```

What do you mean you cannot add it?
I just looked at the new Code and its similar to what i had in mind :slight_smile: I added the 3 nodes for you:

[{"id":"f08619b4.f24d98","type":"trigger","z":"8cde37bd.bb8b88","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"30","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":550,"y":240,"wires":[["e59cb1ce.0a2c3"]]},{"id":"4574c873.143c08","type":"trigger","z":"8cde37bd.bb8b88","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"60","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":550,"y":288,"wires":[["e59cb1ce.0a2c3"]]},{"id":"a8d0a83a.9b7578","type":"trigger","z":"8cde37bd.bb8b88","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"90","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":550,"y":336,"wires":[["e59cb1ce.0a2c3"]]},{"id":"8ddf14c1.6825c8","type":"switch","z":"8cde37bd.bb8b88","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":288,"wires":[["36453a27.5ee3b6"],["36453a27.5ee3b6","9611ff99.ad05f"],["4574c873.143c08","36453a27.5ee3b6"],["36453a27.5ee3b6","88bb011f.cf01b"]],"l":false},{"id":"36453a27.5ee3b6","type":"change","z":"8cde37bd.bb8b88","name":"reset trigger","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":395,"y":180,"wires":[["f08619b4.f24d98","4574c873.143c08","a8d0a83a.9b7578"]],"l":false},{"id":"57c14bd9.5eb0a4","type":"change","z":"8cde37bd.bb8b88","name":"uit","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"option\": \"Uit\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":312,"wires":[["7aaa811f.8fbf6"]]},{"id":"35f80ea9.c2a6f2","type":"comment","z":"8cde37bd.bb8b88","name":"van HA: beregeningsduur","info":"","x":150,"y":220,"wires":[]},{"id":"36935aaa.1dca36","type":"comment","z":"8cde37bd.bb8b88","name":"naar HA: Beregeningspomp","info":"","x":960,"y":160,"wires":[]},{"id":"e59cb1ce.0a2c3","type":"switch","z":"8cde37bd.bb8b88","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":663,"y":288,"wires":[["bf2ce8d8.87a718"],["57c14bd9.5eb0a4"]],"l":false},{"id":"bf2ce8d8.87a718","type":"change","z":"8cde37bd.bb8b88","name":"Aan","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"option\": \"Aan\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":264,"wires":[["60b6ef83.04f33"]]},{"id":"9611ff99.ad05f","type":"delay","z":"8cde37bd.bb8b88","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":399,"y":240,"wires":[["f08619b4.f24d98"]],"l":false},{"id":"91012370.e73ff","type":"delay","z":"8cde37bd.bb8b88","name":"","pauseType":"delay","timeout":"250","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":399,"y":288,"wires":[[]],"l":false},{"id":"88bb011f.cf01b","type":"delay","z":"8cde37bd.bb8b88","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":[["a8d0a83a.9b7578"]],"l":false},{"id":"9b3f6dff.dcde","type":"server-state-changed","z":"8cde37bd.bb8b88","name":"Beregeningsduur: Uit?","server":"d8ca559d.9e7d18","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_select.beregening_handmatig","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":160,"y":280,"wires":[["8ddf14c1.6825c8"]]},{"id":"7aaa811f.8fbf6","type":"api-call-service","z":"8cde37bd.bb8b88","name":"Beregeningspomp: Uit","server":"d8ca559d.9e7d18","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":940,"y":340,"wires":[[]]},{"id":"60b6ef83.04f33","type":"api-call-service","z":"8cde37bd.bb8b88","name":"Beregeningspomp: Aan","server":"d8ca559d.9e7d18","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":970,"y":240,"wires":[[]]},{"id":"d8ca559d.9e7d18","type":"server","z":"","name":"Home Assistant","addon":true}]```
1 Like

Hi, it is working now! Thanks for your help! The final version looks like this:

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

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"}]

Several possibilities to do this. There are timers that you can call from homeassistant for example.
I settled on a manual solution. My NodeRed flow will turn off after the time set via inputnumber. However it will also update the input number to the remaining time every minute and it even works through a restart.

As i have no idea how to select multiple nodes with mobile browser, i just exported most of the complete flow. Check it out and let me know if there are some questions

[
    {
        "id": "f28a8271.df143",
        "type": "tab",
        "label": "Dyson",
        "disabled": false,
        "info": ""
    },
    {
        "id": "e697e6f9.6193d8",
        "type": "server-state-changed",
        "z": "f28a8271.df143",
        "name": "Bedroom Oscillate",
        "server": "2fba4297.e4145e",
        "version": 1,
        "entityidfilter": "input_boolean.bedroomfanoscillate",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 1,
        "output_only_on_state_change": true,
        "x": 90,
        "y": 100,
        "wires": [
            [
                "d4753474.8894d8"
            ]
        ]
    },
    {
        "id": "f59c9504.bda998",
        "type": "server-state-changed",
        "z": "f28a8271.df143",
        "name": "Bedroom Power",
        "server": "2fba4297.e4145e",
        "version": "1",
        "entityidfilter": "input_boolean.bedroomfanpower",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 1,
        "output_only_on_state_change": true,
        "x": 80,
        "y": 160,
        "wires": [
            [
                "9bd5aab1.e01718"
            ]
        ]
    },
    {
        "id": "ba494f52.ca20d",
        "type": "switch",
        "z": "f28a8271.df143",
        "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": 670,
        "y": 100,
        "wires": [
            [
                "3d65a6e6.23513a",
                "6a017f24.1f667"
            ],
            [
                "a63854d7.d290f8"
            ]
        ]
    },
    {
        "id": "3d65a6e6.23513a",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan Power",
        "server": "2fba4297.e4145e",
        "version": 1,
        "service_domain": "fan",
        "service": "turn_on",
        "entityId": "fan.schlafzimmer",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 870,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "1355bb29.decc45",
        "type": "switch",
        "z": "f28a8271.df143",
        "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": 670,
        "y": 160,
        "wires": [
            [
                "3d65a6e6.23513a"
            ],
            [
                "e4dcc395.f4b5c"
            ]
        ]
    },
    {
        "id": "e4dcc395.f4b5c",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan Power Off",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "fan",
        "service": "turn_off",
        "entityId": "fan.schlafzimmer",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 880,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "5c7ed358.93214c",
        "type": "switch",
        "z": "f28a8271.df143",
        "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": 670,
        "y": 280,
        "wires": [
            [
                "21b38f0f.f5c79"
            ],
            [
                "865783d.6277d8",
                "348359e5.e56466",
                "cf1774fb.50e128"
            ]
        ]
    },
    {
        "id": "21b38f0f.f5c79",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Bedroom Power",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "input_boolean",
        "service": "turn_on",
        "entityId": "input_boolean.bedroomfanpower",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 880,
        "y": 280,
        "wires": [
            []
        ]
    },
    {
        "id": "865783d.6277d8",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Bedroom Power Off",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "input_boolean",
        "service": "turn_off",
        "entityId": "input_boolean.bedroomfanpower",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 890,
        "y": 340,
        "wires": [
            []
        ]
    },
    {
        "id": "98e4e962.cb3088",
        "type": "server-state-changed",
        "z": "f28a8271.df143",
        "name": "Fan Oscillate",
        "server": "2fba4297.e4145e",
        "version": 1,
        "entityidfilter": "fan.schlafzimmer",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 1,
        "output_only_on_state_change": false,
        "x": 70,
        "y": 640,
        "wires": [
            [
                "deef47f1.1f84c8"
            ]
        ]
    },
    {
        "id": "89752e34.6078e",
        "type": "switch",
        "z": "f28a8271.df143",
        "name": "",
        "property": "data.attributes.oscillating",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 670,
        "y": 640,
        "wires": [
            [
                "9078b904.4274b8"
            ],
            [
                "c4b3e9bb.b83068"
            ]
        ]
    },
    {
        "id": "9078b904.4274b8",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Bedroom  Oscillate",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "input_boolean",
        "service": "turn_on",
        "entityId": "input_boolean.bedroomfanoscillate",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 890,
        "y": 640,
        "wires": [
            []
        ]
    },
    {
        "id": "c4b3e9bb.b83068",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Bedroom  Oscillate Off",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "input_boolean",
        "service": "turn_off",
        "entityId": "input_boolean.bedroomfanoscillate",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 900,
        "y": 700,
        "wires": [
            []
        ]
    },
    {
        "id": "762b3846.4a5a18",
        "type": "server-state-changed",
        "z": "f28a8271.df143",
        "name": "Timer",
        "server": "2fba4297.e4145e",
        "version": 1,
        "entityidfilter": "input_number.bedroom_fantime",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "0",
        "halt_if_type": "num",
        "halt_if_compare": "lte",
        "outputs": 2,
        "output_only_on_state_change": true,
        "x": 50,
        "y": 1000,
        "wires": [
            [],
            [
                "efed7a03.a97558"
            ]
        ]
    },
    {
        "id": "cf1774fb.50e128",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "AbkĆ¼hlen Off",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "input_boolean",
        "service": "turn_off",
        "entityId": "input_boolean.abkuhlenbr",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 870,
        "y": 400,
        "wires": [
            []
        ]
    },
    {
        "id": "e39884b5.6590b8",
        "type": "server-state-changed",
        "z": "f28a8271.df143",
        "name": "AbkĆ¼hlen",
        "server": "2fba4297.e4145e",
        "version": "1",
        "entityidfilter": "input_boolean.abkuhlenbr",
        "entityidfiltertype": "exact",
        "outputinitially": true,
        "state_type": "str",
        "haltifstate": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 1,
        "output_only_on_state_change": true,
        "x": 60,
        "y": 1060,
        "wires": [
            [
                "f2777dde.3abb9"
            ]
        ]
    },
    {
        "id": "2e1cd205.f84b8e",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan oscillate",
        "server": "2fba4297.e4145e",
        "version": 1,
        "service_domain": "fan",
        "service": "oscillate",
        "entityId": "fan.schlafzimmer",
        "data": "{\"oscillating\":\"true\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 990,
        "y": 40,
        "wires": [
            []
        ]
    },
    {
        "id": "a63854d7.d290f8",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan Oscillate Off",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "fan",
        "service": "oscillate",
        "entityId": "fan.schlafzimmer",
        "data": "{\"oscillating\":\"false\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 890,
        "y": 100,
        "wires": [
            []
        ]
    },
    {
        "id": "cac52285.f8fbb",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Bedroom Night Mode",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "input_boolean",
        "service": "turn_on",
        "entityId": "input_boolean.bedroomfannightmode",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 900,
        "y": 760,
        "wires": [
            []
        ]
    },
    {
        "id": "ffc0e726.7b8d88",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Bedroom Night Mode Off",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "input_boolean",
        "service": "turn_off",
        "entityId": "input_boolean.bedroomfannightmode",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 910,
        "y": 820,
        "wires": [
            []
        ]
    },
    {
        "id": "b6874307.4eb0f",
        "type": "server-state-changed",
        "z": "f28a8271.df143",
        "name": "Fan Night Mode",
        "server": "2fba4297.e4145e",
        "version": "1",
        "entityidfilter": "fan.schlafzimmer",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 1,
        "output_only_on_state_change": false,
        "x": 80,
        "y": 760,
        "wires": [
            [
                "997c493.3f651b8"
            ]
        ]
    },
    {
        "id": "5dffb82a.127148",
        "type": "switch",
        "z": "f28a8271.df143",
        "name": "",
        "property": "data.attributes.night_mode",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 670,
        "y": 760,
        "wires": [
            [
                "cac52285.f8fbb"
            ],
            [
                "ffc0e726.7b8d88"
            ]
        ]
    },
    {
        "id": "cd133c4d.0a525",
        "type": "server-state-changed",
        "z": "f28a8271.df143",
        "name": "Bedroom Night Mode",
        "server": "2fba4297.e4145e",
        "version": "1",
        "entityidfilter": "input_boolean.bedroomfannightmode",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 1,
        "output_only_on_state_change": false,
        "x": 100,
        "y": 880,
        "wires": [
            [
                "5a42e31b.19d49c"
            ]
        ]
    },
    {
        "id": "7320a9c8.25ab18",
        "type": "switch",
        "z": "f28a8271.df143",
        "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": 670,
        "y": 880,
        "wires": [
            [
                "3e60ab01.686264"
            ],
            [
                "eb7e2f4c.90981"
            ]
        ]
    },
    {
        "id": "3e60ab01.686264",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan Night",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "dyson",
        "service": "set_night_mode",
        "entityId": "fan.schlafzimmer",
        "data": "{\"night_mode\":\"true\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 860,
        "y": 880,
        "wires": [
            []
        ]
    },
    {
        "id": "eb7e2f4c.90981",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan Night",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "dyson",
        "service": "set_night_mode",
        "entityId": "fan.schlafzimmer",
        "data": "{\"night_mode\":\"false\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 860,
        "y": 940,
        "wires": [
            []
        ]
    },
    {
        "id": "26227fe7.52ffb",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Bedroom Speed",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "input_number",
        "service": "set_value",
        "entityId": "input_number.bedroom_fanspeed",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 880,
        "y": 520,
        "wires": [
            []
        ]
    },
    {
        "id": "9ac4e0af.96e86",
        "type": "function",
        "z": "f28a8271.df143",
        "name": "Speed",
        "func": "newmsg = {}\n\nnewmsg.payload = { data: { \"value\":msg.data.new_state.attributes.speed} }\n\nreturn newmsg;\n",
        "outputs": 1,
        "noerr": 0,
        "x": 670,
        "y": 520,
        "wires": [
            [
                "26227fe7.52ffb"
            ]
        ]
    },
    {
        "id": "75a85d93.2790b4",
        "type": "server-state-changed",
        "z": "f28a8271.df143",
        "name": "Bedroom Speed",
        "server": "2fba4297.e4145e",
        "version": "1",
        "entityidfilter": "input_number.bedroom_fanspeed",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 1,
        "output_only_on_state_change": true,
        "x": 80,
        "y": 580,
        "wires": [
            [
                "9e5cdd7a.ed4e2"
            ]
        ]
    },
    {
        "id": "bf3c6ea0.e20bf",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan Speed",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "fan",
        "service": "set_speed",
        "entityId": "fan.schlafzimmer",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 870,
        "y": 580,
        "wires": [
            []
        ]
    },
    {
        "id": "ac7936ce.2e47f8",
        "type": "function",
        "z": "f28a8271.df143",
        "name": "Speed",
        "func": "newmsg = {}\n\nnewmsg.payload = { data: { \"speed\":(parseFloat(msg.payload).toFixed(0))} }\n\nreturn newmsg;\n",
        "outputs": 1,
        "noerr": 0,
        "x": 670,
        "y": 580,
        "wires": [
            [
                "bf3c6ea0.e20bf"
            ]
        ]
    },
    {
        "id": "42588aa2.f95df4",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan Power Off",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "fan",
        "service": "turn_off",
        "entityId": "fan.schlafzimmer",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 880,
        "y": 1000,
        "wires": [
            []
        ]
    },
    {
        "id": "efed7a03.a97558",
        "type": "function",
        "z": "f28a8271.df143",
        "name": "on/off?",
        "func": "newmsg = {};\nif (msg.payload == \"1.0\")\n{\n    newmsg.payload = \"True\";\n}else {\n    newmsg.payload = \"STOP\";\n}\n\nreturn newmsg;",
        "outputs": 1,
        "noerr": 0,
        "x": 270,
        "y": 1000,
        "wires": [
            [
                "29e2b309.8447dc"
            ]
        ]
    },
    {
        "id": "29e2b309.8447dc",
        "type": "stoptimer",
        "z": "f28a8271.df143",
        "duration": "1",
        "units": "Minute",
        "payloadtype": "num",
        "payloadval": "1",
        "name": "",
        "x": 660,
        "y": 1000,
        "wires": [
            [
                "42588aa2.f95df4"
            ],
            []
        ]
    },
    {
        "id": "348359e5.e56466",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Bedroom Timer 0",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "input_number",
        "service": "set_value",
        "entityId": "input_number.bedroom_fantime",
        "data": "{\"value\":\"0\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 890,
        "y": 460,
        "wires": [
            []
        ]
    },
    {
        "id": "f2777dde.3abb9",
        "type": "switch",
        "z": "f28a8271.df143",
        "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": 670,
        "y": 1060,
        "wires": [
            [
                "d12ee5bd.6501d8"
            ],
            [
                "14cbd58a.a36f5a"
            ]
        ]
    },
    {
        "id": "2260ddca.06d482",
        "type": "comment",
        "z": "f28a8271.df143",
        "name": "Dyson Bedroom",
        "info": "",
        "x": 80,
        "y": 20,
        "wires": []
    },
    {
        "id": "14cbd58a.a36f5a",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan Power Off",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "fan",
        "service": "turn_off",
        "entityId": "fan.schlafzimmer",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 880,
        "y": 1240,
        "wires": [
            []
        ]
    },
    {
        "id": "77da2a83.6a98f4",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan oscillate",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "fan",
        "service": "oscillate",
        "entityId": "fan.schlafzimmer",
        "data": "{\"oscillating\":\"true\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 870,
        "y": 1120,
        "wires": [
            []
        ]
    },
    {
        "id": "4aef8854.b19e08",
        "type": "delay",
        "z": "f28a8271.df143",
        "name": "2s",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 410,
        "y": 640,
        "wires": [
            [
                "146e6453.a341ac"
            ]
        ]
    },
    {
        "id": "146e6453.a341ac",
        "type": "api-current-state",
        "z": "f28a8271.df143",
        "name": "Fan State",
        "server": "2fba4297.e4145e",
        "version": 1,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "override_topic": true,
        "entity_id": "fan.schlafzimmer",
        "state_type": "str",
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "blockInputOverrides": false,
        "x": 540,
        "y": 640,
        "wires": [
            [
                "89752e34.6078e"
            ]
        ]
    },
    {
        "id": "4cef0025.9097c",
        "type": "delay",
        "z": "f28a8271.df143",
        "name": "1s",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 410,
        "y": 760,
        "wires": [
            [
                "435afa38.740924"
            ]
        ]
    },
    {
        "id": "435afa38.740924",
        "type": "api-current-state",
        "z": "f28a8271.df143",
        "name": "Fan State",
        "server": "2fba4297.e4145e",
        "version": "1",
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "override_topic": true,
        "entity_id": "fan.schlafzimmer",
        "state_type": "str",
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "blockInputOverrides": false,
        "x": 540,
        "y": 760,
        "wires": [
            [
                "5dffb82a.127148"
            ]
        ]
    },
    {
        "id": "d12ee5bd.6501d8",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Set Speed to 3",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "fan",
        "service": "set_speed",
        "entityId": "fan.schlafzimmer",
        "data": "{\"speed\":\"3\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 880,
        "y": 1060,
        "wires": [
            [
                "2cf9017d.edb6ee",
                "2f57fda5.d17702"
            ]
        ]
    },
    {
        "id": "2cf9017d.edb6ee",
        "type": "delay",
        "z": "f28a8271.df143",
        "name": "2s",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 1030,
        "y": 1060,
        "wires": [
            [
                "77da2a83.6a98f4"
            ]
        ]
    },
    {
        "id": "2f57fda5.d17702",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan Time to 45",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "input_number",
        "service": "set_value",
        "entityId": "input_number.bedroom_fantime",
        "data": "{\"value\":\"45\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 880,
        "y": 1180,
        "wires": [
            []
        ]
    },
    {
        "id": "f397f3e0.7e85d",
        "type": "server-state-changed",
        "z": "f28a8271.df143",
        "name": "Fantime On?",
        "server": "2fba4297.e4145e",
        "version": 1,
        "entityidfilter": "input_number.bedroom_fantime",
        "entityidfiltertype": "exact",
        "outputinitially": true,
        "state_type": "str",
        "haltifstate": "0",
        "halt_if_type": "num",
        "halt_if_compare": "lte",
        "outputs": 2,
        "output_only_on_state_change": false,
        "x": 330,
        "y": 1360,
        "wires": [
            [],
            [
                "9e15b410.66c768"
            ]
        ]
    },
    {
        "id": "6a7eb16e.13243",
        "type": "api-call-service",
        "z": "f28a8271.df143",
        "name": "Fan Time",
        "server": "2fba4297.e4145e",
        "version": "1",
        "service_domain": "input_number",
        "service": "set_value",
        "entityId": "input_number.bedroom_fantime",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 860,
        "y": 1320,
        "wires": [
            []
        ]
    },
    {
        "id": "145ddf1c.554511",
        "type": "function",
        "z": "f28a8271.df143",
        "name": "Fantime - 1",
        "func": "newmsg = {}\n\nnewmsg.payload = { data: { \"value\":(msg.payload - 1)} }\n\nreturn newmsg;\n",
        "outputs": 1,
        "noerr": 0,
        "x": 670,
        "y": 1320,
        "wires": [
            [
                "6a7eb16e.13243"
            ]
        ]
    },
    {
        "id": "2fba4297.e4145e",
        "type": "server",
        "z": "",
        "name": "Home Assistant",
        "legacy": false,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true
    }
]