Sistema completo de Rega em Node-Red e lovelace


(Ricardo Reis) #1

Comecei a utilizar node-red à um mês, desde aí que senti liberdade total para reformular todo o sistema que tinha em yaml para node-red, o sistema em yaml estava muito desenvolvido mas não acabado.




Funcionalidades:

  • Ordena automaticamente os tempos dos ciclos (input_select)
  • Até 3 ciclos por dia (pode ser alterado para os quantos quiserem)
  • Possibilidade de definir tempos diferentes por sector
  • Possibilidade de iniciar a rega manualmente
  • Monitorização dos tempos de rega ao final do dia, por válvula
  • Registo da última vez que foi regada
  • Aviso de notificações de: Se os tempos dos ciclos estiverem mal colocados e/ou a rega acabou
  • Entre cada mudança de sector o sistema faz uma pausa para deixar as válvulas fecharam completamente.

Códigos:

lovelace:

- badges: []
  icon: 'mdi:water-pump'
  title: Rega
  cards:
    - cards:
        - cards:
            - entity: sensor.irrigation_zone1_status
              name: Sector 1
              size: 30%
              type: 'custom:button-card'
            - entity: sensor.irrigation_zone2_status
              name: Sector 2
              size: 30%
              type: 'custom:button-card'
            - entity: sensor.irrigation_zone3_status
              name: Sector 3
              size: 30%
              type: 'custom:button-card'
            - entity: sensor.irrigation_zone4_status
              name: Sector 4
              size: 30%
              type: 'custom:button-card'
          type: horizontal-stack
        - entities:
            - entity: input_boolean.irrigation_enable
            - entity: input_select.irrigation_cycle1_schedule_time
            - entity: input_select.irrigation_cycle2_schedule_time
            - entity: input_select.irrigation_cycle3_schedule_time
            - head:
                label: Configurações
                type: section
              items:
                - input_boolean.irrigation_manual_run
                - label: Tempos de Rega (min)
                  type: section
                - input_number.irrigation_zone1_duration
                - input_number.irrigation_zone2_duration
                - input_number.irrigation_zone3_duration
                - input_number.irrigation_zone4_duration
              type: 'custom:fold-entity-row'
          show_header_toggle: false
          title: Rega
          type: entities
      type: 'custom:vertical-stack-in-card'
    - entities:
        - entity: binary_sensor.irrigation_running
        - 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
      show_header_toggle: false
      title: Informação da Rega
      type: entities
    - entities:
        - entity: sensor.irrigation_zone1_status
        - entity: sensor.irrigation_zone2_status
        - entity: sensor.irrigation_zone3_status
        - entity: sensor.irrigation_zone4_status
      show_header_toggle: false
      title: Estado das válvulas
      type: entities

yaml

#===========
#=== Groups
#===========
group:
  irrigation_valves:
    control: hidden
    name: 'Válvulas'
    entities:
      - switch.irrigation_zone1_valve
      - switch.irrigation_zone2_valve
      - switch.irrigation_zone3_valve
      - switch.irrigation_zone4_valve

#================
#=== Input_Texts
#================
input_text:
  irrigation_status:
    name: 'Estado atual da Rega'

#==================
#=== Input_Selects
#==================
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_Numbers
#==================
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_Booleans
#===================
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"


#====================
#=== Input_Datetimes
#====================
input_datetime:
  irrigation_next_run_time:
    has_date: true
    has_time: true

  irrigation_last_time_irrigated:
    has_date: true
    has_time: true

#===========
#=== timers
#===========
timer:
  irrigation_cycle_zone_duration:
    name: "Tempo restante"
    

#============
#=== Sensors
#============
sensor:
  - 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') %}
            
            {{ 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() }}'


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 %}

#=============
#=== Switches
#=============
switch:

  # Tasmota Commands
  # interlock 1
  # poweronstate<x> 0
  # pulsetime<x> 700
  
  # Zone 1
  - platform: mqtt
    name: "irrigation_zone1_valve"
    command_topic: "rega_frente/cmnd/POWER1"
    payload_on: "ON"
    payload_off: "OFF"
    availability_topic: "rega_frente/tele/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    state_topic: "rega_frente/stat/POWER1"

  # Zone 2
  - platform: mqtt
    name: "irrigation_zone2_valve"
    command_topic: "rega_frente/cmnd/POWER2"
    payload_on: "ON"
    payload_off: "OFF"
    availability_topic: "rega_frente/tele/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    state_topic: "rega_frente/stat/POWER2"

  # Zone 3
  - platform: mqtt
    name: "irrigation_zone3_valve"
    command_topic: "rega_frente/cmnd/POWER3"
    payload_on: "ON"
    payload_off: "OFF"
    availability_topic: "rega_frente/tele/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    state_topic: "rega_frente/stat/POWER3"

  # Zone 4
  - platform: mqtt
    name: "irrigation_zone4_valve"
    command_topic: "rega_frente/cmnd/POWER4"
    payload_on: "ON"
    payload_off: "OFF"
    availability_topic: "rega_frente/tele/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    state_topic: "rega_frente/stat/POWER4"

Rega Automatica com Sonoff 4ch
(Ricardo Reis) #2

Node-Red

[{"id":"a614550a.bf8e58","type":"server-state-changed","z":"dec677d6.e60418","name":"irrigation enabled","server":"6c015bb.092d8a4","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","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","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","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","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","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","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","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,"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","service_domain":"input_datetime","service":"set_datetime","data":"{\"entity_id\":\"input_datetime.irrigation_next_run_time\",\"date\":\"{{date}}\",\"time\":\"{{time}}\"}","mergecontext":"","output_location":"","output_location_type":"none","x":620,"y":460,"wires":[[]]},{"id":"7dd71b5.44838e4","type":"inject","z":"dec677d6.e60418","name":"every 5 minutes","topic":"","payload":"","payloadType":"date","repeat":"300","crontab":"","once":false,"onceDelay":0.1,"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"],"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","service_domain":"input_text","service":"set_value","data":"{\"entity_id\":\"input_text.irrigation_status\",\"value\":\"A regar: Sector {{irrigation.zone}}\"}","mergecontext":"","output_location":"","output_location_type":"none","x":140,"y":1160,"wires":[["cf2b51dd.1df8c"]]},{"id":"a5a7bd92.e7c16","type":"api-call-service","z":"dec677d6.e60418","name":"turn valve on","server":"6c015bb.092d8a4","service_domain":"switch","service":"turn_on","data":"{\"entity_id\":\"switch.irrigation_zone{{irrigation.zone}}_valve\"}","mergecontext":"","output_location":"","output_location_type":"none","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","service_domain":"switch","service":"turn_off","data":"{\"entity_id\":\"switch.irrigation_zone{{irrigation.zone}}_valve\"}","mergecontext":"","output_location":"","output_location_type":"none","x":610,"y":1160,"wires":[["95b9c55.fa56e38"]]},{"id":"abcac6c1.8a45e8","type":"api-call-service","z":"dec677d6.e60418","name":"update status","server":"6c015bb.092d8a4","service_domain":"input_text","service":"set_value","data":"{\"entity_id\":\"input_text.irrigation_status\",\"value\":\"A alterar sector...\"}","mergecontext":"","output_location":"","output_location_type":"none","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"]]},{"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","service_domain":"input_text","service":"set_value","data":"{\"entity_id\":\"input_text.irrigation_status\",\"value\":\"Parado\"}","mergecontext":"","output_location":"","output_location_type":"none","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,"x":200,"y":900,"wires":[["f49a686e.73fcb8"]]},{"id":"5076c19c.1d414","type":"inject","z":"dec677d6.e60418","name":"every minute","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":false,"onceDelay":0.1,"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","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","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":710,"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":530,"y":660,"wires":[["8170972f.7feb48"]]},{"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":350,"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","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","x":350,"y":600,"wires":[[],["528b2296.6e50cc"]]},{"id":"db965fec.bcf16","type":"link out","z":"dec677d6.e60418","name":"","links":["d8839773.fb7fc8"],"x":855,"y":660,"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","service_domain":"input_datetime","service":"set_datetime","data":"{\"entity_id\":\"input_datetime.irrigation_last_time_irrigated\",\"date\":\"{{date}}\",\"time\":\"{{time}}\"}","mergecontext":"","output_location":"","output_location_type":"none","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","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":[["b4ae520f.44537"],["1c8a8d60.e81173"]]},{"id":"ea17ae82.d498a","type":"link out","z":"dec677d6.e60418","name":"","links":["d8839773.fb7fc8"],"x":795,"y":1380,"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","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.irrigation_manual_run\"}","mergecontext":"","output_location":"","output_location_type":"none","x":610,"y":900,"wires":[["5a260750.45b338"]]},{"id":"b1aa3f30.83265","type":"api-call-service","z":"dec677d6.e60418","name":"notify","server":"6c015bb.092d8a4","service_domain":"notify","service":"pushbullet_ricardo","data":"{ \"title\":\"Rega\", \"message\":\"Acabou a rega. Tempo total de rega: {{irrigation.total_time}} min\" }","mergecontext":"","output_location":"","output_location_type":"none","x":950,"y":1020,"wires":[[]]},{"id":"65734a9a.1da264","type":"api-call-service","z":"dec677d6.e60418","name":"turn valves off","server":"6c015bb.092d8a4","service_domain":"switch","service":"turn_off","data":"{\"entity_id\":\"group.irrigation_valves\"}","mergecontext":"","output_location":"","output_location_type":"none","x":620,"y":1260,"wires":[["da4d7c3d.5eb54"]]},{"id":"52097031.a98aa","type":"api-current-state","z":"dec677d6.e60418","name":"fetch duration","server":"c127cb01.a49e28","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","x":400,"y":1080,"wires":[["4e59050d.cc585c"],["ed6830d1.4f29a"]]},{"id":"cf2b51dd.1df8c","type":"api-call-service","z":"dec677d6.e60418","name":"start timer","server":"6c015bb.092d8a4","service_domain":"timer","service":"start","data":"{\"entity_id\":\"timer.irrigation_cycle_zone_duration\",\"duration\":\"00:{{irrigation.duration}}:00\"}","mergecontext":"","output_location":"","output_location_type":"none","x":300,"y":1160,"wires":[["8c6313f9.a7759"]]},{"id":"8c6313f9.a7759","type":"ha-wait-until","z":"dec677d6.e60418","name":"","server":"6c015bb.092d8a4","outputs":2,"entityId":"timer.irrigation_cycle_zone_duration","property":"state","comparator":"is","value":"idle","valueType":"str","timeout":"11","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"x":440,"y":1160,"wires":[["60d42afc.7c0ba4"],["60d42afc.7c0ba4"]]},{"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","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","x":390,"y":400,"wires":[[],["171bee93.d73281"]]},{"id":"5fb837e1.2ff708","type":"api-call-service","z":"dec677d6.e60418","name":"set cycles option","server":"6c015bb.092d8a4","service_domain":"input_select","service":"select_option","data":"{\"entity_id\":\"{{payload.entity_id}}\",\"option\":\"{{payload.value}}\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","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","service_domain":"notify","service":"pushbullet_ricardo","data":"{ \"title\":\"Rega\", \"message\":\"Tempos dos ciclos não definidos\" }","mergecontext":"","output_location":"payload","output_location_type":"msg","x":750,"y":380,"wires":[[]]},{"id":"201769dc.101716","type":"trigger","z":"dec677d6.e60418","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"2","extend":false,"units":"hr","reset":"","bytopic":"all","name":"","x":680,"y":320,"wires":[["a5bab4f1.9cf828"]]},{"id":"b4ae520f.44537","type":"api-current-state","z":"dec677d6.e60418","name":"is irrigation on?","server":"6c015bb.092d8a4","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","x":410,"y":1260,"wires":[[],["65734a9a.1da264"]]},{"id":"1c8a8d60.e81173","type":"api-current-state","z":"dec677d6.e60418","name":"is irrigation off?","server":"6c015bb.092d8a4","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","x":400,"y":1360,"wires":[["45192709.b89bf8"],["c7465875.b91bd8"]]},{"id":"8d4e43b8.ab4ad","type":"api-call-service","z":"dec677d6.e60418","name":"cancel timer","server":"6c015bb.092d8a4","service_domain":"timer","service":"cancel","data":"{\"entity_id\":\"timer.irrigation_cycle_zone_duration\"}","mergecontext":"","output_location":"","output_location_type":"none","x":1010,"y":1260,"wires":[[]]},{"id":"95b9c55.fa56e38","type":"api-current-state","z":"dec677d6.e60418","name":"irrigation canceled?","server":"6c015bb.092d8a4","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","x":790,"y":1160,"wires":[["abcac6c1.8a45e8"],["97464d2f.bbe6f"]]},{"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","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.irrigation_running\"}","mergecontext":"","output_location":"","output_location_type":"none","x":810,"y":960,"wires":[[]]},{"id":"da4d7c3d.5eb54","type":"api-call-service","z":"dec677d6.e60418","name":"turn on cancel switch","server":"6c015bb.092d8a4","service_domain":"input_boolean","service":"turn_on","data":"{\"entity_id\":\"input_boolean.irrigation_cancel\"}","mergecontext":"","output_location":"","output_location_type":"none","x":820,"y":1260,"wires":[["8d4e43b8.ab4ad"]]},{"id":"628fba5.23dc044","type":"api-call-service","z":"dec677d6.e60418","name":"turn off cancel switch","server":"6c015bb.092d8a4","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.irrigation_cancel\"}","mergecontext":"","output_location":"","output_location_type":"none","x":360,"y":860,"wires":[["905d84a2.94a398"]]},{"id":"f067557.b2587a8","type":"api-call-service","z":"dec677d6.e60418","name":"turn valves off","server":"6c015bb.092d8a4","service_domain":"switch","service":"turn_off","data":"{\"entity_id\":\"group.irrigation_valves\"}","mergecontext":"","output_location":"","output_location_type":"none","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","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.irrigation_manual_run\"}","mergecontext":"","output_location":"","output_location_type":"none","x":640,"y":1320,"wires":[[]]},{"id":"940539d7.725d28","type":"api-current-state","z":"dec677d6.e60418","name":"irrigation canceled?","server":"6c015bb.092d8a4","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","x":950,"y":1080,"wires":[["a5a7bd92.e7c16"],["2648fcc.2333904"]]},{"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","service_domain":"switch","service":"turn_off","data":"{\"entity_id\":\"group.irrigation_valves\"}","mergecontext":"","output_location":"","output_location_type":"none","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","service_domain":"input_boolean","service":"turn_on","data":"{\"entity_id\":\"input_boolean.irrigation_running\"}","mergecontext":"","output_location":"","output_location_type":"none","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","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.irrigation_cancel\"}","mergecontext":"","output_location":"","output_location_type":"none","x":780,"y":1020,"wires":[["b1aa3f30.83265"]]},{"id":"bf88e300.4958","type":"api-call-service","z":"dec677d6.e60418","name":"turn off cancel switch","server":"6c015bb.092d8a4","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.irrigation_cancel\"}","mergecontext":"","output_location":"","output_location_type":"none","x":620,"y":80,"wires":[[]]},{"id":"3cdb7142.90c7de","type":"api-current-state","z":"dec677d6.e60418","name":"is irrigation off?","server":"6c015bb.092d8a4","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","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","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.irrigation_cancel\"}","mergecontext":"","output_location":"","output_location_type":"none","x":720,"y":660,"wires":[["db965fec.bcf16"]]},{"id":"c7465875.b91bd8","type":"api-call-service","z":"dec677d6.e60418","name":"turn off cancel switch","server":"6c015bb.092d8a4","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.irrigation_cancel\"}","mergecontext":"","output_location":"","output_location_type":"none","x":640,"y":1380,"wires":[["ea17ae82.d498a"]]},{"id":"32d9d3cb.9d3cbc","type":"server-state-changed","z":"dec677d6.e60418","name":"irrigation cancel ON","server":"6c015bb.092d8a4","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","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","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","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.irrigation_cancel\"}","mergecontext":"","output_location":"","output_location_type":"none","x":590,"y":1480,"wires":[[]]},{"id":"8fb664cc.9cde98","type":"comment","z":"dec677d6.e60418","name":"cancel irrigation","info":"","x":140,"y":1420,"wires":[]},{"id":"6c015bb.092d8a4","type":"server","z":"","name":"Home Assistant"},{"id":"c127cb01.a49e28","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

(Sebastião Lopes) #3

Parabéns. Obrigado por teres partilhado. Estou também com 3 sectores de rega mas muito mais simples do que o que tu fizeste. Vou aproveitar muito do teu trabalho. O meu flow apenas esta a ligar os sectores a uma determinada hora e desligar passados x minutos. Ainda hoje, que choveu cá por Braga, tive de ir ao node red e apagar as ligações que unem os nós para evitar as regas.
Seguindo o teu código, uma das principais dificuldades que estou a prever, vai ser a parte que diz respeito ao lovelace. Logo verei. Mãos ao trabalho.
Cumprimentos
Sebastião


(Bruno Melo) #4

@sslopes fica atento pois pouco falta para partilhar o meu projecto e eu só uso lovelace. Ainda poderá demorar um pouco mas prefiro que quando publicar o meu projecto esteja a passar perto da perfeição… Hihihihihihi

Aqui fica um cheirinho… Hihihihihihi


(Ricardo Reis) #5

Obrigado!
Alguma dúvida apita.

Uma coisa que ainda queria fazer, são as condições de rega em relação à meteorologia. Se está a chover ignora o ciclo. E se estiver com ventos acima de um certo valor, adia ou ignora a rega.


(Sebastião Lopes) #6

@maxcalavera Enquanto espero vou treinando e melhorando


(Bruno Melo) #7

Sim. Fazes bem. O meu ainda vai demorar um pouco até ficar pronto.


(Sebastião Lopes) #8

@ricreis394 Fico com a ideia que os teus sectores iniciam todos à mesma hora. Certo?. Se assim é vou ter que procurar maneira de separar o funcionamento dos meus pois se o não faço não tenho pressão suficiente. Neste momento tenho os sectores a funcionar com um desfasamento de 10 minutos.


(Ricardo Reis) #9

@sslopes quando a rega é iniciada, regam todos os sectores mas um de cada vez. E tem 10 segundos de espera entre sector. Mas podes alterar de 10 segundos para 10 minutos. Existe um node que faz isso


(Sebastião Lopes) #10

@ricreis394 É mesmo isso que pretendo. Não vi ainda bem os nodes. Obrigado


(Sebastião Lopes) #11

@ricreis394 Boa noite. No código respeitante ao lovelace, dá-me o seguinte erro:

Can't find card-tools. See https://github.com/thomasloven/lovelace-card-tools
{
  "head": {
    "label": "Configurações",
    "type": "section"
  },
  "items": [
    "input_boolean.irrigation_manual_run",
    {
      "label": "Tempos de Rega (min)",
      "type": "section"
    },
    "input_number.irrigation_zone1_duration",
    "input_number.irrigation_zone2_duration",
    "input_number.irrigation_zone3_duration",
    "input_number.irrigation_zone4_duration"
  ],
  "type": "custom:fold-entity-row"
}

Fui verificar e em resources tenho

  - type: js
    url: /customcards/github/thomasloven/card-tools.js?track=true

e na pasta config\www\cards\card-tools tenho o ficheiro card-tools.js.
Onde estará o erro?

Cumprimentos
Sebastião


(Bruno Melo) #12

Tenho o mesmo problema, por isso é que ainda não partilhei o meu projecto.


(Ricardo Reis) #13

Experimenta assim:

  - type: js
    url: /local/cards/card-tools/card-tools.js?track=true

Assim vai à tua pasta buscar o ficheiro


(Sebastião Lopes) #14

Não deu. Dá o mesmo erro.


(Ricardo Reis) #15

Não sei qual será o problema, mas seguindo o tutorial que o autor do plugin fez, deveria dar sem problemas.

De qualquer das formas, não é obrigatório usar plugins que eu usei para o lovelace, podes optar por colocar sem plugins extra, pelo menos para meteres isso a funcionar, depois tratas do interface.