Creates a new binary sensor instance
Configuration settings for the binary sensor
OptionalisOn: booleanInitial state of the sensor
ProtectedattributesMQTT topic for entity attributes
ProtectedavailabilityMQTT topic for entity availability status
ProtectedbaseBase MQTT topic name for this entity
ProtectedcomponentThe component configuration containing entity-specific settings
ProtectedconfigMQTT topic for entity configuration
ProtectedidentifierUnique identifier for this entity
ProtectedloggerLogger instance for debugging and error reporting
ProtectedmqttThe MQTT client instance used for communication
ProtectedsettingsThe component settings including MQTT configuration
ProtectedstateCallback function to handle state changes
ProtectedstateList of MQTT topics for entity state
ProtectedwroteFlag indicating whether configuration has been written to MQTT
Returns the current state of the sensor.
ProtectedgetGets the complete configuration for this entity including MQTT topics
The resolved component configuration with all required MQTT topics
Sets the sensor state to OFF/inactive
Sets the sensor state to ON/active
Sets additional attributes for the entity
Key-value pairs of attributes to set
Sets the availability state of the entity
True if the entity is available, false otherwise
Toggles the sensor state
Writes the entity's configuration to MQTT for Home Assistant discovery Also sets the entity's initial availability state if not manually managed
Represents a binary sensor in Home Assistant. A binary sensor can only be in one of two states: ON/active or OFF/inactive.