Lots of little bug fixes! #1141

This commit is contained in:
CCOSTAN 2024-09-18 18:05:53 +00:00
parent 16164f93f7
commit 348ea39056
2 changed files with 19 additions and 15 deletions

View File

@ -9,7 +9,7 @@ sensor:
sensors: sensors:
last_alexa: last_alexa:
value_template: > value_template: >
{{ states.media_player | selectattr('attributes.last_called','eq',True) | map(attribute='entity_id') | first }} {{ states.media_player | selectattr('attributes.last_called','eq',True) | map(attribute='entity_id') | first | default('none') }}
#------------------------------------------- #-------------------------------------------

View File

@ -40,27 +40,31 @@ sensor:
{{ holiday }} {{ holiday }}
################################################################################ ################################################################################
# Sensor Uses Flag data from this calendar - http://www.webcal.fi/en-US/flag_days.php # Sensor Uses Flag data generated by AI
################################################################################ ################################################################################
- platform: rest - platform: rest
resource: https://raw.githubusercontent.com/CCOSTAN/Home-AssistantConfig/master/config/json_data/flag_days.json resource: https://raw.githubusercontent.com/CCOSTAN/Home-AssistantConfig/master/config/json_data/flag_days.json
name: Flag name: Flag
scan_interval: 14400 scan_interval: 14400
value_template: >- value_template: >-
{%- set now_string = now().strftime('%m/%d') %} {% set now_string = now().strftime('%m/%d') %}
{%- set now_full_string = now().strftime('%m/%d/%Y') %} {% set now_full_string = now().strftime('%m/%d/%Y') %}
{% set static_days = value_json.Flag_Days_US.static %} {% if value_json is defined and value_json.Flag_Days_US is defined %}
{% set dynamic_days = value_json.Flag_Days_US.dynamic %} {% set static_days = value_json.Flag_Days_US.static %}
{% if static_days is defined and now_string in static_days %} {% set dynamic_days = value_json.Flag_Days_US.dynamic %}
True {% if static_days is defined and now_string in static_days %}
{% elif dynamic_days is defined %} True
{% for day_val in dynamic_days %} {% elif dynamic_days is defined %}
{% if day_val.date == now_full_string %} {% for day_val in dynamic_days %}
True {% if day_val.date == now_full_string %}
{% endif %} True
{% endfor %} {% endif %}
{% endfor %}
{% else %}
False
{% endif %}
{% else %} {% else %}
False
{% endif %} {% endif %}
################################################################################ ################################################################################