MQTT binary sensor and Alexa announce workaround with ISY

Hi all. I have a few Insteon light switches, some outlets, 1 motion and 2 door sensors, leak detectors etc… I use an ISY994i automation controller with them and have them integrated with Amazon Alexa. I recently discovered Home Assistant and mainly wanted it as a nice front end/phone app. But I’ve been so impressed with all of the integrations, I’ve added Unifi presence, Tuya outlets, 2 Sonoffs, and still going. I’ve almost finished a project with a nodemcu to get status of 4 doors and 3 motions from an old DSC alarm system.
1 thing that I was disappointed with, was that even though Alexa can see the sensors exposed by HA, and an Alexa routine can see them, routines based on those sensors don’t seem to work. Apparently, other Alexa integrations, other than ISY have these issues too. So until the Alexa integration resolves that issue, I plan to use the ISY as a workaround. I did see some scripts in another thread that can work around the issue but thought I’d go this route.
I can create state variables on the ISY, that appear to Alexa as either motion or contacts, and will work with Alexa routines. These variables can be set by Home assistant automations, or perhaps right from the nodemcu code. A simple rest command to the ISY will set the variables.
For anyone who has an ISY, and is interested, here’s what I’m planning.
Create state variables on the ISY for front_door, basement_motion etc.
Note the variable IDs on the ISY.
In the nodemcu code, or HA automation, upon state change, send a rest command to the ISY.
For example my front door state variable ID is 11.

curl -X GET http://uname:passwd@isyaddress/rest/vars/set/2/11/1

Where the /2 is a state variable (I assume 1 is an integer variable, have never used one) 11 is the variable ID, and 1 is the state.
From the ISY portal expose the variable(s) and choose whether they’re contacts or motion.
The have Alexa discover devices.
Now create an Alexa routine, choose device, locate the state variable name, and choose your action, like Annouce “Front door open”

2 Likes

Thanks for this idea. It is allowing me to bypass Alexa Media Player entirely for announcements. This has some advantages, the big one being that you will not lose your announcement capabilities every time that Alexa Media Player loses it’s authentication (which happens every couple weeks for me, and which is why I’m moving my Alexa announcements over to this method). The downside is that it’s quite a bit more configuration to do and you need Nabu Casa or the Alexa Custom Skill set up, and you cannot use dynamic text, it has to be a fixed message…
Some nice fellow pointed out this possibility to me on Facebook and I really like that my TTS announcements are no longer subject to the frequent reauthentication whims of Alexa Media Player after implementing this, so I thought I would share a guide.

In case someone else wants to do this:

first make a very simple script with no actions as a tag for the announcement you want to make:

script:
  announce_dishes_are_clean:
    sequence:

Then make a template binary)sensor which reads the on/off value of the script and converts it into a motion sensor:

binary_sensor:
  - platform: template
    sensors:
      announce_dishes_are_clean:
        device_class: motion
        value_template: "{{ states.script.announce_dishes_are_clean.state == 'on' }}"

Then you will need to sync your alexa entities in the nabu casa configuration (ensure that you have binary_sensors set to sync or at least the individual sensor you are adding).
image

and and turn on the option to sync the entity states

then you will need to create a matching routine in the alexa app to actually read out the announcement when it sees the state change of our dummy movement sensor:

You can now test to see if it works in the developer tools. If it does, you should hear your announcement:

Then you can use it as a service call in your automations and never worry about reauthentication of Alexa Media breaking it again:

- id: kitchen_bar_alexa_notify_clean_dishes
  alias: "TTS Notify Clean Dishes to Kitchen Bar Alexa"
  initial_state: 'true'
  trigger:
    platform: state
    entity_id: sensor.bosch_dishwasher_door
    to: 'open'
  condition:
    condition: and
    conditions:
      - condition: template
        value_template: '{{ (as_timestamp(now()) - as_timestamp(states.automation.fire_notify_clean_dishes.attributes.last_triggered | default(0)) | int > 150)}}'
      - condition: or
        conditions:
          - condition: state
            entity_id: input_select.bosch_dishwasher_status
            state: 'Clean'
          - condition: state
            entity_id: input_select.bosch_dishwasher_status
            state: 'Emptying'
  action:
    - service: script.announce_dishes_are_clean