mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	fix bl0906 reset energy action (#7488)
Co-authored-by: Samuel Sieb <samuel@sieb.net>
This commit is contained in:
		| @@ -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): | ||||||
|   | |||||||
| @@ -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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user