Skip to content

Instantly share code, notes, and snippets.

@haade-administrator
Created August 10, 2021 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haade-administrator/fe1eb36d0f7ec3f6abf742e355edc53d to your computer and use it in GitHub Desktop.
Save haade-administrator/fe1eb36d0f7ec3f6abf742e355edc53d to your computer and use it in GitHub Desktop.
config /packages zigbee2mqtt
# Input select for Zigbee2mqtt debug level
input_select:
zigbee2mqtt_log_level:
name: Niveau de log
options:
- debug
- info
- warn
- error
initial: info
icon: mdi:format-list-bulleted
# Input text to input Zigbee2mqtt friendly_name for scripts
input_text:
zigbee2mqtt_old_name:
name: Ancien nom
initial: ""
zigbee2mqtt_new_name:
name: Nouveau nom
initial: ""
zigbee2mqtt_remove:
name: Device à retirer
initial: ""
# Input boolean to set the force remove flag for devices
input_boolean:
zigbee2mqtt_force_remove:
name: Zigbee2MQTT Force Remove
initial: false
icon: mdi:alert-remove
# Scripts for renaming & removing devices
script:
zigbee2mqtt_rename:
alias: Renommer le module
sequence:
service: mqtt.publish
data_template:
topic: zigbee2mqtt/bridge/config/rename
payload_template: >-
{
"old": "{{ states.input_text.zigbee2mqtt_old_name.state | string }}",
"new": "{{ states.input_text.zigbee2mqtt_new_name.state | string }}"
}
zigbee2mqtt_remove:
alias: Supprimer le module
sequence:
service: mqtt.publish
data_template:
topic: zigbee2mqtt/bridge/request/device/remove
payload_template: >-
{
"id": "{{ states.input_text.zigbee2mqtt_remove.state | string }}",
"force": {% if states.input_boolean.zigbee2mqtt_force_remove.state == "off" %}false{% else %}true{% endif %}
}
# Timer for joining time remaining (120 sec = 2 min)
timer:
zigbee_permit_join:
name: Temps restant
duration: 120
sensor:
# Sensor for monitoring the bridge state
- platform: mqtt
name: Bridge state
state_topic: "zigbee2mqtt/bridge/state"
icon: mdi:router-wireless
# Sensor for Showing the Zigbee2mqtt Version
- platform: mqtt
name: Zigbee2mqtt Version
state_topic: "zigbee2mqtt/bridge/config"
value_template: "{{ value_json.version }}"
icon: mdi:zigbee
# Sensor for Showing the Coordinator Version
- platform: mqtt
name: Coordinator Version
state_topic: "zigbee2mqtt/bridge/config"
value_template: "{{ value_json.coordinator }}"
icon: mdi:chip
- platform: mqtt
name: Zigbee2mqtt Networkmap
# if you change base_topic of Zigbee2mqtt, change state_topic accordingly
state_topic: zigbee2mqtt/bridge/networkmap/raw
value_template: >-
{{ now().strftime('%Y-%m-%d %H:%M:%S') }}
# again, if you change base_topic of Zigbee2mqtt, change json_attributes_topic accordingly
json_attributes_topic: zigbee2mqtt/bridge/networkmap/raw
# Switch for enabling joining
switch:
- platform: mqtt
name: "Zigbee2mqtt Main join"
state_topic: "zigbee2mqtt/bridge/config/permit_join"
command_topic: "zigbee2mqtt/bridge/config/permit_join"
payload_on: "true"
payload_off: "false"
automation:
# Automation for sending MQTT message on input select change
- alias: Zigbee2mqtt Log Level
initial_state: "on"
trigger:
platform: state
entity_id: input_select.zigbee2mqtt_log_level
action:
- service: mqtt.publish
data:
payload_template: "{{ states('input_select.zigbee2mqtt_log_level') }}"
topic: zigbee2mqtt/bridge/config/log_level
# Automation to start timer when enable join is turned on
- id: zigbee_join_enabled
alias: Zigbee Join Enabled
trigger:
platform: state
entity_id: switch.zigbee2mqtt_main_join
to: "on"
action:
service: timer.start
entity_id: timer.zigbee_permit_join
# Automation to stop timer when switch turned off and turn off switch when timer finished
- id: zigbee_join_disabled
alias: Zigbee Join Disabled
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.zigbee_permit_join
- platform: state
entity_id: switch.zigbee2mqtt_main_join
to: "off"
action:
- service: timer.cancel
data:
entity_id: timer.zigbee_permit_join
- service: switch.turn_off
entity_id: switch.zigbee2mqtt_main_join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment