Giter Club home page Giter Club logo

Comments (5)

acockburn avatar acockburn commented on July 26, 2024

Hi there - that's about as good as you can get with current functionality - unlike listen_state(), listen_event() is pretty simple, it responds to the named event and hands the data over.

This is partly because I haven't had a more complex usecase - I use custom events myself, but only in a simple way. However, there is no reason I couldn't expand it to handle the usecase of listening for specific attributes as is possible in listen_state() - to be somewhat consistent with listen_state() I would probably do something like:

self.listen_event(self.cycle_scene, 'zwave.scene_activated', attribute="scene_id", value=self.scene_id)

Does that sound like it would work?

FWIW, I have a minimote too but haven't gone through the hassle of setting it up for HA yet, so maybe I will do so so I can test this feature :)

from appdaemon.

cmsimike avatar cmsimike commented on July 26, 2024

That sounds perfect! Thank you very much :D

from appdaemon.

acockburn avatar acockburn commented on July 26, 2024

OK, I will add it to the list, but for now you have a working setup :)

from appdaemon.

acockburn avatar acockburn commented on July 26, 2024

Got my minimote working and I have added filtering to the listen state call - it has info in the API file but here are a couple of examples of what I ended up with:

Listen for a minimote event activating scene 3:

self.listen_event(self.generic_event, "zwave.scene_activated", scene_id = 3)

Listen for a minimote event activating scene 3 from a specific minimote:

self.listen_event(self.generic_event, "zwave.scene_activated", entity_id = "minimote_31", scene_id = 3)

I am calling these "event filters" and you can use them to filter for any arguments in any event.

I am just about to push the release with this in - 1.3.3.

from appdaemon.

cmsimike avatar cmsimike commented on July 26, 2024

Thank you so much for this! (Sorry for the delay - circling back to automation stuff now).
Looking forward to cleaning up the code I have.

from appdaemon.

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.