Sistema completo de Rega em Node-Red e lovelace

Deverá funcionar sem problemas

Chegaste a implementar?

Boas… Sim, já tenho tudo no HA… Mas não estava a funcionar o agendamento… Manual estava a funcionar…

No node Red tinha lá algo que não estava conectado… Mas não te sei dizer agora. Quando pegar nisso novamente já te digo algo.

Obrigado

1 Curtiu

boas…aqui vai uns prints do que te queria dizer…

o agendamento nao funciona…quando faço ativar rega, ele assume 1 de janeiro

ja no node red tenho umas entidades desconectadas-…!!! nao percebo

Obrigado

tens de corrigir esses nodes que estão desconectados. possivelmente as tuas entidades são diferentes das minhas :man_shrugging:
basta corrigir os nomes

eu copiei tudo…apenas alterei parte dos switchs…os nomes ficaram iguais

boas ja consegui ligar as entidades desconectadas… tive que alterar o server.

mas ainda nao está correta a data da proxima rega agendada, quando faço Ativar Rega

alguma dica?
obrigado

Deves ter que alterar o Server nas entidades que estão amarelas.

Obrigado pela partilha!
Também já implementei o teu projeto com umas nuances que posso partilhar caso estejam interessados.

As alterações/acrescentos que fiz foi:

  • Acrescentar a possibilidade de escolher os dias da semana em que rega, por exemplo para regar às segundas, quartas e sextas.

  • Acrescentei um cálculo de necessidade de rega tendo em conta a precipitação dos últimos 10 dias (mm) (com base na API do IPMA) e a previsão de chuva nos próximos dias. precipitation_yesterday < 1 and precipitation_history < 1 and precipitation_history_average < 1 and $number(precipitation_probability) < 50

  • Depois alterei a lógica para ter em conta estas novas variáveis.

3 Curtiram

muito bom! consegues partilhar com as tuas alterações?

Aqui estão os dados atualizados com as minhas alterações:

A única coisa que é preciso alterar é no ultimo fluxo o link do “Precipitation” para obter os dados do distrito/conselho. Tem lá um comentário com a explicação.

Qualquer dúvida disponham.

Node Red Flow

yaml:

binary_sensor:

  - platform: template
    sensors:
      irrigation_running:
        friendly_name: "Rega"
        device_class: power
        value_template: >
          {% if is_state('input_boolean.irrigation_running', 'on') %}
            True
          {% else %}
            False
          {% endif %}
        icon_template: >
          {% if is_state('input_boolean.irrigation_running', 'on') %}
            mdi:run
          {% else %}
            mdi:human-handsdown
          {% endif %}

          
input_boolean:
  irrigation_enable:
    name: "Ativar Rega"
    icon: mdi:water-pump
  
  irrigation_cancel:

  irrigation_manual_run:
    name: "Ativar ciclo manualmente"
    icon: mdi:arrow-right-drop-circle

  irrigation_running:
    name: "Rega em curso"
    
  day_monday:
    name: "Segunda-Feira"
    icon: mdi:alpha-m-circle
    initial: true
  day_tuesday:
    name: "Terça-Feira"
    icon: mdi:alpha-t-circle
    initial: true
  day_wednesday:
    name: "Quarta-Feira"
    icon: mdi:alpha-w-circle
    initial: true  
  day_thursday:
    name: "Quinta-Feira"
    icon: mdi:alpha-t-circle
    initial: true
  day_friday:
    name: "Sexta-Feira"
    icon: mdi:alpha-f-circle
    initial: true
  day_saturday:
    name: "Sábado"
    icon: mdi:alpha-s-circle
    initial: true
  day_sunday:
    name: "Domingo"
    icon: mdi:alpha-s-circle
    initial: true

input_datetime:

  irrigation_next_run_time:
    has_date: true
    has_time: true

  irrigation_last_time_irrigated:
    has_date: true
    has_time: true

input_number:

  # CYCLE
  irrigation_zone1_duration:
    name: "Sector 1"
    min: 0
    max: 10
    step: 1
    icon: mdi:timer

  irrigation_zone2_duration:
    name: "Sector 2"
    min: 0
    max: 10
    step: 1
    icon: mdi:timer

  irrigation_zone3_duration:
    name: "Sector 3"
    min: 0
    max: 10
    step: 1
    icon: mdi:timer

  irrigation_zone4_duration:
    name: "Sector 4"
    min: 0
    max: 10
    step: 1
    icon: mdi:timer

input_select:


  irrigation_cycle1_schedule_time:
    name: "Horas de começo do ciclo 1"
    options:
      - 'Desativado'
      - '00:00'
      - '00:30'
      - '01:00'
      - '01:30'
      - '02:00'
      - '02:30'
      - '03:00'
      - '03:30'
      - '04:00'
      - '04:30'
      - '05:00'
      - '05:30'
      - '06:00'
      - '06:30'
      - '07:00'
      - '07:30'
      - '08:00'
      - '08:30'
      - '09:00'
      - '09:30'
      - '10:00'
      - '10:30'
      - '11:00'
      - '11:30'
      - '12:00'
      - '12:30'
      - '13:00'
      - '13:30'
      - '14:00'
      - '14:30'
      - '15:00'
      - '15:30'
      - '16:00'
      - '16:30'
      - '17:00'
      - '17:30'
      - '18:00'
      - '18:30'
      - '19:00'
      - '19:30'
      - '20:00'
      - '20:30'
      - '21:00'
      - '21:30'
      - '22:00'
      - '22:30'
      - '23:00'
      - '23:30'
    icon: mdi:alarm

  irrigation_cycle2_schedule_time:
    name: "Horas de começo do ciclo 2"
    options:
      - 'Desativado'
      - '00:00'
      - '00:30'
      - '01:00'
      - '01:30'
      - '02:00'
      - '02:30'
      - '03:00'
      - '03:30'
      - '04:00'
      - '04:30'
      - '05:00'
      - '05:30'
      - '06:00'
      - '06:30'
      - '07:00'
      - '07:30'
      - '08:00'
      - '08:30'
      - '09:00'
      - '09:30'
      - '10:00'
      - '10:30'
      - '11:00'
      - '11:30'
      - '12:00'
      - '12:30'
      - '13:00'
      - '13:30'
      - '14:00'
      - '14:30'
      - '15:00'
      - '15:30'
      - '16:00'
      - '16:30'
      - '17:00'
      - '17:30'
      - '18:00'
      - '18:30'
      - '19:00'
      - '19:30'
      - '20:00'
      - '20:30'
      - '21:00'
      - '21:30'
      - '22:00'
      - '22:30'
      - '23:00'
      - '23:30'
    icon: mdi:alarm

  irrigation_cycle3_schedule_time:
    name: "Horas de começo do ciclo 3"
    options:
      - 'Desativado'
      - '00:00'
      - '00:30'
      - '01:00'
      - '01:30'
      - '02:00'
      - '02:30'
      - '03:00'
      - '03:30'
      - '04:00'
      - '04:30'
      - '05:00'
      - '05:30'
      - '06:00'
      - '06:30'
      - '07:00'
      - '07:30'
      - '08:00'
      - '08:30'
      - '09:00'
      - '09:30'
      - '10:00'
      - '10:30'
      - '11:00'
      - '11:30'
      - '12:00'
      - '12:30'
      - '13:00'
      - '13:30'
      - '14:00'
      - '14:30'
      - '15:00'
      - '15:30'
      - '16:00'
      - '16:30'
      - '17:00'
      - '17:30'
      - '18:00'
      - '18:30'
      - '19:00'
      - '19:30'
      - '20:00'
      - '20:30'
      - '21:00'
      - '21:30'
      - '22:00'
      - '22:30'
      - '23:00'
      - '23:30'
    icon: mdi:alarm
    

input_text:

  irrigation_status:
    name: 'Estado atual da Rega'

sensor:

    #===========
    # IRRIGATION SENSORS
    #===========
  - platform: template
    sensors:

      irrigation_next_run_time:
        friendly_name: "Próxima rega agendada"
        value_template: >
          {% if is_state('input_boolean.irrigation_enable', 'on') and
                (states('input_select.irrigation_cycle1_schedule_time') != 'Desativado' or 
                states('input_select.irrigation_cycle2_schedule_time') != 'Desativado' or 
                states('input_select.irrigation_cycle3_schedule_time') != 'Desativado') and 
                (states('input_boolean.day_sunday') != 'off' or 
                states('input_boolean.day_monday') != 'off' or 
                states('input_boolean.day_tuesday') != 'off' or 
                states('input_boolean.day_wednesday') != 'off' or 
                states('input_boolean.day_thursday') != 'off' or
                states('input_boolean.day_friday') != 'off' or 
                states('input_boolean.day_saturday') != 'off' 
                )%}
            
            {{ states.input_datetime.irrigation_next_run_time.attributes.timestamp | timestamp_custom("%a %d %h às %H:%M") }}
            
          {% else %}
            Nenhuma
          {% endif %}
        icon_template: mdi:clock-start 
      
      irrigation_status:
        friendly_name: "Estado atual da Rega"
        value_template: >
          {% if states.input_text.irrigation_status.state == 'unkown' %}
            Desligado
          {% else %}
            {{ states.input_text.irrigation_status.state }}
          {% endif %}

      irrigation_zone1_status:
        friendly_name: "Válvula Sector 1"
        value_template: >
          {% if is_state('switch.irrigation_zone1_valve', 'on') %}
            Aberta
          {% else %}
            Fechada
          {% endif %}     
        icon_template: >
          {% if is_state('switch.irrigation_zone1_valve', 'on') %}
            mdi:pipe
          {% else %}
            mdi:pipe-disconnected
          {% endif %}     

      irrigation_zone2_status:
        friendly_name: "Válvula Sector 2"
        value_template: >
          {% if is_state('switch.irrigation_zone2_valve', 'on') %}
            Aberta
          {% else %}
            Fechada
          {% endif %}     
        icon_template: >
          {% if is_state('switch.irrigation_zone2_valve', 'on') %}
            mdi:pipe
          {% else %}
            mdi:pipe-disconnected
          {% endif %}     

      irrigation_zone3_status:
        friendly_name: "Válvula Sector 3"
        value_template: >
          {% if is_state('switch.irrigation_zone3_valve', 'on') %}
            Aberta
          {% else %}
            Fechada
          {% endif %}     
        icon_template: >
          {% if is_state('switch.irrigation_zone3_valve', 'on') %}
            mdi:pipe
          {% else %}
            mdi:pipe-disconnected
          {% endif %}     

      irrigation_zone4_status:
        friendly_name: "Válvula Sector 4"
        value_template: >
          {% if is_state('switch.irrigation_zone4_valve', 'on') %}
            Aberta
          {% else %}
            Fechada
          {% endif %}     
        icon_template: >
          {% if is_state('switch.irrigation_zone4_valve', 'on') %}
            mdi:pipe
          {% else %}
            mdi:pipe-disconnected
          {% endif %}

      irrigation_last_time_irrigated:
        friendly_name: "Último ciclo de rega acabado"
        value_template: >
          {{ (as_timestamp(states.input_datetime.irrigation_last_time_irrigated.state)) | timestamp_custom("%a %d %h às %H:%M") }}
        icon_template: mdi:update
        
      # Zone Times - templated on history_stats sensors
      irrigation_zone1_time_today:
        friendly_name: "Sector 1 tempo total de rega hoje"
        value_template: >
          {% set duration = states('sensor.zone1_time') %}
          {{ (float(duration) * 60) | round }}
        unit_of_measurement: minutes
        icon_template: mdi:water

      irrigation_zone2_time_today:
        friendly_name: "Sector 2 tempo total de rega hoje"
        value_template: >
          {% set duration = states('sensor.zone2_time') %}
          {{ (float(duration) * 60) | round }}
        unit_of_measurement: minutes
        icon_template: mdi:water
        
      irrigation_zone3_time_today:
        friendly_name: "Sector 3 tempo total de rega hoje"
        value_template: >
          {% set duration = states('sensor.zone3_time') %}
          {{ (float(duration) * 60) | round }}
        unit_of_measurement: minutes
        icon_template: mdi:water
        
      irrigation_zone4_time_today:
        friendly_name: "Sector 4 tempo total de rega hoje"
        value_template: >
          {% set duration = states('sensor.zone4_time') %}
          {{ (float(duration) * 60) | round }}
        unit_of_measurement: minutes
        icon_template: mdi:water
        

  # History sensors
  # Zone Times
  - platform: history_stats
    name: "zone1_time"
    entity_id: switch.irrigation_zone1_valve
    state: 'on'
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

  - platform: history_stats
    name: "zone2_time"
    entity_id: switch.irrigation_zone2_valve
    state: 'on'
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

  - platform: history_stats
    name: "zone3_time"
    entity_id: switch.irrigation_zone3_valve
    state: 'on'
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

  - platform: history_stats
    name: "zone4_time"
    entity_id: switch.irrigation_zone4_valve
    state: 'on'
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

timer:
  irrigation_cycle_zone_duration:
    name: "Tempo restante"   

Lovelace:

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: input_boolean.irrigation_enable
  - type: horizontal-stack
    columns: 7
    cards:
      - type: button
        tap_action:
          action: toggle
        entity: input_boolean.day_sunday
        show_name: false
        show_state: false
      - type: button
        tap_action:
          action: toggle
        entity: input_boolean.day_monday
        show_name: false
        show_state: false
      - type: button
        tap_action:
          action: toggle
        entity: input_boolean.day_tuesday
        show_name: false
      - type: button
        tap_action:
          action: toggle
        entity: input_boolean.day_wednesday
        show_name: false
        show_state: false
      - type: button
        tap_action:
          action: toggle
        entity: input_boolean.day_thursday
        show_name: false
        show_state: false
      - type: button
        tap_action:
          action: toggle
        entity: input_boolean.day_friday
        show_name: false
      - type: button
        tap_action:
          action: toggle
        entity: input_boolean.day_saturday
        show_name: false
        show_state: false
  - type: entities
    entities:
      - entity: input_select.irrigation_cycle1_schedule_time
      - entity: input_select.irrigation_cycle2_schedule_time
      - entity: input_select.irrigation_cycle3_schedule_time
  - type: entities
    entities:
      - input_number.irrigation_zone1_duration
      - input_number.irrigation_zone2_duration
      - input_number.irrigation_zone3_duration
      - input_number.irrigation_zone4_duration
      - entity: input_boolean.irrigation_manual_run
type: vertical-stack
cards:
  - type: entities
    show_header_toggle: false
    title: Informação da Rega
    entities:
      - entity: binary_sensor.irrigation_running
      - entity: binary_sensor.irrigation_needed
      - entity: sensor.irrigation_status
      - entity: timer.irrigation_cycle_zone_duration
      - entity: sensor.irrigation_next_run_time
      - entity: sensor.irrigation_last_time_irrigated
      - entity: sensor.irrigation_zone1_time_today
      - entity: sensor.irrigation_zone2_time_today
      - entity: sensor.irrigation_zone3_time_today
      - entity: sensor.irrigation_zone4_time_today
      - entity: sensor.yesterday_precipitation
  - type: horizontal-stack
    cards:
      - entity: sensor.irrigation_zone1_status
        name: Sector 1
        type: button
        hold_action:
          action: call-service
          service: switch.toggle
          service_data:
            entity_id: switch.irrigation_zone1_valve
      - entity: sensor.irrigation_zone2_status
        name: Sector 2
        type: button
        hold_action:
          action: call-service
          service: switch.toggle
          service_data:
            entity_id: switch.irrigation_zone2_valve
      - entity: sensor.irrigation_zone3_status
        name: Sector 3
        type: button
        hold_action:
          action: call-service
          service: switch.toggle
          service_data:
            entity_id: switch.irrigation_zone3_valve
      - entity: sensor.irrigation_zone4_status
        name: Sector 4
        type: button
        hold_action:
          action: call-service
          service: switch.toggle
          service_data:
            entity_id: switch.irrigation_zone4_valve

1 Curtiu

Boa tarde,

Antes de mais obrigado pela partilha, no entanto esta me a ocorrer um erro no node que envio foto em anexo, podes me tentar ajudar???
Capturar1 Capturar
Obrigado

boas…já fiz as atualizações possiveis no que diz respeito ao server…

mas continua me aparecer como proxima rega agendas dia 1 de janeiro…

alguma ideia aonde eu posso fazer alguma alteração?

Desde a publicação deste tópico que alterei algumas coisas, pouca coisa, mas pode ser que faça diferença, podes testar e ver se funciona. Se funcionar depois altero o tópico

[{"id":"a614550a.bf8e58","type":"server-state-changed","z":"dec677d6.e60418","name":"irrigation enabled","server":"6c015bb.092d8a4","version":"1","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.irrigation_enable","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":740,"y":140,"wires":[["904fc43e.45e828"],[]]},{"id":"9d7f9aa2.dadae8","type":"server-state-changed","z":"dec677d6.e60418","name":"cycle input changed value","server":"6c015bb.092d8a4","version":"1","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_select\\.irrigation_cycle[1-3]_schedule_time","entityidfiltertype":"regex","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":710,"y":200,"wires":[["904fc43e.45e828"]]},{"id":"add8b388.ab4c3","type":"api-current-state","z":"dec677d6.e60418","name":"get cycle1 time state","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"^([0-2][0-9]:[0-5][0-9]|Desativado)$","halt_if_type":"re","halt_if_compare":"is","override_topic":false,"entity_id":"input_select.irrigation_cycle1_schedule_time","state_type":"str","state_location":"irrigation.cycle[0]","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":380,"y":200,"wires":[["9477625c.895c2"],[]]},{"id":"9477625c.895c2","type":"api-current-state","z":"dec677d6.e60418","name":"get cycle2 time state","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"^([0-2][0-9]:[0-5][0-9]|Desativado)$","halt_if_type":"re","halt_if_compare":"is","override_topic":false,"entity_id":"input_select.irrigation_cycle2_schedule_time","state_type":"str","state_location":"irrigation.cycle[1]","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":380,"y":260,"wires":[["1584b7ec.8c2e38"],[]]},{"id":"1584b7ec.8c2e38","type":"api-current-state","z":"dec677d6.e60418","name":"get cycle3 time state","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"^([0-2][0-9]:[0-5][0-9]|Desativado)$","halt_if_type":"re","halt_if_compare":"is","override_topic":false,"entity_id":"input_select.irrigation_cycle3_schedule_time","state_type":"str","state_location":"irrigation.cycle[2]","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":380,"y":320,"wires":[["ff758b0.353fb78"],[]]},{"id":"171bee93.d73281","type":"function","z":"dec677d6.e60418","name":"logic","func":"function addZero(i) {\n  if (i < 10) {\n    i = \"0\" + i;\n  }\n  return i;\n}\n\nvar current_date = new Date();\nvar current_time = addZero(current_date.getHours()) + \":\" + addZero(current_date.getMinutes());\n\nvar result = [];\nvar day;\nvar time_lowest = \"24:00\";\nvar tmp;\nvar i;\n\nif (msg.irrigation.cycle[0] != \"Desativado\" ||\nmsg.irrigation.cycle[1] != \"Desativado\" ||\nmsg.irrigation.cycle[2] != \"Desativado\"){\n    msg.irrigation.cycle.forEach(function(element){\n        \n        if (element != \"Desativado\"){\n            if (current_time <= element){\n                result.push(element);\n                day = \"today\";\n            }\n        }\n    });\n    if (day == 'today'){\n        for (i=result.length-1; i>=0; i--) {\n            tmp = result[i];\n            if (tmp < time_lowest) time_lowest = tmp;\n        }\n    } else {\n        current_date.setDate(current_date.getDate()+1);\n        for (i=msg.irrigation.cycle.length-1; i>=0; i--) {\n            tmp = msg.irrigation.cycle[i];\n            if (tmp < time_lowest) time_lowest = tmp;\n        }\n    }\n    msg.time = time_lowest+\":00\";\n    msg.date = current_date.getFullYear()+\"-\"+(addZero(current_date.getMonth()+1))+\"-\"+addZero(current_date.getDate());\n    reset = {};\n    reset.reset = true;\n    return [null, reset, msg];\n} else {\n    return [msg, null, null];\n}","outputs":3,"noerr":0,"initialize":"","finalize":"","x":550,"y":400,"wires":[["201769dc.101716"],["201769dc.101716"],["8883f670.18c648"]]},{"id":"8883f670.18c648","type":"api-call-service","z":"dec677d6.e60418","name":"set next irrigation date time","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_datetime","service":"set_datetime","entityId":"input_datetime.irrigation_next_run_time","data":"{\"date\":\"{{date}}\",\"time\":\"{{time}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":620,"y":460,"wires":[[]]},{"id":"7dd71b5.44838e4","type":"inject","z":"dec677d6.e60418","name":"every 5 minutes","repeat":"300","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":140,"wires":[["add8b388.ab4c3","3cdb7142.90c7de"]]},{"id":"904fc43e.45e828","type":"link out","z":"dec677d6.e60418","name":"","links":["ba13e501.ddfeb8","e7241119.397ee"],"x":875,"y":160,"wires":[]},{"id":"ba13e501.ddfeb8","type":"link in","z":"dec677d6.e60418","name":"","links":["904fc43e.45e828","77b03464.3d94ec","64ab62da.699cfc"],"x":75,"y":100,"wires":[["7296ccb2.0b1c84"]]},{"id":"7296ccb2.0b1c84","type":"stoptimer","z":"dec677d6.e60418","duration":"50","units":"Millisecond","payloadtype":"num","payloadval":"0","name":"","x":220,"y":100,"wires":[["add8b388.ab4c3"],[]]},{"id":"8335e9cb.790e08","type":"comment","z":"dec677d6.e60418","name":"irrigate zone","info":"","x":130,"y":740,"wires":[]},{"id":"76600e1f.2d2c6","type":"link in","z":"dec677d6.e60418","name":"","links":["6e569955.0cc0e8"],"x":75,"y":1080,"wires":[["2e1030cf.0c9c2"]]},{"id":"cd4a5856.8cdfa8","type":"stoptimer","z":"dec677d6.e60418","duration":"10","units":"Second","payloadtype":"num","payloadval":"0","name":"wait 10 sec","x":750,"y":1080,"wires":[["940539d7.725d28"],[]]},{"id":"1d751c63.c92a14","type":"api-call-service","z":"dec677d6.e60418","name":"update status","server":"6c015bb.092d8a4","version":1,"debugenabled":false,"service_domain":"input_text","service":"set_value","entityId":"input_text.irrigation_status","data":"{\"value\":\"A regar: Sector {{irrigation.zone}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":140,"y":1160,"wires":[["c669f256.e0aae"]]},{"id":"a5a7bd92.e7c16","type":"api-call-service","z":"dec677d6.e60418","name":"turn valve on","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.irrigation_zone{{irrigation.zone}}_valve","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1170,"y":1080,"wires":[["1d751c63.c92a14"]]},{"id":"4e59050d.cc585c","type":"link out","z":"dec677d6.e60418","name":"","links":["d8839773.fb7fc8"],"x":535,"y":1040,"wires":[]},{"id":"5824331e.eea41c","type":"comment","z":"dec677d6.e60418","name":"set next irrigation time","info":"","x":160,"y":40,"wires":[]},{"id":"60d42afc.7c0ba4","type":"api-call-service","z":"dec677d6.e60418","name":"turn valve off","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.irrigation_zone{{irrigation.zone}}_valve","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":610,"y":1160,"wires":[["95b9c55.fa56e38"]]},{"id":"abcac6c1.8a45e8","type":"api-call-service","z":"dec677d6.e60418","name":"update status","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_text","service":"set_value","entityId":"input_text.irrigation_status","data":"{\"value\":\"A alterar sector...\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1000,"y":1160,"wires":[["6cb5ac4a.0fe2a4"]]},{"id":"6cb5ac4a.0fe2a4","type":"link out","z":"dec677d6.e60418","name":"","links":["d8839773.fb7fc8"],"x":1115,"y":1160,"wires":[]},{"id":"f49a686e.73fcb8","type":"switch","z":"dec677d6.e60418","name":"zones left?","property":"irrigation.irrigate","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":900,"wires":[["6e569955.0cc0e8"],["905d84a2.94a398"]]},{"id":"d8839773.fb7fc8","type":"link in","z":"dec677d6.e60418","name":"","links":["4e59050d.cc585c","6cb5ac4a.0fe2a4","c81fb210.a833","db965fec.bcf16","ea17ae82.d498a"],"x":115,"y":800,"wires":[["20ddfcbe.2ae214","b83a0d4e.0dfdb"]]},{"id":"6e569955.0cc0e8","type":"link out","z":"dec677d6.e60418","name":"","links":["76600e1f.2d2c6"],"x":535,"y":860,"wires":[]},{"id":"5a260750.45b338","type":"api-call-service","z":"dec677d6.e60418","name":"update status","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_text","service":"set_value","entityId":"input_text.irrigation_status","data":"{\"value\":\"Parado\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":840,"y":900,"wires":[["f067557.b2587a8"]]},{"id":"77b03464.3d94ec","type":"link out","z":"dec677d6.e60418","name":"","links":["ba13e501.ddfeb8"],"x":655,"y":960,"wires":[]},{"id":"3a8897b5.45b258","type":"function","z":"dec677d6.e60418","name":"set/update vars","func":"if (typeof msg.irrigation == 'undefined'){\n    msg.irrigation = {};\n    msg.irrigation.zone = 1;\n    msg.irrigation.total_zones = 4;\n    msg.irrigation.total_time = 0;\n    msg.irrigation.irrigate = true;\n} else {\n    msg.irrigation.zone++;\n    msg.irrigation.total_time += msg.irrigation.duration;\n    if (msg.irrigation.zone > msg.irrigation.total_zones){\n        msg.irrigation.irrigate = false;\n        msg.irrigation.zone = null;\n    }\n}\nmsg.payload={};\n(msg.irrigation.zone === null) ? delete msg.payload.entity_id : msg.payload.entity_id = 'input_number.irrigation_zone'+msg.irrigation.zone+'_duration' ;\n// msg.payload.entity_id = 'input_number.irrigation_zone'+msg.irrigation.zone+'_duration';\nnode.status({fill:'blue',shape:'dot',text:msg.irrigation.zone});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":200,"y":900,"wires":[["f49a686e.73fcb8"]]},{"id":"5076c19c.1d414","type":"inject","z":"dec677d6.e60418","name":"every minute","repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":600,"wires":[["47b5169e.8d28f8"]]},{"id":"e9539709.1967b8","type":"api-current-state","z":"dec677d6.e60418","name":"get next run time ","server":"6c015bb.092d8a4","version":"1","outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_datetime.irrigation_next_run_time","state_type":"str","state_location":"nextrt","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":150,"y":660,"wires":[["2fff8878.bbad28"]]},{"id":"710fe6f3.2f0a18","type":"moment","z":"dec677d6.e60418","name":"format time","topic":"","input":"now","inputType":"msg","inTz":"ETC/GMT","adjAmount":0,"adjType":"days","adjDir":"add","format":"HH:mm","locale":"en_US","output":"now","outputType":"msg","outTz":"Europe/Lisbon","x":690,"y":600,"wires":[["e9539709.1967b8"]]},{"id":"41af1a31.79a744","type":"switch","z":"dec677d6.e60418","name":"time equals","property":"now","propertyType":"msg","rules":[{"t":"eq","v":"nextrt","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":490,"y":660,"wires":[["1250ea90.811c35"]]},{"id":"528b2296.6e50cc","type":"change","z":"dec677d6.e60418","name":"set to now","rules":[{"t":"set","p":"now","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":600,"wires":[["710fe6f3.2f0a18"]]},{"id":"2fff8878.bbad28","type":"moment","z":"dec677d6.e60418","name":"format time","topic":"","input":"nextrt","inputType":"msg","inTz":"Europe/Lisbon","adjAmount":0,"adjType":"days","adjDir":"add","format":"HH:mm","locale":"en_US","output":"nextrt","outputType":"msg","outTz":"Europe/Lisbon","x":330,"y":660,"wires":[["41af1a31.79a744"]]},{"id":"92874975.fcc868","type":"comment","z":"dec677d6.e60418","name":"cheking if it's time to start irrigate","info":"","x":190,"y":540,"wires":[]},{"id":"47b5169e.8d28f8","type":"api-current-state","z":"dec677d6.e60418","name":"is enabled?","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.irrigation_enable","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":350,"y":600,"wires":[["528b2296.6e50cc"],[]]},{"id":"db965fec.bcf16","type":"link out","z":"dec677d6.e60418","name":"","links":["d8839773.fb7fc8"],"x":935,"y":720,"wires":[]},{"id":"65d1f2e3.61b06c","type":"moment","z":"dec677d6.e60418","name":"set time","topic":"","input":"","inputType":"date","inTz":"ETC/GMT","adjAmount":0,"adjType":"days","adjDir":"add","format":"HH:mm","locale":"en_US","output":"time","outputType":"msg","outTz":"Europe/Lisbon","x":300,"y":980,"wires":[["2d27f951.043076"]]},{"id":"b8570bfb.19b528","type":"moment","z":"dec677d6.e60418","name":"set date","topic":"","input":"","inputType":"date","inTz":"ETC/GMT","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD","locale":"en_US","output":"date","outputType":"msg","outTz":"Europe/Lisbon","x":140,"y":980,"wires":[["65d1f2e3.61b06c"]]},{"id":"2d27f951.043076","type":"api-call-service","z":"dec677d6.e60418","name":"set last time irrigated","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_datetime","service":"set_datetime","entityId":"input_datetime.irrigation_last_time_irrigated","data":"{\"date\":\"{{date}}\",\"time\":\"{{time}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":500,"y":980,"wires":[["77b03464.3d94ec","5c14f4f1.e50e8c","979ca791.527408"]]},{"id":"ec45de34.2edbe","type":"server-state-changed","z":"dec677d6.e60418","name":"turn on manual activation","server":"6c015bb.092d8a4","version":"1","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.irrigation_manual_run","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":170,"y":1300,"wires":[["1c8a8d60.e81173"],["b4ae520f.44537"]]},{"id":"ea17ae82.d498a","type":"link out","z":"dec677d6.e60418","name":"","links":["d8839773.fb7fc8"],"x":795,"y":1240,"wires":[]},{"id":"a8c44304.c026d","type":"comment","z":"dec677d6.e60418","name":"manual activation","info":"","x":140,"y":1240,"wires":[]},{"id":"905d84a2.94a398","type":"api-call-service","z":"dec677d6.e60418","name":"turn off manual run switch","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.irrigation_manual_run","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":610,"y":900,"wires":[["5a260750.45b338"]]},{"id":"b1aa3f30.83265","type":"api-call-service","z":"dec677d6.e60418","name":"notify","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"notify","service":"pushbullet_ricardo","entityId":"","data":"{ \"title\":\"Rega\", \"message\":\"Acabou a rega. Tempo total de rega: {{irrigation.total_time}} min\" }","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":950,"y":1020,"wires":[[]]},{"id":"65734a9a.1da264","type":"api-call-service","z":"dec677d6.e60418","name":"turn valves off","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"group.irrigation_valves","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":620,"y":1380,"wires":[["da4d7c3d.5eb54"]]},{"id":"52097031.a98aa","type":"api-current-state","z":"dec677d6.e60418","name":"fetch duration","server":"c127cb01.a49e28","version":1,"outputs":2,"halt_if":"^([^0]|[^0][0])$","halt_if_type":"re","halt_if_compare":"is","override_topic":false,"entity_id":"","state_type":"num","state_location":"irrigation.duration","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":false,"x":400,"y":1080,"wires":[["ed6830d1.4f29a"],["4e59050d.cc585c"]]},{"id":"ff758b0.353fb78","type":"function","z":"dec677d6.e60418","name":"check if ordered","func":"msg.irrigation.sorted_cycle = msg.irrigation.cycle.slice(0).sort();\n\nif (msg.irrigation.cycle.toString() == msg.irrigation.sorted_cycle.toString()){\n    msg.payload = \"time input sorted\";\n    node.status({fill:'green',shape:'ring',text:msg.payload});\n    return [msg, null];\n} else {\n    msg.payload = \"time input NOT sorted\";\n    node.status({fill:'red',shape:'ring',text:msg.payload});\n    return [null, msg];\n}","outputs":2,"noerr":0,"x":180,"y":400,"wires":[["11dc32a4.0b024d"],["473e2ded.25a7d4"]]},{"id":"11dc32a4.0b024d","type":"api-current-state","z":"dec677d6.e60418","name":"is enabled?","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.irrigation_enable","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":390,"y":400,"wires":[["171bee93.d73281"],[]]},{"id":"5fb837e1.2ff708","type":"api-call-service","z":"dec677d6.e60418","name":"set cycles option","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_select","service":"select_option","entityId":"{{payload.entity_id}}","data":"{\"option\":\"{{payload.value}}\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":320,"y":480,"wires":[[]]},{"id":"473e2ded.25a7d4","type":"function","z":"dec677d6.e60418","name":"split ","func":"function value(n){\n    n = parseInt(n-1);\n    return msg.irrigation.sorted_cycle[n];\n}\nfunction entity(n){\n    return \"input_select.irrigation_cycle\"+n+\"_schedule_time\";\n}\n\nr1 = {\n        \"value\": value(1),\n        \"entity_id\": entity(1)\n    };\nr2 = {\n        \"value\": value(2),\n        \"entity_id\": entity(2)\n    };\nr3 = {\n        \"value\": value(3),\n        \"entity_id\": entity(3)\n    };\nreturn ([{payload: r1}, {payload: r2}, {payload: r3}]);","outputs":3,"noerr":0,"x":150,"y":480,"wires":[["5fb837e1.2ff708"],["5fb837e1.2ff708"],["5fb837e1.2ff708"]]},{"id":"a5bab4f1.9cf828","type":"api-call-service","z":"dec677d6.e60418","name":"notify","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"notify","service":"pushbullet_ricardo","entityId":"","data":"{ \"title\":\"Rega\", \"message\":\"Tempos dos ciclos não definidos\" }","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":750,"y":380,"wires":[[]]},{"id":"201769dc.101716","type":"trigger","z":"dec677d6.e60418","name":"","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"2","extend":false,"units":"hr","reset":"","bytopic":"all","outputs":1,"x":680,"y":320,"wires":[["a5bab4f1.9cf828"]]},{"id":"b4ae520f.44537","type":"api-current-state","z":"dec677d6.e60418","name":"is irrigation on?","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.irrigation_running","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":410,"y":1380,"wires":[["65734a9a.1da264"],[]]},{"id":"1c8a8d60.e81173","type":"api-current-state","z":"dec677d6.e60418","name":"is irrigation off?","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.irrigation_running","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":400,"y":1280,"wires":[["c7465875.b91bd8"],["45192709.b89bf8"]]},{"id":"8d4e43b8.ab4ad","type":"api-call-service","z":"dec677d6.e60418","name":"cancel timer","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"timer","service":"cancel","entityId":"timer.irrigation_cycle_zone_duration","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1010,"y":1380,"wires":[[]]},{"id":"95b9c55.fa56e38","type":"api-current-state","z":"dec677d6.e60418","name":"irrigation canceled?","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.irrigation_cancel","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":790,"y":1160,"wires":[["97464d2f.bbe6f"],["abcac6c1.8a45e8"]]},{"id":"97464d2f.bbe6f","type":"link out","z":"dec677d6.e60418","name":"","links":["272e0aa9.edcfa6"],"x":935,"y":1200,"wires":[]},{"id":"272e0aa9.edcfa6","type":"link in","z":"dec677d6.e60418","name":"","links":["97464d2f.bbe6f","2648fcc.2333904"],"x":215,"y":860,"wires":[["628fba5.23dc044"]]},{"id":"5c14f4f1.e50e8c","type":"api-call-service","z":"dec677d6.e60418","name":"set off irrigation running","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.irrigation_running","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":810,"y":960,"wires":[[]]},{"id":"da4d7c3d.5eb54","type":"api-call-service","z":"dec677d6.e60418","name":"turn on cancel switch","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_boolean","service":"turn_on","entityId":"input_boolean.irrigation_cancel","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":820,"y":1380,"wires":[["8d4e43b8.ab4ad"]]},{"id":"628fba5.23dc044","type":"api-call-service","z":"dec677d6.e60418","name":"turn off cancel switch","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.irrigation_cancel","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":360,"y":860,"wires":[["905d84a2.94a398"]]},{"id":"f067557.b2587a8","type":"api-call-service","z":"dec677d6.e60418","name":"turn valves off","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"group.irrigation_valves","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1040,"y":900,"wires":[["b8570bfb.19b528"]]},{"id":"45192709.b89bf8","type":"api-call-service","z":"dec677d6.e60418","name":"turn off manual switch","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.irrigation_manual_run","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":640,"y":1320,"wires":[[]]},{"id":"940539d7.725d28","type":"api-current-state","z":"dec677d6.e60418","name":"irrigation canceled?","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.irrigation_cancel","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":950,"y":1080,"wires":[["2648fcc.2333904"],["a5a7bd92.e7c16"]]},{"id":"2648fcc.2333904","type":"link out","z":"dec677d6.e60418","name":"","links":["272e0aa9.edcfa6"],"x":1115,"y":1040,"wires":[]},{"id":"2e1030cf.0c9c2","type":"api-call-service","z":"dec677d6.e60418","name":"turn valves off","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"group.irrigation_valves","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":200,"y":1080,"wires":[["52097031.a98aa"]]},{"id":"20ddfcbe.2ae214","type":"api-call-service","z":"dec677d6.e60418","name":"set on irrigation running","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_boolean","service":"turn_on","entityId":"input_boolean.irrigation_running","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":270,"y":800,"wires":[["3a8897b5.45b258"]]},{"id":"ed6830d1.4f29a","type":"change","z":"dec677d6.e60418","name":"del entity_id","rules":[{"t":"delete","p":"payload.entity_id","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":1080,"wires":[["cd4a5856.8cdfa8"]]},{"id":"979ca791.527408","type":"api-call-service","z":"dec677d6.e60418","name":"turn off cancel switch","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.irrigation_cancel","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":780,"y":1020,"wires":[[]]},{"id":"bf88e300.4958","type":"api-call-service","z":"dec677d6.e60418","name":"turn off cancel switch","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.irrigation_cancel","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":620,"y":80,"wires":[[]]},{"id":"3cdb7142.90c7de","type":"api-current-state","z":"dec677d6.e60418","name":"is irrigation off?","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.irrigation_running","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":440,"y":140,"wires":[["bf88e300.4958"],[]]},{"id":"8170972f.7feb48","type":"api-call-service","z":"dec677d6.e60418","name":"turn off cancel switch","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.irrigation_cancel","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":780,"y":720,"wires":[["db965fec.bcf16"]]},{"id":"c7465875.b91bd8","type":"api-call-service","z":"dec677d6.e60418","name":"turn off cancel switch","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.irrigation_cancel","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":640,"y":1240,"wires":[["ea17ae82.d498a"]]},{"id":"32d9d3cb.9d3cbc","type":"server-state-changed","z":"dec677d6.e60418","name":"irrigation cancel ON","server":"6c015bb.092d8a4","version":"1","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.irrigation_cancel","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":150,"y":1480,"wires":[["4330b7af.1eb8f8"],[]]},{"id":"4330b7af.1eb8f8","type":"api-current-state","z":"dec677d6.e60418","name":"is irrigation off?","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.irrigation_running","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":370,"y":1480,"wires":[["98bad5d3.0e57c8"],[]]},{"id":"98bad5d3.0e57c8","type":"api-call-service","z":"dec677d6.e60418","name":"turn off cancel switch","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.irrigation_cancel","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":590,"y":1480,"wires":[[]]},{"id":"8fb664cc.9cde98","type":"comment","z":"dec677d6.e60418","name":"cancel irrigation","info":"","x":140,"y":1420,"wires":[]},{"id":"1250ea90.811c35","type":"api-current-state","z":"dec677d6.e60418","name":"is raining?","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"3","halt_if_type":"num","halt_if_compare":"gte","override_topic":false,"entity_id":"sensor.dark_sky_precip_intensity","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":650,"y":660,"wires":[["b5a1184e.f67938"],["8170972f.7feb48"]]},{"id":"b5a1184e.f67938","type":"api-call-service","z":"dec677d6.e60418","name":"notify","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"notify","service":"pushbullet_ricardo","entityId":"","data":"{ \"title\":\"Rega\", \"message\":\"Está a chover, não vai regar!\" }","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":830,"y":660,"wires":[[]]},{"id":"b83a0d4e.0dfdb","type":"api-current-state","z":"dec677d6.e60418","name":"valves unavailable?","server":"6c015bb.092d8a4","version":"1","outputs":2,"halt_if":"unavailable","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.irrigation_zone1_valve","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":330,"y":740,"wires":[["1370a194.9d351e"],[]]},{"id":"1370a194.9d351e","type":"api-call-service","z":"dec677d6.e60418","name":"notify","server":"6c015bb.092d8a4","version":"1","debugenabled":false,"service_domain":"notify","service":"pushbullet_ricardo","entityId":"","data":"{ \"title\":\"Rega\", \"message\":\"Sem ligação WIFI!\" }","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":510,"y":740,"wires":[[]]},{"id":"a4cfaaab.8f9518","type":"mytimeout","z":"dec677d6.e60418","name":"timer","outtopic":"","outsafe":"","outwarning":"","outunsafe":"off","warning":"0","timer":"0","debug":false,"ndebug":false,"ignoreCase":false,"repeat":false,"again":false,"x":450,"y":1160,"wires":[["60d42afc.7c0ba4"],[]]},{"id":"c669f256.e0aae","type":"function","z":"dec677d6.e60418","name":"func","func":"msg.payload = \"on\";\nmsg.timeout = parseInt(msg.irrigation.duration) * 60;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":310,"y":1160,"wires":[["a4cfaaab.8f9518"]]},{"id":"6c015bb.092d8a4","type":"server","name":"Home Assistant"},{"id":"c127cb01.a49e28","type":"server","name":"Home Assistant","legacy":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

boas…aparece me logo este erro…nao faço ideia que seja isto:

Flows stopped due to missing node types.

    mytimeout

isto no node red

Boa noite, tens de instalar a contrib.
node-red-contrib-mytimeout

1 Curtiu

continuo com o mesmo problema… proxima rega em janeiro...

so funciona manual

de certeza que tens alguma coisa mal. Porque a mim funciona tudo direito.
Na parte de cima do flow, é onde é feita a lógica para determinar a próxima rega, vê se as tuas entidades são iguais à do flow, principalmente os input_select

para mim. parece me que está tudo bem…será nos servers?

poderá ser, não tens erros?


Copyright © 2017-2021. Todos os direitos reservados
CPHA.pt - info@cpha.pt


FAQ | Termos de Serviço/Regras | Política de Privacidade