Minor changes

This commit is contained in:
ElVit 2025-01-30 08:34:03 +01:00
parent 3d8aaec71d
commit 07e4f2cd8e
8 changed files with 25 additions and 25 deletions

View File

@ -1,7 +1,7 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import uart
from esphome.const import CONF_ID, CONF_ADDRESS
from esphome.const import CONF_ID
CODEOWNERS = ['@elvit']
MULTICONF = True

16
components/panasonic_heatpump/binary_sensor.py Executable file → Normal file
View File

@ -85,12 +85,12 @@ CONFIG_SCHEMA = cv.All(
).extend(cv.COMPONENT_SCHEMA)
)
async def setup_conf(config, key, hub):
if sensor_config := config.get(key):
var = await binary_sensor.new_binary_sensor(sensor_config)
cg.add(getattr(hub, f"set_{key}_binary_sensor")(var))
async def to_code(config):
hub = await cg.get_variable(config[CONF_PANASONIC_HEATPUMP_ID])
for key in TYPES:
await setup_conf(config, key, hub)
hub = await cg.get_variable(config[CONF_PANASONIC_HEATPUMP_ID])
for key in TYPES:
await setup_conf(config, key, hub)
async def setup_conf(parent_config, key, hub):
if child_config := parent_config.get(key):
var = await binary_sensor.new_binary_sensor(child_config)
cg.add(getattr(hub, f"set_{key}_binary_sensor")(var))

0
components/panasonic_heatpump/decode.cpp Executable file → Normal file
View File

0
components/panasonic_heatpump/decode.h Executable file → Normal file
View File

0
components/panasonic_heatpump/panasonic_heatpump.h Executable file → Normal file
View File

16
components/panasonic_heatpump/sensor.py Executable file → Normal file
View File

@ -686,12 +686,12 @@ CONFIG_SCHEMA = cv.All(
).extend(cv.COMPONENT_SCHEMA)
)
async def setup_conf(config, key, hub):
if sensor_config := config.get(key):
sens = await sensor.new_sensor(sensor_config)
cg.add(getattr(hub, f"set_{key}_sensor")(sens))
async def to_code(config):
hub = await cg.get_variable(config[CONF_PANASONIC_HEATPUMP_ID])
for key in TYPES:
await setup_conf(config, key, hub)
hub = await cg.get_variable(config[CONF_PANASONIC_HEATPUMP_ID])
for key in TYPES:
await setup_conf(config, key, hub)
async def setup_conf(parent_config, key, hub):
if child_config := parent_config.get(key):
var = await sensor.new_sensor(child_config)
cg.add(getattr(hub, f"set_{key}_sensor")(var))

16
components/panasonic_heatpump/text_sensor.py Executable file → Normal file
View File

@ -124,12 +124,12 @@ CONFIG_SCHEMA = cv.All(
).extend(cv.COMPONENT_SCHEMA)
)
async def setup_conf(config, key, hub):
if sensor_config := config.get(key):
sens = await text_sensor.new_text_sensor(sensor_config)
cg.add(getattr(hub, f"set_{key}_text_sensor")(sens))
async def to_code(config):
hub = await cg.get_variable(config[CONF_PANASONIC_HEATPUMP_ID])
for key in TYPES:
await setup_conf(config, key, hub)
hub = await cg.get_variable(config[CONF_PANASONIC_HEATPUMP_ID])
for key in TYPES:
await setup_conf(config, key, hub)
async def setup_conf(parent_config, key, hub):
if child_config := parent_config.get(key):
var = await text_sensor.new_text_sensor(child_config)
cg.add(getattr(hub, f"set_{key}_text_sensor")(var))

0
example_panasonic_heatpump.yaml Executable file → Normal file
View File