mirror of
https://github.com/esphome/esphome.git
synced 2024-12-23 16:47:57 +01:00
Pass optional args to 'new_Pvariable' when creating new entities (#3690)
This commit is contained in:
parent
cd473e1395
commit
989b7be99b
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user