Advertisement
-Miura-

Zijdelinck's Aquafarm script

Sep 22nd, 2024
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 4.31 KB | None | 0 0
  1. alias: System Check Status Pump (Other idea)
  2. sequence:
  3.   - variables:
  4.       pr_entiteit: |
  5.        {{ "pr"+ entiteit }}
  6.       pa_entiteit: |
  7.        {{ "pa"+ entiteit }}
  8.     alias: variables
  9.   - variables:
  10.       return_info: |
  11.        {% if (return_running    == "{'value': 'on'}"      ) and
  12.               (return_status     == "{'value': Active}"  ) and    
  13.               (return_activated  == "{'value': 'on'}"      ) %}
  14.            {% set condition = 'OK' %}
  15.         {% elif (return_running  ==  "{'value': 'off'}"    ) and
  16.               (return_status     ==  "{'value': 'Active'}" ) and
  17.               (return_activated  ==  "{'value': 'off'}"    ) %}
  18.            {% set condition = 'OK' %}  
  19.         {% elif (return_running  ==  "{'value': 'off'}"    ) and
  20.               (return_status     ==  "{'value': 'Non Active'}" ) %}
  21.            {% set condition = 'OK' %}  
  22.         {% else %}
  23.            {% set condition = 'KO' %}        
  24.         {% endif %}
  25.         {{ {'value': condition } }}    
  26.     alias: variables
  27.     enabled: false
  28.   - action: script.status_of_entity_v0_1
  29.     metadata: {}
  30.     data:
  31.       id: "{{ pr_entiteit }}"
  32.     response_variable: return_running
  33.   - variables:
  34.       return_running: "{{ return_run.value }}"
  35.     enabled: false
  36.   - action: notify.notify
  37.     metadata: {}
  38.     data:
  39.       title: Running
  40.       message: Code "{{ return_running }}"
  41.     enabled: false
  42.   - action: script.status_of_entity_v0_1
  43.     metadata: {}
  44.     data:
  45.       id: "{{ entiteit }}"
  46.     response_variable: return_status
  47.   - variables:
  48.       return_status: "{{ return_stat.value }}"
  49.     enabled: false
  50.   - action: notify.notify
  51.     metadata: {}
  52.     data:
  53.       title: Status
  54.       message: Code "{{ return_status }}"
  55.     enabled: false
  56.   - action: script.status_of_entity_v0_1
  57.     metadata: {}
  58.     data:
  59.       id: "{{ pa_entiteit }}"
  60.     response_variable: return_activated
  61.   - variables:
  62.       return_activated: "{{ return_activat.value }}"
  63.     enabled: false
  64.   - action: notify.notify
  65.     metadata: {}
  66.     data:
  67.       title: Activated
  68.       message: Code "{{ return_activated }}"
  69.     enabled: false
  70.   - action: notify.notify
  71.     metadata: {}
  72.     data:
  73.       title: Return_info
  74.       message: Code "{{ return_info }}"
  75.     enabled: false
  76.   - variables:
  77.       return_info: |
  78.        {% if (return_running    == {'value': 'on'} ) and
  79.               (return_status     == {'value': 'on'}  ) and    
  80.               (return_activated  == {'value': 'Active'}     ) %}
  81.            {% set condition = 'OK' %}
  82.         {% elif (return_running  ==  {'value': 'off'}   ) and
  83.               (return_status     ==  {'value': 'off'} ) and
  84.               (return_activated  ==  {'value': 'Active'}   ) %}
  85.            {% set condition = 'OK' %}  
  86.         {% elif (return_running  ==  {'value': 'off'}   ) and
  87.               (return_status     ==  {'value': 'Non Active'} ) %}
  88.            {% set condition = 'OK' %}  
  89.         {% else %}
  90.            {% set condition = 'KO' %}        
  91.         {% endif %}
  92.         {{ {'value': condition } }}    
  93.     alias: variables
  94.   - variables:
  95.       return_info: |
  96.        {% if (return_running.value    == 'on' ) and
  97.               (return_status.value     == 'on'  ) and    
  98.               (return_activated.value  == 'Active'     ) %}
  99.            {% set condition = 'OK' %}
  100.         {% elif (return_running.value  == 'off'  ) and
  101.               (return_status.value     == 'off' ) and
  102.               (return_activated.value  == 'Active'   ) %}
  103.            {% set condition = 'OK' %}
  104.         {% elif (return_running.value  == 'off' ) and
  105.               (return_status.value     == 'Non Active' ) %}
  106.            {% set condition = 'OK' %}  
  107.         {% else %}
  108.            {% set condition = 'KO' %}        
  109.         {% endif %}
  110.         {{ {'value': condition } }}    
  111.     alias: variables
  112.   - action: system_log.write
  113.     metadata: {}
  114.     data:
  115.       level: debug
  116.       message: |-
  117.         return_running: {{ return_running }}
  118.         return_status: {{ return_status }}
  119.         return_activated: {{ return_activated }}
  120.   - stop: end
  121.     response_variable: return_info
  122. description: ""
  123. fields:
  124.   entiteit:
  125.     selector:
  126.       text: {}
  127.     name: Entiteit
  128.     required: true
  129.     description: Id of entity state to retrieve
  130.     default: tank_4
  131. mode: parallel
  132. max: 10
  133. icon: mdi:pump
  134.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement