1
0

Update info battery automation

This commit is contained in:
Przemek Grondek 2023-12-16 01:46:23 +01:00
parent 3646dfc042
commit a884e69199
4 changed files with 108 additions and 214 deletions

76
battery.yml Normal file
View File

@ -0,0 +1,76 @@
battery:
- sensor.3d_printer_button_battery
- sensor.3d_printer_sensor_battery
- sensor.3d_printer_smoke_sensor_battery_level
- sensor.bathroom_button_battery
- sensor.bathroom_door_battery
- sensor.bathroom_mirror_button_battery
- sensor.bathroom_motion_battery
- sensor.bathroom_sensor_battery
- sensor.bathroom_shower_motion_battery
- sensor.bathroom_thermostat_battery_level
- sensor.bedroom_bed_button_battery
- sensor.bedroom_bed_motion_sensor_battery
- sensor.bedroom_button_battery
- sensor.bedroom_door_battery
- sensor.bedroom_motion_battery
- sensor.bedroom_sensor_ble_battery
- sensor.bedroom_thermostat_battery
- sensor.bedroom_thermostat_battery_level
- sensor.bedroom_thermostat_battery_level_status
- sensor.bedroom_thermostat_battery_load_status
- sensor.bedroom_tv_button_battery
- sensor.coffee_bot_battery
- sensor.computer_button_battery
- sensor.dining_blind_back_battery
- sensor.dining_blinds_controller_battery
- sensor.dining_motion_sensor_battery_level
- sensor.dining_plants_leak_sensor_battery
- sensor.dining_thermostat_battery
- sensor.dining_thermostat_battery_level
- sensor.dining_window_1_battery
- sensor.dining_window_2_battery
- sensor.door_window_sensor_battery_level
- sensor.elgato_gw33l1a00453_battery
- sensor.flood_coffee_machine_leak_battery_level
- sensor.freezer_door_battery
- sensor.front_door_lock_battery
- sensor.front_door_lock_button_battery
- sensor.front_door_sensor_battery
- sensor.hallway_button_battery
- sensor.hallway_motion_battery
- sensor.humidifier_leak_battery
- sensor.intercom_button_battery
- sensor.kitchen_coffee_shopping_button_battery
- sensor.kitchen_meal_button_battery
- sensor.kitchen_motion_sensor_battery_level
- sensor.kitchen_oatmeal_button_battery
- sensor.kitchen_pasta_button_battery
- sensor.kitchen_sink_button_battery
- sensor.kitchen_sink_leak_sensor_battery
- sensor.kitchen_sink_motion_sensor_battery
- sensor.kitchen_spices_button_battery
- sensor.kitchen_tabletop_motion_battery_level
- sensor.living_room_button_battery
- sensor.living_room_plant_1_battery
- sensor.living_room_plant_2_battery
- sensor.myups_battery_charge
- sensor.office_air_quality_battery
- sensor.office_blind_button_battery
- sensor.office_illuminance_sensor_battery
- sensor.office_keylight_button_battery
- sensor.office_motion_sensor_battery
- sensor.office_sensor_battery
- sensor.office_thermostat_battery
- sensor.office_thermostat_battery_level
- sensor.office_window_sensor_battery
- sensor.office_window_vibration_sensor_battery
- sensor.printer_button_battery
- sensor.quest_battery_level
- sensor.rack_sensor_battery
- sensor.rack_smoke_sensor_battery
- sensor.siren_alarm_battery_level
- sensor.smart_series_7000_a19f_battery
- sensor.thuja_plant_1_battery
- sensor.valetudo_valetudos5_battery_level
- sensor.washing_machine_battery

View File

@ -1,214 +0,0 @@
- id: info_battery_notice
alias: '[INFO] Battery notice'
mode: single
trigger:
- platform: numeric_state
below: '10'
entity_id: sensor.3d_printer_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.3d_printer_smoke_sensor_battery_level
- platform: numeric_state
below: '10'
entity_id: sensor.bathroom_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.bathroom_door_battery
- platform: numeric_state
below: '10'
entity_id: sensor.bathroom_mirror_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.bathroom_motion_battery
- platform: numeric_state
below: '10'
entity_id: button.bathroom_music_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.bathroom_thermostat_battery_level_3
- platform: numeric_state
below: '10'
entity_id: sensor.bedroom_bed_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.bedroom_bed_motion_sensor_battery
- platform: numeric_state
below: '10'
entity_id: sensor.bedroom_blinds_button_power
- platform: numeric_state
below: '10'
entity_id: sensor.bedroom_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.bedroom_door_battery
- platform: numeric_state
below: '10'
entity_id: sensor.bedroom_motion_battery
- platform: numeric_state
below: '10'
entity_id: sensor.bedroom_thermostat_battery_level
- platform: numeric_state
below: '10'
entity_id: sensor.bedroom_window_open_close_power
- platform: numeric_state
below: '10'
entity_id: sensor.ble_battery_a4c13867c876
- platform: numeric_state
below: '10'
entity_id: sensor.ble_battery_bathroom_sensor_ble
- platform: numeric_state
below: '10'
entity_id: sensor.ble_battery_bedroom_sensor_ble
- platform: numeric_state
below: '10'
entity_id: sensor.ble_battery_computer_cave_sensor
- platform: numeric_state
below: '10'
entity_id: sensor.ble_battery_filament_sensor
- platform: numeric_state
below: '10'
entity_id: sensor.ble_battery_living_room_plant_1
- platform: numeric_state
below: '10'
entity_id: sensor.ble_battery_living_room_plant_2
- platform: numeric_state
below: '10'
entity_id: sensor.ble_battery_rack_sensor
- platform: numeric_state
below: '10'
entity_id: sensor.ble_battery_thuja_plant_1
- platform: numeric_state
below: '10'
entity_id: sensor.ble_battery_thuja_plant_2
- platform: numeric_state
below: '10'
entity_id: sensor.ble_battery_thuja_plant_3
- platform: numeric_state
below: '10'
entity_id: sensor.computer_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.dining_blinds_controller_battery
- platform: numeric_state
below: '10'
entity_id: sensor.dining_blind_back_battery
- platform: numeric_state
below: '10'
entity_id: sensor.dining_thermostat_battery_level
- platform: numeric_state
below: '10'
entity_id: sensor.dining_window_1_battery
- platform: numeric_state
below: '10'
entity_id: sensor.dining_window_2_battery
- platform: numeric_state
below: '10'
entity_id: sensor.door_window_sensor_battery_level
- platform: numeric_state
below: '10'
entity_id: sensor.flood_water_sensor_battery_level
- platform: numeric_state
below: '10'
entity_id: sensor.freezer_door_battery
- platform: numeric_state
below: '10'
entity_id: sensor.fridge_leak_power
- platform: numeric_state
below: '10'
entity_id: sensor.front_door_lock_battery
- platform: numeric_state
below: '10'
entity_id: sensor.front_door_lock_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.front_door_sensor_battery
- platform: numeric_state
below: '10'
entity_id: sensor.front_door_vibration_power
- platform: numeric_state
below: '10'
entity_id: sensor.hallway_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.hallway_motion_battery
- platform: numeric_state
below: '10'
entity_id: sensor.kitchen_button_power
- platform: numeric_state
below: '10'
entity_id: sensor.kitchen_coffee_shopping_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.kitchen_meal_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.kitchen_motion_sensor_battery_level
- platform: numeric_state
below: '10'
entity_id: sensor.kitchen_oatmeal_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.kitchen_pasta_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.kitchen_sink_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.kitchen_spices_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.kitchen_sink_leak_sensor_battery
- platform: numeric_state
below: '10'
entity_id: sensor.kitchen_sink_motion_sensor_battery
- platform: numeric_state
below: '10'
entity_id: sensor.living_room_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.office_blind_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.office_illuminance_sensor_battery
- platform: numeric_state
below: '10'
entity_id: sensor.office_motion_sensor_battery
- platform: numeric_state
below: '10'
entity_id: sensor.office_thermostat_battery_level
- platform: numeric_state
below: '10'
entity_id: sensor.office_window_vibration_sensor_battery
- platform: numeric_state
below: '10'
entity_id: sensor.office_window_sensor_battery
- platform: numeric_state
below: '10'
entity_id: sensor.printer_button_battery
- platform: numeric_state
below: '10'
entity_id: sensor.rack_smoke_sensor_battery
- platform: numeric_state
below: '10'
entity_id: sensor.bathroom_shower_sensor_battery
- platform: numeric_state
below: '10'
entity_id: sensor.siren_alarm_battery_level
- platform: numeric_state
below: '10'
entity_id: sensor.sink_motion_sensor_power
- platform: numeric_state
below: '10'
entity_id: sensor.kitchen_tabletop_motion_battery_level
- platform: numeric_state
below: '10'
entity_id: sensor.washing_machine_battery
- platform: numeric_state
below: '10'
entity_id: sensor.weather_sensor_power
action:
- service: notify.mobile_app_iphone
data:
title: "Low battery"
message: >
{{ state_attr(trigger.entity_id, 'friendly_name') }} has low battery

View File

@ -57,6 +57,16 @@
dest: './build/automations/unavailable-zwave.yaml'
vars:
devices: "{{ zwave.devices }}"
- name: Include battery vars
include_vars:
file: battery.yml
- name: Build battery info automations
delegate_to: localhost
template:
src: low-battery.yaml.j2
dest: './build/automations/low-battery.yaml'
vars:
entities: "{{ battery }}"
- name: Build spices shopping automations
delegate_to: localhost
template:

View File

@ -0,0 +1,22 @@
- id: info_low_battery
alias: '[INFO] Low battery'
mode: single
trigger:
- platform: numeric_state
below: 20
entity_id:
{% for entity in entities %}
- {{ entity }}
{% endfor %}
- platform: numeric_state
below: 10
entity_id:
{% for entity in entities %}
- {{ entity }}
{% endfor %}
action:
- service: notify.mobile_app_iphone
data:
title: "Low battery"
message: >
{% raw %}{{ state_attr(trigger.entity_id, 'name_by_user') }} has low battery {{ states(trigger.entity_id }}% {% endraw %}