Say state on an entity

Hi

I need google home to tell me the state on my window, but it tells my the state on/off not open/closed


- id: '1586112057634'
  alias: google cloud say
  description: ''
  trigger:
  - at: '10:00:00'
    platform: time
  condition: []
  action:
  - data_template:
      entity_id: media_player.nest_hub
      message: vinduet i stuen er, {{ states('binary_sensor.stort_vindue') }}
    service: tts.google_cloud_say

I did set the device type to window, and it shows correct in Lovelace

    - id: 83034
        name: Stort vindue
        inverting: true
        note: Magnet contact
        position: Stue manget i vindue
        type: window

That’s how it works - Lovelace takes care of representing states in a human-friendly way but if you paste this in Developer tools -> Templates

{{ states('binary_sensor.stort_vindue') }}

you’ll see the real state.

so in your case, the easiest way is to change your message template

message: >
  vinduet i stuen er,
  {% set state = states('binary_sensor.stort_vindue')|lower %}
  {% if 'on' in state %} open
  {% elif 'off' in state %} closed
  {% else %} {{ state }}
  {% endif %} 

Thanks for a quick answer.

I will test it.