Coder Social home page Coder Social logo

Comments (6)

samvanh avatar samvanh commented on May 13, 2024 1

Ok. In that case, you can close this FR.

For whoever's interested, this is the script I use to ring a siren + announce which sensor triggered the alarm:

alias: Alarm Siren
sequence:
  - service: media_player.play_media
    data:
      media_content_type: sound
      media_content_id: amzn_sfx_scifi_alarm_04
      entity_id: media_player.echo_downstairs
    entity_id: media_player.echo_downstairs
  - service: notify.alexa_media_downstairs
    data:
      title: Intruder Alert!
      message: >
        Intruder Alert! 
        {% for open_sensor in state_attr("alarm_control_panel.alarmo", "open_sensors").keys() |list %}
          at {{ state_attr(open_sensor, 'friendly_name') }}
        {% endfor %}
      data:
        method: all
        type: announce
      target:
        - media_player.echo_downstairs
mode: single

(it kinda assumes that usually, only 1 sensor will trigger the alarm. In the case of 2 sensors it will say 'Intruder alert at sensor 1 at sensor 2')

from alarmo.

nielsfaber avatar nielsfaber commented on May 13, 2024

If you want to create a script, then you can also get the friendly name from the entity properties.
I mean states('binary_sensor.my_sensor') will give you all info of the sensor.
Why do you think such properties should be published by Alarmo?

from alarmo.

samvanh avatar samvanh commented on May 13, 2024

I think the reporting of {{open_sensors}} as a friendly-name array would allow the creation of more powerful scripts than what is currently possible in the Alarmo -> Actions page.

My use case is:
On alarm trigger -> script to play siren on smart speakers + then announce which sensor triggered the alarm.
The script works very well but doesn't have easy access to the friendly name of the sensor that triggered the alarm.
A workaround for me is to create a template sensor that translates the {{open_sensors}} array into the friendly names but it's not very elegant.

When I try to copy-paste my working script into the Alarmo -> Actions -> yaml editor, I cannot save because it's triggering some errors.

from alarmo.

nielsfaber avatar nielsfaber commented on May 13, 2024

IMO only the entity_id + state is relevant info for the trigger event.
You can easily get all the details you want about the sensors by requesting the state of the entity.
Please check out here: https://www.home-assistant.io/docs/configuration/templating/#states-examples

I'd rather put effort into improving the editor such that it will work with your smart speaker without external scripts.

from alarmo.

samvanh avatar samvanh commented on May 13, 2024

Just to add: Love your custom component! Don't let feature requests etc be anything else than a compliment for the already existing features! Keep up the great work

from alarmo.

github-actions avatar github-actions commented on May 13, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

from alarmo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.