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!
jimtng
(jimtng)
September 12, 2023, 1:32am
2
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 - Thank you Jim - Spock out!
2 Likes
vons
(Vons)
August 24, 2024, 6:32am
4
Wow. can you teach me how do you setup this?
jimtng
(jimtng)
August 24, 2024, 6:59am
5
Hi @vons , welcome to openhab!
Which part specifically do you need help with?