From 989b7be99b25e4fee3146737923aa148686309b6 Mon Sep 17 00:00:00 2001 From: RoboMagus <68224306+RoboMagus@users.noreply.github.com> Date: Sun, 7 Aug 2022 21:31:50 +0200 Subject: [PATCH] Pass optional args to 'new_Pvariable' when creating new entities (#3690) --- esphome/components/binary_sensor/__init__.py | 4 ++-- esphome/components/button/__init__.py | 4 ++-- esphome/components/sensor/__init__.py | 4 ++-- esphome/components/text_sensor/__init__.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/esphome/components/binary_sensor/__init__.py b/esphome/components/binary_sensor/__init__.py index c4de2023ca..600c9efe5a 100644 --- a/esphome/components/binary_sensor/__init__.py +++ b/esphome/components/binary_sensor/__init__.py @@ -483,8 +483,8 @@ async def register_binary_sensor(var, config): await setup_binary_sensor_core_(var, config) -async def new_binary_sensor(config): - var = cg.new_Pvariable(config[CONF_ID]) +async def new_binary_sensor(config, *args): + var = cg.new_Pvariable(config[CONF_ID], *args) await register_binary_sensor(var, config) return var diff --git a/esphome/components/button/__init__.py b/esphome/components/button/__init__.py index 1e248ddf07..b0611a62e9 100644 --- a/esphome/components/button/__init__.py +++ b/esphome/components/button/__init__.py @@ -102,8 +102,8 @@ async def register_button(var, config): await setup_button_core_(var, config) -async def new_button(config): - var = cg.new_Pvariable(config[CONF_ID]) +async def new_button(config, *args): + var = cg.new_Pvariable(config[CONF_ID], *args) await register_button(var, config) return var diff --git a/esphome/components/sensor/__init__.py b/esphome/components/sensor/__init__.py index 4edf8d45d0..e88cd05c31 100644 --- a/esphome/components/sensor/__init__.py +++ b/esphome/components/sensor/__init__.py @@ -614,8 +614,8 @@ async def register_sensor(var, config): await setup_sensor_core_(var, config) -async def new_sensor(config): - var = cg.new_Pvariable(config[CONF_ID]) +async def new_sensor(config, *args): + var = cg.new_Pvariable(config[CONF_ID], *args) await register_sensor(var, config) return var diff --git a/esphome/components/text_sensor/__init__.py b/esphome/components/text_sensor/__init__.py index f2f382ceaa..dd3dbddc43 100644 --- a/esphome/components/text_sensor/__init__.py +++ b/esphome/components/text_sensor/__init__.py @@ -189,8 +189,8 @@ async def register_text_sensor(var, config): await setup_text_sensor_core_(var, config) -async def new_text_sensor(config): - var = cg.new_Pvariable(config[CONF_ID]) +async def new_text_sensor(config, *args): + var = cg.new_Pvariable(config[CONF_ID], *args) await register_text_sensor(var, config) return var