sensor - attribute_template - Property is not allowed Thema ist als GELÖST markiert
- PX80
- Beiträge: 589
- Registriert: Do 21. Okt 2021, 13:09
- 2
- Has thanked: 63 times
- Been thanked: 16 times
sensor - attribute_template - Property is not allowed
Irgendwie komm ich nicht ganz klar mit YAML und deren Aufbau. Ich wollte gerade das Beispiel des Müllkalenders nachbauen
Siehe: viewtopic.php?p=609#p609
bekomme aber folgenden Fehler:
Siehe: viewtopic.php?p=609#p609
bekomme aber folgenden Fehler:
- Osorkon
- Administrator
- Beiträge: 1972
- Registriert: Sa 17. Jul 2021, 16:53
- 2
- Wohnort: Langenargen
- Has thanked: 61 times
- Been thanked: 539 times
- Kontaktdaten:
Re: sensor - attribute_template - Property is not allowed
Kannst Du bitte mal den Code als Code formatiert hier posten?
Danke und Gruß
Osorkon
Danke und Gruß
Osorkon
Einer muss ja für Ordnung sorgen.
- PX80
- Beiträge: 589
- Registriert: Do 21. Okt 2021, 13:09
- 2
- Has thanked: 63 times
- Been thanked: 16 times
Re: sensor - attribute_template - Property is not allowed
seltsam, nach einem StudioCodeServer Update, steht jetzt "Property platform not allowed".
Ich habe mir noch den FileEditor geladen und da sieht alles gut aus OHNE Fehler.
Jedoch ist der Sensor - auch nach einem neustart - nicht verfügbar
Code: Alles auswählen
- platform: template
sensors:
restabfall:
friendly_name: Restabfall
value_template: >
{{ as_timestamp(state_attr("calendar.calendar.abfallkalender", "start_time")) | timestamp_custom('%d.%m.%Y') }}
icon_template: >-
{% if state_attr('sensor.restabfall', 'days_left') == 0 %}
mdi:delete-empty
{% else %}
mdi:delete-outline
{% endif %}
attribute_templates:
weekday: >
{{ as_timestamp(state_attr("calendar.calendar.abfallkalender", "start_time")) | timestamp_custom('%w') }}
text: >
{% if state_attr('sensor.restabfall', 'days_left') == 0 %}
Heute
{% elif state_attr('sensor.restabfall', 'days_left') == 1 %}
Morgen
{% else %}
in {{ state_attr('sensor.restabfall', 'days_left') }} Tagen
{% endif %}
color: >
{% if state_attr('sensor.restabfall', 'days_left') == 0 %}
color="#ff6347"
{% elif state_attr('sensor.restabfall', 'days_left') == 1 %}
color="#ffae00"
{% endif %}
days_left: >
{{ ((as_timestamp(state_attr("calendar.calendar.abfallkalender", "start_time"))-as_timestamp(states.sensor.date.state+' '+'00:00:00')) / 86400) | int }}
Jedoch ist der Sensor - auch nach einem neustart - nicht verfügbar
-
- Beiträge: 93
- Registriert: So 9. Jan 2022, 22:42
- 2
- Has thanked: 7 times
- Been thanked: 10 times
Re: sensor - attribute_template - Property is not allowed
Hallo
ist bei mir gleich, funktioniert aber alles trotzdem wie es soll....
auf Github wurde der Bug schon angezeigt, ne Lösung gibts aber noch nicht...
Warten wir ab.
ist bei mir gleich, funktioniert aber alles trotzdem wie es soll....
auf Github wurde der Bug schon angezeigt, ne Lösung gibts aber noch nicht...
Warten wir ab.
- Friedi
- Beiträge: 449
- Registriert: Do 22. Jul 2021, 16:57
- 2
- Has thanked: 37 times
- Been thanked: 22 times
- Friedi
- Beiträge: 449
- Registriert: Do 22. Jul 2021, 16:57
- 2
- Has thanked: 37 times
- Been thanked: 22 times
Re: sensor - attribute_template - Property is not allowed
Mit Kommandozeile kann ich leider nicht dienen...
- Friedi
- Beiträge: 449
- Registriert: Do 22. Jul 2021, 16:57
- 2
- Has thanked: 37 times
- Been thanked: 22 times
Re: sensor - attribute_template - Property is not allowed
Nur mal so, ist weekday wirklich ein Attribut? Es gibt die Funktion weekday(). Vielleicht gibt es da ein Problem wegen der Funktion.
- PX80
- Beiträge: 589
- Registriert: Do 21. Okt 2021, 13:09
- 2
- Has thanked: 63 times
- Been thanked: 16 times
Re: sensor - attribute_template - Property is not allowed
ich dachte das attribute wird damit angelegt oder muss es ein vorhandes attribute vom Kalender sein auf welchen sich der Sensor bezieht?
- Friedi
- Beiträge: 449
- Registriert: Do 22. Jul 2021, 16:57
- 2
- Has thanked: 37 times
- Been thanked: 22 times
Re: sensor - attribute_template - Property is not allowed
Falsch verstanden. Vielleicht gibt es reservierte Namen.
Kurz: Ich weiß es nicht.
Aber: Studio Code hat derzeit Bugs, Was zählt ist der File Editor, nur hat der halt nicht unbedingt die entsprechenden Hinweise. Syntaktisch scheint dein Code ja zu passen.
Kurz: Ich weiß es nicht.
Aber: Studio Code hat derzeit Bugs, Was zählt ist der File Editor, nur hat der halt nicht unbedingt die entsprechenden Hinweise. Syntaktisch scheint dein Code ja zu passen.
- Friedi
- Beiträge: 449
- Registriert: Do 22. Jul 2021, 16:57
- 2
- Has thanked: 37 times
- Been thanked: 22 times
Re: sensor - attribute_template - Property is not allowed
Gerade noch was entdeckt. Lies mal diesen Thread: https://community.home-assistant.io/t/a ... ore/334868
- PX80
- Beiträge: 589
- Registriert: Do 21. Okt 2021, 13:09
- 2
- Has thanked: 63 times
- Been thanked: 16 times
Re: sensor - attribute_template - Property is not allowed
Es fehlen mir die Beispiele für mein YAML Layout. Ich versteh die Zusammensetzung im gesamten nicht .. also platform/template/sensor kombination
- Friedi
- Beiträge: 449
- Registriert: Do 22. Jul 2021, 16:57
- 2
- Has thanked: 37 times
- Been thanked: 22 times
Re: sensor - attribute_template - Property is not allowed
Ausgehend von diesem Beispiel:
würde ich das mal so testen:
Die Referenz steht ja auch da: https://www.home-assistant.io/integrati ... te-sensors
Code: Alles auswählen
template:
- sensor:
- name: "Sun Angle"
unit_of_measurement: "°"
state: >-
{{ '%.1f'|format(state_attr('sun.sun', 'elevation')) }}
attributes:
temp: >-
{{ '%.1f'|format(state_attr('sun.sun', 'elevation')) }}
Code: Alles auswählen
template:
- sensor:
- name: "restabfall"
state: >-
{{ as_timestamp(state_attr("calendar.calendar.abfallkalender", "start_time")) | timestamp_custom('%d.%m.%Y') }}
attributes:
weekday: >-
{{ as_timestamp(state_attr("calendar.calendar.abfallkalender", "start_time")) | timestamp_custom('%w') }}
text: >-
{% if state_attr('sensor.restabfall', 'days_left') == 0 %}
Heute
{% elif state_attr('sensor.restabfall', 'days_left') == 1 %}
Morgen
{% else %}
in {{ state_attr('sensor.restabfall', 'days_left') }} Tagen
{% endif %}
color: >-
{% if state_attr('sensor.restabfall', 'days_left') == 0 %}
color="#ff6347"
{% elif state_attr('sensor.restabfall', 'days_left') == 1 %}
color="#ffae00"
{% endif %}
days_left: >-
{{ ((as_timestamp(state_attr("calendar.calendar.abfallkalender", "start_time"))-as_timestamp(states.sensor.date.state+' '+'00:00:00')) / 86400) | int }}
- PX80
- Beiträge: 589
- Registriert: Do 21. Okt 2021, 13:09
- 2
- Has thanked: 63 times
- Been thanked: 16 times
Re: sensor - attribute_template - Property is not allowed
bekomme leider damit ein fehler nach dem neustart
Invalid config
The following integrations and platforms could not be set up:
sensor
Please check your config and logs.
Invalid config for [sensor]: required key not provided @ data['platform']. Got None. (See /config/configuration.yaml, line 12).
In configuration.yaml
Invalid config
The following integrations and platforms could not be set up:
sensor
Please check your config and logs.
Invalid config for [sensor]: required key not provided @ data['platform']. Got None. (See /config/configuration.yaml, line 12).
In configuration.yaml
Code: Alles auswählen
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include sensor.yaml
- Friedi
- Beiträge: 449
- Registriert: Do 22. Jul 2021, 16:57
- 2
- Has thanked: 37 times
- Been thanked: 22 times
Re: sensor - attribute_template - Property is not allowed
Das ist klar.
Das ist ein Template und kein Sensor. Der Code (von mir) darf nicht in deine Sensor.yaml, sondern muss so in die config.yaml.
Das ist ein Template und kein Sensor. Der Code (von mir) darf nicht in deine Sensor.yaml, sondern muss so in die config.yaml.
- PX80
- Beiträge: 589
- Registriert: Do 21. Okt 2021, 13:09
- 2
- Has thanked: 63 times
- Been thanked: 16 times
Re: sensor - attribute_template - Property is not allowed
wie kann ich dann templates auslagern? dachte es sind nur externe dateien mit x-beliebigen namen um die config nicht zuzumüllen
PS: funktioniert nun. wie bekomm ich das ausgelagert?
PS: funktioniert nun. wie bekomm ich das ausgelagert?
- Friedi
- Beiträge: 449
- Registriert: Do 22. Jul 2021, 16:57
- 2
- Has thanked: 37 times
- Been thanked: 22 times
Re: sensor - attribute_template - Property is not allowed
Ich habe das bei mir so gemacht:
Code: Alles auswählen
template: !include_dir_merge_named template