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.
binarysensor = BinarySensor(xknx, 'TestInput', group_address_state='1/2/3', device_class='motion')
xknxis the XKNX object.
nameis the name of the object.
group_address_stateis the KNX group address of the sensor device.
invertinverts the payload so state “on” is represented by 0 on bus and “off” by 1. Defaults to
sync_statedefines if the value should be actively read from the bus. If
Falseno GroupValueRead telegrams will be sent to its group address. Defaults to
ignore_internal_stateallows callback call regardless of the current binary sensor state. Defaults to
context_timeouttime in seconds telegrams should be counted towards the current context to increment the counter. If set
True. Defaults to
reset_aftermay be used to reset the internal state to
OFFagain after given time in sec. Defaults to
device_classmay be used to store the type of sensor, e.g. “motion” for motion detectors for Home-Assistant.
device_updated_cbawaitable callback for each update.
binarysensor = BinarySensor(xknx, 'TestInput', group_address_state='2/3/4') # Returns the last received Telegram or None binarysensor.last_telegram