I am trying to get the temperature sensor reading from HA through Snips
my sensors have two variables most of them DHT11 on ESP8266 using esphomelib. my snips intent is
it would be helpful, if you managed not only to format the json code, but also the yaml code correctly (see hint at top of every forum page), so that one can see the indentation of your code. this is the intent_script that helps me determine the sensors that i’d like snips to read out loud.
intent_script:
innenTemperaturIntent:
action:
- service: mqtt.publish
data_template:
topic: "devices/led-matrix/light/print/set"
payload: '{{ states("sensor." + room.replace("ü", "ue") + "_temperaturx") }} C'
speech:
type: plain
text: >
{% if site_id == "ivan" %}
{% set room = room | default('kinderzimmer') | replace("ü", "ue") |replace("ä", "ae") |replace("ö", "oe") | lower %}
{% else %}
{% set room = room | default('kueche') | replace("ü", "ue") |replace("ä", "ae") |replace("ö", "oe") | lower %}
{% endif %}
{% if room == 'hier' and site_id == 'ivanka' %}
{% set room = "kueche" %}
{% elif room == 'hier' and site_id == 'ivan' %}
{% set room = "kinderzimmer" %}
{% endif %}
{% if room != 'wohnung' %}
Die Temperatur {{ room }} ist
{{ states("sensor." + room.replace("ü", "ue") + "_temperaturx") }}
Grad,
{% if room != 'server' and room != "serverraum" and room != 'balkon' and room != 'hof' %}
Die Luftfeuchtigkeit beträgt
{{ states("sensor." + room.replace("ü", "ue") + "_luftfeuchtigkeitx") }}
Prozent.
{% endif %}
{% if room == 'balkon' or room == "hof" %}
{{ [
"Der Wetterdienst misst die Aussentemperatur derzeit mit ",
"Das Internet sagt, Aussen sei es ",
"Offiziell sind draussen ",
"Andere Wetterstationen messen derzeit "
] | random }}
{{ states("sensor.dark_sky_temperature") | round(0) }}
Grad.
{% endif %}
{% endif %}
{% if room == 'wohnung' %}
Die Durchschnittstemperatur in der Wohnung beträgt
{{ states("sensor.wohnung_temperaturx") }}
Grad, die durchschnittliche Luftfeuchtigkeit liegt im Moment bei
{{ states("sensor.wohnung_luftfeuchtigkeitx") }}
Prozent.
{% endif %}
the probable cause for your „unknown“ is that you don’t have an entity id called sensor.{{Location}}_{{Device}}. it should be something like this (assuming the intent returns both slots values Location and Device):
Hi @diplix
Thanks for your reply and that really helped.
Sorry for wrong formatting as this was my first post, I will ensure correct formatting going further.
Somehow, I am not able to get to the correct documentation and being a firmware and Linux device driver engineer have very poor hands on YAML and Python. Can you please point me to the correct documentation.
great, glad i could help. the normal HA-documentation is pretty good for basic yaml and template (jinja2) configuration. however most of the stuff i implemented i learned here in the community. there is a lot of tricky stuff you can do with jinja — and a lot of restrictions, too. but i found answers to almost all questions i ran into here in the community.