Sensor/helper vs automation

Hello all - trying to develop a work-around for my shutters that have an Amazon skill and no HA integration. I know I could probably adopt them directly into the HA but I’d lose the Amazon skill and the wall mount (vendor provided) systems/features.

I have scripts that work fine. I can call them with automation scripts but I’d like to use a sensor instead. So when the script fires, it would update the sensor to whatever state (on/off) or the input.boolean would fire the script (open/close.)

For instance, I have created an input.boolean and I want to trigger a script for opening and a script for closing. This way my Lovelace card will show the state. See below:

I would also like to put everything in either the template.yaml or sensor.yaml file to keep everything easy to maintain. I will have to do this for 10-12 shutters.

I know I can do this with automations but it seems kludgy. Maintenance could be an issue as well.

Is this doable? Something like this?

binary_sensor:
  - platform: template
    sensors:
      rolladen_main:
        friendly_name: Main Floor Rolladen
        device_class: shutter
        value_template: >- 
          {% if is_state('input_boolean.Main_Rolladen', 'true') %}
          service: script.open_main_front
          {% else %}
          service: script.close_main_front
          {% endif %}
        icon_template: >-
          {% if is_state("input_boolean.Main_Rolladen", "true") %}
          mdi:shutter
          {% else %}
          mdi:shutter-closed
          {% endif %}

Please share any code or config that you have (correctly formatted) to help us better understand what you have.

I don’t quite follow how you’re using automations in this case.

Are you saying your automation triggers on the input boolean? How are you keeping this helper’s state in sync with the blind, especially if it can be opened or closed outside of HA?

Have you considered creating template cover for your blinds? I think the first step is to have an entity that HA understands.

You should look into packages instead.

Thanks - I will look into the template cover. I don’t think it will work tho. I can’t really keep the sensors in-sync since they are only from an Alexa Skill that is linked to my Alexa account. I use scripts like this open and close

alias: Open Main Front
sequence:
  - service: media_player.play_media
    data:
      media_content_type: custom
      media_content_id: turn on Main Front
    target:
      device_id: 642b8822a71247658a159c2d4af012f2
mode: single
icon: mdi:window-shutter-auto

This is my automation to open the shutter:

alias: Rolladen - Main Open Trigger
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.main_rolladens
    from: "off"
    to: "on"
condition: []
action:
  - service: script.open_main_front
    data: {}
mode: single

Also if you describe the exact system people can tell you if that’s ACTUALLY the case most of the time it’s not either/or and may save you a huge effort in workaround. Worth checking.

This is a Merten system (Schneider Electric now) which uses a Wiser Home Touch display hub/panel. I’ve previously checked and there is zero support for this in Home Assistant. There is a HACS integration for a similar device but is incompatible.

There is an Amazon Skill provided by Merten which allows me to use scripts to issue commands via the media player above.

As mentioned above - I’m trying to use some sort of sensor so that I can sort of display the current state (open or closed) and give a “button” to trigger the script to open or close.

Maybe a binary sensor?

When you say “script” here do you mean an Alexa routine?

You can launch routines from HA, but Alexa only recognises a very small number of binary entity types for use in the “When this happens” section at the beginning (currently I think, input_booleans, contact sensors and switches). They have to be exposed to Alexa in HA, of course, and for some reason they are all represented in the Alexa app as contact sensors.

So you can launch an Alexa skill that is unrelated to HA with an input_boolean on a dashboard, for example. You can make announcements, play music etc. etc. - basically execute any Alexa actions that are available to routines

You can’t control them from the HA end, though - you’re limited to launching them. So to turn something on and off you would need an input_boolean on your dashboard and two routines in the Alexa app, one launched by it turning on and one launched by it turning off.

You can launch HA scripts from Alexa, of course, so your routine can combine, say, turning on a device that has no HA integration with performing some activity on devices that are integrated.

In the meantime, Schneider sent me a new hub. Works perfectly with the Drayton integration so I don’t have to try and reinvent the wheel here.

Thanks for everyone’s help/advice.