mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
fix bl0906 reset energy action (#7488)
Co-authored-by: Samuel Sieb <samuel@sieb.net>
This commit is contained in:
parent
1f8037d5bc
commit
4332301dbb
2 changed files with 10 additions and 2 deletions
|
@ -145,8 +145,9 @@ FINAL_VALIDATE_SCHEMA = uart.final_validate_device_schema(
|
|||
),
|
||||
)
|
||||
async def reset_energy_to_code(config, action_id, template_arg, args):
|
||||
paren = await cg.get_variable(config[CONF_ID])
|
||||
return cg.new_Pvariable(action_id, template_arg, paren)
|
||||
var = cg.new_Pvariable(action_id, template_arg)
|
||||
await cg.register_parented(var, config[CONF_ID])
|
||||
return var
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
|
|
|
@ -8,6 +8,7 @@ uart:
|
|||
|
||||
sensor:
|
||||
- platform: bl0906
|
||||
id: bl
|
||||
frequency:
|
||||
name: 'Frequency'
|
||||
temperature:
|
||||
|
@ -60,3 +61,9 @@ sensor:
|
|||
name: 'Total_Energy'
|
||||
total_power:
|
||||
name: 'Total_Power'
|
||||
|
||||
button:
|
||||
- platform: template
|
||||
id: reset
|
||||
on_press:
|
||||
- bl0906.reset_energy: bl
|
||||
|
|
Loading…
Reference in a new issue