Have Alexa TTS read an Item State

I am trying to have Alexa read a current item state with the RULE engine

configuration: {}
triggers:

  • id: “1”
    configuration:
    itemName: BlueIris_Alarm_BlueIris_Alarm
    type: core.ItemStateUpdateTrigger
    conditions: []
    actions:
  • inputs: {}
    id: “2”
    configuration:
    itemName: Evelins_Echo_Dot_Speak
    command: (BlueIris_Alarm_BlueIris_Alarm.state)
    type: core.ItemCommandAction

it doesnt READ the actual state of the Item called BlueIris_Alarm_BlueIris_Alarm but says what is written in the command line word for word.

i want it to say the actual state which is currently - “Entrance” “person:89%”

so when the new Mqtt string comes from Blue Iris about which camera triggered and what type of trigger i can hear it trough alexa

And what if that item state was a number not a string… what would the command be then

THANKS!

You might have to use a script to do it.
Example with JRuby (you’d need to install the jruby automation addon):

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: BlueIris_Alarm_BlueIris_Alarm
    type: core.ItemStateUpdateTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/x-ruby
      script: Evelins_Echo_Dot_Speak.command(event.state)
    type: script.ScriptAction

PS You should format yaml / other code using code fences when posting it on this forum, to preserve their indentation and special characters.

It will still work, with the number converted to string automatically. If you want to format it a certain way, e.g. to specify a fixed number of decimals, you can do that too, e.g.

Evelins_Echo_Dot_Speak.command(event.state) # Works for numeric states too

Evelins_Echo_Dot_Speak.command(event.state.format("%.2f")) # This ensures 2 decimal points

this is nearing some TNG type equipment :)… not yet replicators… but close :slight_smile: - Thank you Jim - Spock out!

1 Like