fix bl0906 reset energy action (#7488)
Some checks failed
CI / Create common environment (push) Waiting to run
CI / Check black (push) Blocked by required conditions
CI / Check flake8 (push) Blocked by required conditions
CI / Check pylint (push) Blocked by required conditions
CI / Check pyupgrade (push) Blocked by required conditions
CI / Run script/ci-custom (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Blocked by required conditions
CI / Run pytest (push) Blocked by required conditions
CI / Check clang-format (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 IDF (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP8266 (push) Blocked by required conditions
CI / list-components (push) Blocked by required conditions
CI / Component test (push) Blocked by required conditions
CI / Split components for testing into 20 groups maximum (push) Blocked by required conditions
CI / Test split components (push) Blocked by required conditions
CI / CI Status (push) Blocked by required conditions
YAML lint / yamllint (push) Has been cancelled

Co-authored-by: Samuel Sieb <samuel@sieb.net>
This commit is contained in:
Samuel Sieb 2024-09-24 17:50:44 -07:00 committed by GitHub
parent 294fe8d970
commit 8e54a622d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -145,8 +145,9 @@ FINAL_VALIDATE_SCHEMA = uart.final_validate_device_schema(
), ),
) )
async def reset_energy_to_code(config, action_id, template_arg, args): async def reset_energy_to_code(config, action_id, template_arg, args):
paren = await cg.get_variable(config[CONF_ID]) var = cg.new_Pvariable(action_id, template_arg)
return cg.new_Pvariable(action_id, template_arg, paren) await cg.register_parented(var, config[CONF_ID])
return var
async def to_code(config): async def to_code(config):

View file

@ -8,6 +8,7 @@ uart:
sensor: sensor:
- platform: bl0906 - platform: bl0906
id: bl
frequency: frequency:
name: 'Frequency' name: 'Frequency'
temperature: temperature:
@ -60,3 +61,9 @@ sensor:
name: 'Total_Energy' name: 'Total_Energy'
total_power: total_power:
name: 'Total_Power' name: 'Total_Power'
button:
- platform: template
id: reset
on_press:
- bl0906.reset_energy: bl