Skip to content

Instantly share code, notes, and snippets.

@firstof9
Last active December 17, 2020 22:26
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save firstof9/7baaa51c047b43e43b87f5149187a528 to your computer and use it in GitHub Desktop.
Save firstof9/7baaa51c047b43e43b87f5149187a528 to your computer and use it in GitHub Desktop.
## Created by @steve28
## Binary Sensor toggles once the network is ready (zwave.network_ready event)
binary_sensor:
- platform: mqtt
name: ozw_network_status
state_topic: OpenZWave/1/status/
value_template: >
{{ "ON" if value_json.Status in ["driverAwakeNodesQueried", "driverAllNodesQueriedSomeDead", "driverAllNodesQueried"] else "OFF" }}
json_attributes_topic: OpenZWave/1/status/
device_class: "connectivity"
sensor:
- platform: mqtt
name: ozw_network_notification
state_topic: OpenZWave/1/event/notification/
value_template: "{{ value_json.Event }}"
json_attributes_topic: OpenZWave/1/event/notification/
## Script for sending OZW commands
script:
ozw_node_command:
alias: Send OZW Node Command
icon: mdi:refresh
mode: single
sequence:
- data_template:
payload:
'{{ "{" + "\"node\":" + states(''input_number.ozw_node_id'')|int|string
+ "}" }}'
topic: OpenZWave/1/command/{{zw_command}}/
service: mqtt.publish
## Rest Comamnd for populating the input_select
rest_command:
update_zwave_node_list:
url: "http://192.168.1.197:8123/api/services/input_select/set_options"
method: POST
headers:
content-type: application/json
Authorization: Bearer [REDACTED]
payload: >
{
"entity_id": "input_select.zwave_entities",
"options": [
{%- for item in (states | selectattr('attributes.node_id') | unique(attribute='attributes.node_id') | list ) %}
"{{item.attributes.friendly_name + ' ('+item.attributes.node_id|string+')' }}"{% if not loop.last %}, {% endif %}
{%- endfor %}
]
}
## Input select for zwave entities
input_select:
zwave_entities:
name: Zwave Entities
options:
- Placeholder
input_number:
ozw_node_id:
name: Node ID
min: 1
max: 254
mode: box
## LoveLace Card
# - badges: []
# cards:
# - cards:
# - content: '## Z-Wave Operations'
# type: markdown
# - entities:
# - entity: input_select.zwave_entities
# - entity: input_number.ozw_node_id
# show_title: true
# title: Node Selection
# type: entities
# - cards:
# - cards:
# - entity: script.ozw_node_command
# name: Requst Dynamic
# show_state: false
# tap_action:
# action: call-service
# service: script.turn_on
# service_data:
# entity_id: script.ozw_node_command
# variables:
# zw_command: requestnodedynamic
# type: button
# - entity: script.ozw_node_command
# name: Refresh Node Info
# show_state: false
# tap_action:
# action: call-service
# service: script.turn_on
# service_data:
# entity_id: script.ozw_node_command
# variables:
# zw_command: refreshnodeinfo
# type: button
# - entity: script.ozw_node_command
# hold_action:
# action: none
# name: Send Node Info
# show_state: false
# tap_action:
# action: call-service
# service: script.turn_on
# service_data:
# entity_id: script.ozw_node_command
# variables:
# zw_command: sendnodeinformation
# type: button
# - entity: script.ozw_node_command
# name: Has Node Failed
# show_state: false
# tap_action:
# action: call-service
# service: script.turn_on
# service_data:
# entity_id: script.ozw_node_command
# variables:
# zw_command: hasnodefailed
# type: button
# type: horizontal-stack
# - entity: script.ozw_node_command
# name: Remove Failed Node
# show_state: false
# tap_action:
# action: call-service
# service: script.turn_on
# service_data:
# entity_id: script.ozw_node_command
# variables:
# zw_command: removefailednode
# icon: 'mdi:delete'
# type: button
# - cards:
# - entity: input_number.ozw_node_id
# name: Refresh Node List
# show_icon: false
# show_name: true
# tap_action:
# action: call-service
# service: rest_command.update_zwave_node_list
# type: button
# type: horizontal-stack
# type: vertical-stack
# - content: |-
# ### Z-Wave Network Notifications
# ```
# Node: {{ state_attr('sensor.ozw_network_notification', 'Node') }}
# Timestamp: {{ state_attr('sensor.ozw_network_notification', 'TimeStamp')|timestamp_local}}
# Event: {{ state_attr('sensor.ozw_network_notification', 'Event') }}
# ```
# type: markdown
# type: vertical-stack
# - content: >-
# ## Z-Wave Network Status
# ```
# Status: {{ state_attr('binary_sensor.ozw_network_status', 'Status') }}
# {{ state_attr('binary_sensor.ozw_network_status', 'TimeStamp')|timestamp_local}}
# OpenZWave: {{ state_attr('binary_sensor.ozw_network_status', 'OpenZWave_Version') }}
# QT-OpenZWave: {{ state_attr('binary_sensor.ozw_network_status',
# 'QTOpenZWave_Version') }}
# OZWDaemon: {{ state_attr('binary_sensor.ozw_network_status', 'OZWDaemon_Version') }}
# QT: {{ state_attr('binary_sensor.ozw_network_status', 'QT_Version') }}
# HomeID: {{ state_attr('binary_sensor.ozw_network_status', 'homeID') }}
# ```
# type: markdown
# icon: 'mdi:z-wave'
# id: z-wave
# title: z-wave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment