minor additions in V1.2
This commit is contained in:
@@ -1,24 +1,36 @@
|
||||
# ---- HTTP health probe ----
|
||||
binary_sensor:
|
||||
- platform: rest
|
||||
name: Node-RED Panda Up
|
||||
name: Node-RED Panda Up (HTTP)
|
||||
resource: http://192.168.3.200:1880/healthz
|
||||
method: GET
|
||||
device_class: connectivity
|
||||
value_template: "{{ value_json.status == 'ok' }}"
|
||||
timeout: 3
|
||||
scan_interval: 30
|
||||
|
||||
# ---- MQTT Will/Birth probe ----
|
||||
mqtt:
|
||||
binary_sensor:
|
||||
- name: "Node-RED Panda Up"
|
||||
unique_id: "nodered_myhost_up"
|
||||
- name: "Node-RED Panda Up (MQTT)"
|
||||
unique_id: "nodered_panda_up_mqtt"
|
||||
state_topic: "nodered/panda/status"
|
||||
payload_on: "online"
|
||||
payload_off: "offline"
|
||||
device_class: connectivity
|
||||
qos: 1
|
||||
# Optional: avoid stale 'online' if no updates arrive
|
||||
expire_after: 300
|
||||
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://127.0.0.1:1880/healthz"]
|
||||
interval: 30s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
# ---- Combine them (true if either is up) ----
|
||||
template:
|
||||
- binary_sensor:
|
||||
- name: "Node-RED Panda Up"
|
||||
unique_id: "nodered_panda_up_combined"
|
||||
device_class: connectivity
|
||||
state: >
|
||||
{{ is_state('binary_sensor.node_red_panda_up_http','on')
|
||||
or is_state('binary_sensor.node_red_panda_up_mqtt','on') }}
|
||||
availability: >
|
||||
{{ states('binary_sensor.node_red_panda_up_http') not in ['unknown','unavailable']
|
||||
or states('binary_sensor.node_red_panda_up_mqtt') not in ['unknown','unavailable'] }}
|
||||
|
Reference in New Issue
Block a user