availability list (optional)
A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.

payload_available string (optional, default: online)
The payload that represents the available state.

payload_not_available string (optional, default: offline)
The payload that represents the unavailable state.

topic string REQUIRED
An MQTT topic subscribed to receive availability (online/offline) updates.

value_template template (optional)
Defines a template to extract device’s availability from the topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.

availability_mode string (optional, default: latest)
When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.

availability_template template (optional)
Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.

availability_topic string (optional)
The MQTT topic subscribed to receive birth and LWT messages from the MQTT device. If availability is not defined, the binary sensor will always be considered available and its state will be on, off or unknown. If availability is defined, the binary sensor will be considered as unavailable by default and the sensor’s initial state will be unavailable. Must not be used together with availability.

device map (optional)
Information about the device this binary sensor is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.

configuration_url string (optional)
A link to the webpage that can manage the configuration of this device. Can be either an HTTP or HTTPS link.

connections list | map (optional)
A list of connections of the device to the outside world as a list of tuples [connection_type, connection_identifier]. For example the MAC address of a network interface: 'connections': ['mac', '02:5b:26:a8:dc:12'].

hw_version string (optional)
The hardware version of the device.

identifiers list | string (optional)
A list of IDs that uniquely identify the device. For example a serial number.

manufacturer string (optional)
The manufacturer of the device.

model string (optional)
The model of the device.

name string (optional)
The name of the device.

suggested_area string (optional)
Suggest an area if the device isn’t in one yet.

sw_version string (optional)
The firmware version of the device.

via_device string (optional)
Identifier of a device that routes messages between this device and Home Assistant. Examples of such devices are hubs, or parent devices of a sub-device. This is used to show device topology in Home Assistant.

device_class string (optional)
Sets the class of the device, changing the device state and icon that is displayed on the frontend.

enabled_by_default boolean (optional, default: true)
Flag which defines if the entity should be enabled when first added.

encoding string (optional, default: utf-8)
The encoding of the payloads received. Set to "" to disable decoding of incoming payload.

entity_category string (optional, default: None)
The category of the entity.

expire_after integer (optional)
If set, it defines the number of seconds after the sensor’s state expires, if it’s not updated. After expiry, the sensor’s state becomes unavailable. Default the sensors state never expires.

force_update boolean (optional, default: false)
Sends update events (which results in update of state object’s last_changed) even if the sensor’s state hasn’t changed. Useful if you want to have meaningful value graphs in history or want to create an automation that triggers on every incoming state message (not only when the sensor’s new state is different to the current one).

icon icon (optional)
Icon for the entity.

json_attributes_template template (optional)
Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.

json_attributes_topic string (optional)
The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.

name string (optional, default: MQTT Binary Sensor)
The name of the binary sensor.

object_id string (optional)
Used instead of name for automatic generation of entity_id

off_delay integer (optional)
For sensors that only send on state updates (like PIRs), this variable sets a delay in seconds after which the sensor’s state will be updated back to off.

payload_available string (optional, default: online)
The string that represents the online state.

payload_not_available string (optional, default: offline)
The string that represents the offline state.

payload_off string (optional, default: OFF)
The string that represents the off state. It will be compared to the message in the state_topic (see value_template for details)

payload_on string (optional, default: ON)
The string that represents the on state. It will be compared to the message in the state_topic (see value_template for details)

qos integer (optional, default: 0)
The maximum QoS level to be used when receiving messages.

state_topic string REQUIRED
The MQTT topic subscribed to receive sensor’s state.

unique_id string (optional)
An ID that uniquely identifies this sensor. If two sensors have the same unique ID, Home Assistant will raise an exception.

value_template string (optional)
Defines a template that returns a string to be compared to payload_on/payload_off or an empty string, in which case the MQTT message will be removed. Remove this option when payload_on and payload_off are sufficient to match your payloads (i.e no pre-processing of original message is required).

