Binary Sensor
Overview
Binary sensors which have either the state “on” or “off”. Binary sensors could be e.g. a switch in the wall (the thing you press on when switching on the light) or a motion detector.
The logic within switches can further handle if a button is pressed once or twice - and trigger different actions in HA. Use the attribute counter
for this purpose.
Interface
xknx
is the XKNX object.name
is the name of the object.group_address_state
is the KNX group address of the sensor device.invert
inverts the payload so state “on” is represented by 0 on bus and “off” by 1. Defaults toFalse
sync_state
defines if and how often the value should be actively read from the bus. IfFalse
no GroupValueRead telegrams will be sent to its group address. Defaults toTrue
ignore_internal_state
allows callback call regardless of the current binary sensor state. Defaults toFalse
context_timeout
time in seconds telegrams should be counted towards the current context to increment the counter. If setignore_internal_state
is setTrue
. Defaults toNone
reset_after
may be used to reset the internal state toOFF
again after given time in sec. Defaults toNone
device_updated_cb
Callback for each update.
Example
binarysensor = BinarySensor(xknx, 'TestInput', group_address_state='2/3/4')
xknx.devices.async_add(binarysensor)
# Returns the last received Telegram or None
binarysensor.last_telegram