From b1f0567ce0a628ff2cf59ee1574262ae6bea544e Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 27 Oct 2023 14:57:47 +0100 Subject: [PATCH] twek switch python --- components/BalboaGL/switch/__init__.py | 29 ++++++++++++++++++++++++++ components/BalboaGL/switch/switch.py | 28 ------------------------- 2 files changed, 29 insertions(+), 28 deletions(-) delete mode 100644 components/BalboaGL/switch/switch.py diff --git a/components/BalboaGL/switch/__init__.py b/components/BalboaGL/switch/__init__.py index e69de29..00bc3be 100644 --- a/components/BalboaGL/switch/__init__.py +++ b/components/BalboaGL/switch/__init__.py @@ -0,0 +1,29 @@ +import esphome.codegen as cg +import esphome.config_validation as cv +from esphome.components import switch +from esphome.const import CONF_ID + +from .. import balboa_ns, CONF_BALBOA_ID, BalboaGL + +DEPENDENCIES = ["BalboaGL"] + +LightSwitch = cg.esphome_ns.class_('LightSwitch', switch.Switch, cg.Component) + +CONFIG_SCHEMA = ( + switch.switch_schema(LightSwitch) + .extend( + { + cv.GenerateID(CONF_BALBOA_ID): cv.use_id(BalboaGL), + } + ) + .extend(cv.COMPONENT_SCHEMA) +) + +async def to_code(config): + var = await switch.new_switch(config) + await cg.register_component(var, config) + + paren = await cg.get_variable(config[CONF_BALBOA_ID]) +# cg.add(var.set_balboa_parent(paren)) +# cg.add(cg.RawExpression("balboaglclimate->set_spa(balboagl->get_spa())")) + diff --git a/components/BalboaGL/switch/switch.py b/components/BalboaGL/switch/switch.py deleted file mode 100644 index faa5379..0000000 --- a/components/BalboaGL/switch/switch.py +++ /dev/null @@ -1,28 +0,0 @@ -import esphome.codegen as cg -import esphome.config_validation as cv -from esphome.components import switch -from esphome.const import CONF_ID - -from .. import balboa_ns, CONF_BALBOA_ID, BalboaGL - -DEPENDENCIES = ["BalboaGL"] - -LightSwitch = balboa_ns.class_('LightSwitch', switch.Switch, cg.Component) - -CONFIG_SCHEMA = ( - switch.switch_schema(LightSwitch) - .extend( - { - cv.GenerateID(CONF_BALBOA_ID): cv.use_id(BalboaGL), - } - ) - .extend(cv.COMPONENT_SCHEMA) -) - -async def to_code(config): - var = await switch.new_switch(config) - await cg.register_component(var, config) - - paren = await cg.get_variable(config[CONF_BALBOA_ID]) - cg.add(var.set_balboa_parent(paren)) -