Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95414

Help adding sensor data to an alexa script with random text

$
0
0

@Rdoull wrote:

hi all,

I’ve reciently found a video on youtube from 3ative showing how to get alexa to respond with random phrases put into a script. he also showed how to add a fixed message with sensor data.

what I am trying to do is mix those two… I want to add sensor data to some random phrases.

mabe the script will help understand…

this works in giving me random phrases made from the two blocks…

alias: Testing speach script
sequence:
  - service: notify.alexa_media
    data_template:
      target:
        - "{{ states.sensor.last_alexa.state }}"
      data:
        type: tts
      message: '{{
        [
        "The temerature in this room is.. ",
        "This room is currently.. ", 
        "If I was to guess, I would say the room was.. ",
        "Let me check.. Hmm.. I would say.. it is.. ",
        "Let me check with Roxy.. Hmm.. shes not talking to me.. I dunno, maybe.. ",
        ]|random +
        
        [
        "Celsius.. WOW.. Ive known polar bears to freeze in temperatures higher than that. ",
        "Celsius.. But that is only a guess",
        "Celsius.. I hope that answers your question. ",
        "Celsius.. Wow!.. that is almost as hot as the surface of the sun. ", 
        "Celsius.. Mmmm.. thats a nice cosy temperature, dont you think? ",
        ]|random}}'

But when I try to add the sensor it gives me errors…

alias: Testing speach script
sequence:
  - service: notify.alexa_media
    data_template:
      target:
        - "{{ states.sensor.last_alexa.state }}"
      data:
        type: tts
      message: '{{
        [
        "The temerature in this room is.. ",
        "This room is currently.. ", 
        "If I was to guess, I would say the room was.. ",
        "Let me check.. Hmm.. I would say.. it is.. ",
        "Let me check with Roxy.. Hmm.. shes not talking to me.. I dunno, maybe.. ",
        ]|random +

        {{states('sensor.bedroom_temperature')}}, +
        
        [
        "Celsius.. WOW.. Ive known polar bears to freeze in temperatures higher than that. ",
        "Celsius.. But that is only a guess",
        "Celsius.. I hope that answers your question. ",
        "Celsius.. Wow!.. that is almost as hot as the surface of the sun. ", 
        "Celsius.. Mmmm.. thats a nice cosy temperature, dont you think? ",
        ]|random}}'

as is probably clear I have no idea what I am doing, but I’m hoping someone can help me to understand and point me in the correct direction.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95414

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>