-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
feature-requestFeature requestFeature request
Description
Is your feature request related to a problem? Please describe
According to Home Assistant documentation about MQTT Binary Sensor entities (HERE), Z2M publish states as boolean and not as string
This is the message published on MQTT broker...
zigbee2mqtt/mywindow {"battery":97,"contact":true,"linkquality":72,"temperature":24,"voltage":2995}
...and this is my binary_sensor...
binary_sensor:
- platform: "mqtt"
name: "mywindow"
state_topic: "zigbee2mqtt/mywindow"
availability_topic: "zigbee2mqtt/bridge/state"
value_template: "{{ value_json.contact }}"
payload_on: false
payload_off: true
device_class: "window"Take a look at keesschollaart81/vscode-home-assistant#1148
Describe the solution you'd like
Publish states true and false as string in MQTT payload
Describe alternatives you've considered
...apply template on HA ?
I think it is necessary to update the documentation related to manual configurations, applying the templates
- platform: "mqtt"
name: "mywindow"
state_topic: "zigbee2mqtt/mywindow"
availability_topic: "zigbee2mqtt/bridge/state"
value_template: "{{ 'true' if value_json.contact == true else 'false' }}"
payload_on: "false"
payload_off: "true"
device_class: "window"Additional context
Metadata
Metadata
Assignees
Labels
feature-requestFeature requestFeature request
