Misux
1
Guten Morgen.
Ich habe mir s Sensoren erstellt aber bei der Prüfung der Konfiguration bekomme ich eine Warnung… Hat jemand eine Idee was ich da falsch mache?
HIer die Warnung:
Und hier meine config.yaml einträge:
- platform: template
sensors:
- name: "Mein_Sonnenaufgang"
unique_id: "my_next_sunrise"
state: '{{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom("%H:%M")}}'
icon: mdi:weather-sunset-up
- platform: template
sensors:
- name: "Mein_Sonnenuntergang"
unique_id: "my_next_sunset"
state: '{{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom("%H:%M")}}'
icon: mdi:weather-sunset-down
73ymw
2
Probiere mal das,
- platform: template
sensors:
reicht ein Mal:
sensor:
- platform: template
sensors:
- name: "Mein_Sonnenaufgang"
unique_id: "my_next_sunrise"
state: '{{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom("%H:%M")}}'
icon: mdi:weather-sunset-up
- name: "Mein_Sonnenuntergang"
unique_id: "my_next_sunset"
state: '{{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom("%H:%M")}}'
icon: mdi:weather-sunset-down
Allerdings sollte es heutzutage in HA so aussehen, deine Syntax oben ist veraltet: Template - Home Assistant
template:
- sensor:
- name: "Mein_Sonnenaufgang"
unique_id: "my_next_sunrise"
state: '{{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom("%H:%M")}}'
icon: mdi:weather-sunset-up
- name: "Mein_Sonnenuntergang"
unique_id: "my_next_sunset"
state: '{{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom("%H:%M")}}'
icon: mdi:weather-sunset-down
LvS21
3
Du könntest auch darüber nachdenken, die Sensoren nicht mehr in der configuration.yaml einzutragen, sondern per GUI anzulegen:
Gruß, Lars
Misux
4
Habe jetzt mal meine komplette syntax angepasst, und irgendwie habe ich mir meine 4 binary.sensoren kaputt gemacht…
Was hab ich denn nun wieder verbrochen?
Hier die Ganze config.yaml:
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
extra_module_url:
- /homeassistant/www/community/lovelace-card-mod/card-mod.js
- /homeassistant/www/community/custom-brand-icons/custom-brand-icons.js
- /homeassistant/www/community/ha-knx-uf-iconset/ha-knx-uf-iconset.js
- /homeassistant/www/community/hass-hue-icons/hass-hue-icons.js
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
usb:
template:
- binary_sensor:
adventszeit:
friendly_name: "Adventszeit"
value_template: >
{% set today = now() %}
{% set first_advent = today.replace(day=25, month=12) - timedelta(days=21 + today.replace(day=25, month=12).isoweekday()) %}
{{ first_advent <= today <= today.replace(day=31, month=12) or today <= today.replace(day=6, month=1) }}
- binary_sensor:
montagnachtotensonntag:
friendly_name: "MontagNachTotenSonntag"
value_template: >
{% set today = now() %}
{% set totensonntag = today.replace(day=25, month=12) - timedelta(days=27 + today.replace(day=25, month=12).isoweekday()) %}
{{ totensonntag <= today <= today.replace(day=31, month=12) or today <= today.replace(day=6, month=1) }}
- sensor:
adventszeit_start_date:
friendly_name: "Adventszeit Start Datum"
value_template: >
{% set today = now() %}
{% set first_advent = today.replace(day=25, month=12) - timedelta(days=21 + today.replace(day=25, month=12).isoweekday()) %}
{% set first_advent_date = first_advent.strftime('%d-%m-%Y') %}
{{ first_advent_date }}
- sensor:
totenmontag_start_date:
friendly_name: "Totenmontag Start Datum"
value_template: >
{% set today = now() %}
{% set totenmontag = today.replace(day=25, month=12) - timedelta(days=27 + today.replace(day=25, month=12).isoweekday()) %}
{% set totenmontag_date = totenmontag.strftime('%d-%m-%Y') %}
{{ totenmontag_date }}
- sensor:
- name: "Mein_Sonnenaufgang"
unique_id: "my_next_sunrise"
state: '{{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom("%H:%M")}}'
icon: mdi:weather-sunset-up
- sensor:
- name: "Mein_Sonnenuntergang"
unique_id: "my_next_sunset"
state: '{{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom("%H:%M")}}'
icon: mdi:weather-sunset-down
UNd das sind meine defekten binary. sensoren die ich auf einem Dashboard eingebunden. hatte…
73ymw
5
Muss sicher heißen
template:
- binary_sensor:
- name: "adventszeit"
friendly_name: "Adventszeit"
value_template: >
{% set today = now() %}
{% set first_advent = today.replace(day=25, month=12) - timedelta(days=21 + today.replace(day=25, month=12).isoweekday()) %}
{{ first_advent <= today <= today.replace(day=31, month=12) or today <= today.replace(day=6, month=1) }}
usw. Siehe: Template - Home Assistant