Compare commits

..

1 Commits

Author SHA1 Message Date
tm24fan8 a33f9f66ae Beginning of rewrite for custom meds 2025-12-16 19:34:00 -05:00
4 changed files with 91 additions and 55 deletions
+84 -34
View File
@@ -2967,49 +2967,99 @@
- id: '1696539209438' - id: '1696539209438'
alias: Tony Custom Meds Handler alias: Tony Custom Meds Handler
description: '' description: ''
trigger: triggers:
- platform: time - minutes: /30
at: input_datetime.tony_custom_meds_notify_p1 id: trigger30
alias: Every 30 minutes
trigger: time_pattern
- at: input_datetime.tony_custom_meds_notify_p1
alias: Notify 1 alias: Notify 1
id: p1-notify id: p1-notify
- platform: state trigger: time
entity_id: - alias: Notify 2
at: input_datetime.tony_custom_meds_notify_p2
id: p2-notify
trigger: time
- entity_id:
- input_boolean.tony_custom_meds_taken_p1 - input_boolean.tony_custom_meds_taken_p1
from: 'off' from: 'off'
to: 'on' to: 'on'
id: p1-taken id: p1-taken
alias: Taken 1 alias: Taken 1
condition: [] trigger: state
action: - alias: Taken 2
- variables: entity_id:
trigger: '{{ trigger.id }}' - input_datetime.tony_custom_meds_taken_p2
num: '{{ trigger[:2] }}' from: 'off'
reason: '{{ trigger.split(''-'')[1] }}' to: 'on'
- if: id: p2-taken
- condition: template trigger: state
value_template: '{% set active = ''input_boolean.tony_custom_meds_tracker_'' conditions:
+ num %} - condition: or
conditions:
{{ is_state(active,''on'') }}' - condition: state
alias: Check tracker entity_id: input_boolean.tony_custom_meds_tracker_p1
state: 'on'
- condition: state
entity_id: input_boolean.tony_custom_meds_tracker_p2
state: 'on'
alias: Any custom med trackers are on
actions:
- alias: Routing
if:
- condition: trigger
id:
- trigger30
then: then:
- if: - variables:
- condition: template trigger: '{{ trigger.id }}'
value_template: '{{ reason == ''notify'' }}' num: all
alias: Is this a notification reason: notify
alias: Override variables to indicate this is an interval notify request
- alias: For each reminder entity
repeat:
for_each: '{{ states.input_boolean | selectattr(''entity_id'',''in'',label_entities(''Tony
Custom Meds'')) | selectattr(''entity_id'',''search'',''reminder'') | map(attribute=''entity_id'')
| list }}'
sequence:
- alias: Run custom meds script if tracker is active
if:
- alias: Check tracker
condition: template
value_template: '{{ is_state(repeat.item,''on'') }}'
then:
- data:
num: '{{ num }}'
reason: '{{ reason }}'
alias: Run custom meds script
action: script.tony_custom_meds
else:
- variables:
trigger: '{{ trigger.id }}'
num: '{{ trigger[:2] }}'
reason: '{{ trigger.split(''-'')[1] }}'
- alias: Run custom meds script if tracker is active
if:
- alias: Check tracker
condition: template
value_template: '{{ is_state(repeat.item,''on'') }}'
then: then:
- service: input_boolean.turn_off - if:
data: {} - condition: template
target: value_template: '{{ reason == ''notify'' }}'
entity_id: '{{ ''input_boolean.tony_custom_meds_taken_'' + num }}' alias: Is this a notification
alias: Turn off "taken" boolean then:
alias: Turn off "taken" boolean if this is a notification - data: {}
- service: script.tony_custom_meds target:
data: entity_id: '{{ ''input_boolean.tony_custom_meds_taken_'' + num }}'
num: '{{ num }}' alias: Turn off "taken" boolean
reason: '{{ reason }}' action: input_boolean.turn_off
alias: Run custom meds script alias: Turn off "taken" boolean if this is a notification
alias: Run custom meds script if tracker is active - data:
num: '{{ num }}'
reason: '{{ reason }}'
alias: Run custom meds script
action: script.tony_custom_meds
mode: parallel mode: parallel
max: 10 max: 10
- id: '1696556688808' - id: '1696556688808'
-14
View File
@@ -119,10 +119,6 @@ recorder:
- sensor.*_rssi - sensor.*_rssi
- sensor.weatherflow_hub* - sensor.weatherflow_hub*
- sensor.internet_round_trip* - sensor.internet_round_trip*
- sensor.*_monitor_type
- sensor.*_certificate_expiry
- sensor.*_monitored_url
- sensor.*_response_time
entities: entities:
- sensor.avg_ping - sensor.avg_ping
- sensor.max_ping - sensor.max_ping
@@ -284,11 +280,6 @@ influxdb:
- binary_sensor.asus_laptop* - binary_sensor.asus_laptop*
- sensor.*ashland* - sensor.*ashland*
- sensor.*kasx* - sensor.*kasx*
- sensor.*_monitor_type
- sensor.*_certificate_expiry
- sensor.*_monitored_url
- sensor.*_response_time
- sensor.*_status
entities: entities:
- media_player.living_room_tv - media_player.living_room_tv
- media_player.basement_tv - media_player.basement_tv
@@ -461,11 +452,6 @@ prometheus:
- binary_sensor.asus_laptop* - binary_sensor.asus_laptop*
- sensor.*ashland* - sensor.*ashland*
- sensor.*kasx* - sensor.*kasx*
- sensor.*_monitor_type
- sensor.*_certificate_expiry
- sensor.*_monitored_url
- sensor.*_response_time
- sensor.*_status
include_entities: include_entities:
- media_player.living_room_tv - media_player.living_room_tv
- media_player.basement_tv - media_player.basement_tv
+1
View File
@@ -47,6 +47,7 @@ ## HACS Components
- [PyScript](https://github.com/custom-components/pyscript) - [PyScript](https://github.com/custom-components/pyscript)
- [Hass Animated Scenes](https://github.com/chazzu/hass-animated-scenes) - [Hass Animated Scenes](https://github.com/chazzu/hass-animated-scenes)
- [Jokes](https://github.com/LaggAt/ha-jokes) - [Jokes](https://github.com/LaggAt/ha-jokes)
- [Uptime Kuma](https://github.com/meichthys/uptime_kuma)
- [Jellyfin](https://github.com/koying/jellyfin_ha) - [Jellyfin](https://github.com/koying/jellyfin_ha)
- [Sonoff LAN](https://github.com/AlexxIT/SonoffLAN) - [Sonoff LAN](https://github.com/AlexxIT/SonoffLAN)
- [Powercalc](https://github.com/bramstroker/homeassistant-powercalc) - [Powercalc](https://github.com/bramstroker/homeassistant-powercalc)
+6 -7
View File
@@ -450,19 +450,18 @@
unit_of_measurement: '' unit_of_measurement: ''
icon: mdi:close-network-outline icon: mdi:close-network-outline
state: > state: >
{% set uptimekuma = states.sensor | {% set uptimekuma = states.binary_sensor |
selectattr('entity_id','in',integration_entities('192.168.1.111')) | selectattr('entity_id','in',integration_entities('uptime_kuma')) |
selectattr('state','eq','down') | selectattr('state','eq','off') |
map(attribute='attributes.friendly_name') | map(attribute='attributes.friendly_name') |
list %} list %}
{{ uptimekuma | count | int }} {{ uptimekuma | count | int }}
attributes: attributes:
services: > services: >
{% set uptimekuma = states.sensor | {% set uptimekuma = states.binary_sensor |
selectattr('entity_id','in',integration_entities('192.168.1.111')) | selectattr('entity_id','in',integration_entities('uptime_kuma')) |
selectattr('state','eq','down') | selectattr('state','eq','off') |
map(attribute='attributes.friendly_name') | map(attribute='attributes.friendly_name') |
map('regex_replace', ' Status$', '') |
list %} list %}
{{ uptimekuma | join(', ') }} {{ uptimekuma | join(', ') }}
- name: Media Server Viewer Health - name: Media Server Viewer Health