Skip to content
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

Feature request: Implement contexts #96

Closed
nagyrobi opened this issue Apr 20, 2022 · 1 comment
Closed

Feature request: Implement contexts #96

nagyrobi opened this issue Apr 20, 2022 · 1 comment

Comments

@nagyrobi
Copy link
Collaborator

nagyrobi commented Apr 20, 2022

Is your feature request related to a problem? Please describe.
Home Assistant supports contexts for states, to determine what caused them.

In the example below, the switch was turned off from an OpenHASP plate, and was turned on from Lovelace dashboard:

kép

Yes, the lovelace dashboard requires an user to be logged in, to display a nice username, however, contexts can also use a parent_id to be used when entities change states from automations, scripts, etc.

The goal is not only to have this information displayed, but also to determine within HA from which plate came the change and take automation actions taking that in consideration. Often use cases inclue automations which need to know if the state of an entity was previously changed by a user or by another automation/script.

kép

Describe the solution you'd like
Since the username is not relevant anways when standing in front of the plate and switching entities, it would be very useful to at least know which plate initiated the state change. Use plate's slug for that.

Describe alternatives you've considered
Eventually we could create dummy usernames for each plate just for the purpose of display, and have a parameter set in the yaml of the plate to specify the user_id of it to set the context accordingly - and have them displayed nicely.

Additional context
https://community.home-assistant.io/t/work-with-triggered-by-in-automations/400352/7
https://community.home-assistant.io/t/is-it-possible-to-know-when-physical-button-is-pressed/327397/8

akloeckner added a commit to akloeckner/openHASP-custom-component that referenced this issue Aug 8, 2023
This upgrades the current "list of services" restriction to allow the full syntax of HA scripts.

fixes HASwitchPlate#65

As a side-effect this also requires to generate a context for the script to run.

see HASwitchPlate#96

This can also be seen as a preparatory step to allow defining HASPObject-wide variables.

see HASwitchPlate#63
@akloeckner
Copy link
Contributor

Please have a look at #112, which adds contexts to the event services. I am not sure though, if this solves your issues, because the context by itself does not hold information on the plate or anything else. It's just a unique ID. Please feel free to comment and suggest improvements!

akloeckner added a commit to akloeckner/openHASP-custom-component that referenced this issue May 15, 2024
This upgrades the current "list of services" restriction to allow the full syntax of HA scripts.

fixes HASwitchPlate#65

As a side-effect this also requires to generate a context for the script to run.

see HASwitchPlate#96

This can also be seen as a preparatory step to allow defining HASPObject-wide variables.

see HASwitchPlate#63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants