-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to listen for scenes activations? #2
Comments
Hi @thundergreen, That event filter is not possible with the current version, because of the sub-filtering you need (filter events with a nested dict inside, like I will try to make a fix for that kind of situation. The sensor aimed to filter simple events with just specific key: value pairs inside. To filter "call_service" for specific service_data, fine-grained filtering is needed. Also, I just discovered a bug in the event filter: In
it should use <= , not < . I will also fix that.
|
@thundergreen, with the changes I'm doing right now, it will be possible to do what you want :) In your case, the yaml would be: sensor:
# Sensor to retain the last time a specific scene is turned on
- platform: eventsensor
name: Last activation
event: call_service
state: service_data.entity_id
event_data:
domain: scene
service: turn_on
service_data:
entity_id: scene.evening_light
# Sensor to retain the last activated scene, with custom mapping for pretty states
- platform: eventsensor
name: Last scene
event: call_service
state: service_data.entity_id
event_data:
domain: scene
service: turn_on
state_map:
scene.evening_light: Evening
scene.afternoon_light: Afternoon
scene.other: Other scene
# ... The 1st sensor would look only to that specific scene, the 2nd one would update for any scene being turn_on, showing the scene as state. I suppose the 2nd one is more useful, right? BTW, thanks for your input here, this usage suggestion opens new possibilities for this sensor as a very useful debug helper. Wait a bit for the next release, which enables UI configuration (and no more HA restarts) and makes this possible. |
HI Eugenio, also, seems to be getting close to what I use the CC variable for: recording the last motion in the house. Would an event like a motion sensor turning on be possible to record using your eventsensor? and store the in the history? currently using:
|
Hi @Mariusthvdb, No, I don't think it would be a good usage. In fact, you are confusing terms there. A motion sensor turning on is not an HA event. It is a state change. Another thing is that any entity state change fires a What you have there is too complex for my taste :) |
yes it works right now, and has been for almost 3 years.. I was indeed thinking of the state_changed event, not so much the state change itself. a template sensor isn't sufficient as that cant record the history in its attributes, like this: was merely thinking your new eventsensor could catch this too, and maybe allow to leave the CC Variable, since that isn't updated in a long long time, and your CC is brand new, keeping up with the latest of developments ;-) Must admit I have no idea how this could be done in Appdaemon. |
cc @Mariusthvdb
You're welcome :) Check this commit: azogue/hassio_config@e212999 |
magic! I'll enable recorder on the sensor. thank you very much! this is so cool, and very very immediate. hugely impressed. I have 1 other automation using the CC variable, and immediately started to check if I could easily rebuild the last_motion to use my daylight variables, but am lost... If you have would have another spare moment, might I kindly ask you to have a look at this, and see if AD can handle that too. Don't feel any pressure what so ever, don't want to impose.
|
cc @Mariusthvdb
Too much Marius, don't overdo it. With what I showed to you I think it is sufficient, you should be capable of continuing from it. Also, big off-topic here. |
Thanks a lot @azogue that sensor extends my possibilities in automations a lot |
I have an idea where i need to create a sensor once a scene has been activated. Using the even call-service gives me this nice piece of code:
Can i Use this also for the sensor and if how? :) Would highly be interested as THIS was exactly what I was looking for some days ogo :)
The text was updated successfully, but these errors were encountered: