[nrf52,zigbee] Add binary output as switch (#13083)

Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
This commit is contained in:
tomaszduda23andJonathan Swoboda authored and GitHub committed 2026-01-13 17:39:28 -05:00
1 parent 3d74d1e7f0
commit e45cad45fe
9 files changed
+260 -10

No files matched your search

+15 -1
View File
@@ -23,7 +23,7 @@ from .const_zephyr import (
ZigbeeComponent,
zigbee_ns,
)
from .zigbee_zephyr import zephyr_binary_sensor, zephyr_sensor
from .zigbee_zephyr import zephyr_binary_sensor, zephyr_sensor, zephyr_switch
_LOGGER = logging.getLogger(__name__)
@@ -41,6 +41,7 @@ def zigbee_set_core_data(config: ConfigType) -> ConfigType:
BINARY_SENSOR_SCHEMA = cv.Schema({}).extend(zephyr_binary_sensor)
SENSOR_SCHEMA = cv.Schema({}).extend(zephyr_sensor)
SWITCH_SCHEMA = cv.Schema({}).extend(zephyr_switch)
CONFIG_SCHEMA = cv.All(
cv.Schema(
@@ -107,6 +108,15 @@ async def setup_sensor(entity: cg.MockObj, config: ConfigType) -> None:
await zephyr_setup_sensor(entity, config)
async def setup_switch(entity: cg.MockObj, config: ConfigType) -> None:
if not config.get(CONF_ZIGBEE_ID) or config.get(CONF_INTERNAL):
return
if CORE.using_zephyr:
from .zigbee_zephyr import zephyr_setup_switch
await zephyr_setup_switch(entity, config)
def consume_endpoint(config: ConfigType) -> ConfigType:
if not config.get(CONF_ZIGBEE_ID) or config.get(CONF_INTERNAL):
return config
@@ -130,6 +140,10 @@ def validate_sensor(config: ConfigType) -> ConfigType:
return consume_endpoint(config)
def validate_switch(config: ConfigType) -> ConfigType:
return consume_endpoint(config)
ZIGBEE_ACTION_SCHEMA = automation.maybe_simple_id(
cv.Schema(
{