Feller-AG / wiser-api

MIT License
15 stars 1 forks source link

Turn on LED of a scene according to circumstances #28

Open tech-geek-4 opened 7 months ago

tech-geek-4 commented 7 months ago

Good evening,

I tried to configure a scene switch in a way that the LED of the respective switche turns on in regards of the status of some other entities in Home Assistant.

For example: If a light is turned on in the house, the switch turns on the white led an if all is off it turns off again. Is there a possibility to get that working in an easy way?

The only thing i found out so far is that i could put a different config to the device but i couldn't figure out if i can change only a single part of the config. If i have to put a whole config, can i store a config somewhere and call it up?

woodworm commented 7 months ago

If a SmartButton triggers a job, and the job contains "flag_values", the LED of the SmartButton lights up depending on the flag state.

Create your own SystemFlag POST /api/system/flags {"symbol": "dancing", "value": true, "name": "Party"}

Add your SystemFlag to your job which is called by the SmartButton. PUT /api/jobs/{job_id} {"flag_values": [{"flag": {flag_id}, "value": true}]}

When you press the SmartButton it's party time and the LED lights up. You can end the party with another job "value": false or with PATCH /api/system/flags/{id} {"value": false}

tech-geek-4 commented 3 months ago

Thanks @woodworm for your reply and sorry that my answer took so long. I've overlooked your answer.

I see the possibility with the pressing of the SmartButton and the calling of a job. But I would prefer to turn on the LED of certain switches irrespective of pressing a button.

For example: I turn on a light in the basement. Home Assistant will then send a REST-Command to a SmartButton SceneSwitch in the second floor which lights up the white and shows in that case that there is a light burning. With the click of the button i can turn off all lights then (useful for example when kids forget their lights... ;) ).

tech-geek-4 commented 3 months ago

Sorry i realized, that i don't want to do it with a SmartButton. I wanted to do it with a SceneSwitch. In my use case i pickup the pressing of a Scene Switch in HomeAssistant and do some stuff then.

Anyway it would be great to know how i could turn on/off the LED of all kind of switches if this is possible... Sorry for the confusion!

kinnkler commented 3 months ago

Thanks @woodworm for your reply and sorry that my answer took so long. I've overlooked your answer.

I see the possibility with the pressing of the SmartButton and the calling of a job. But I would prefer to turn on the LED of certain switches irrespective of pressing a button.

For example: I turn on a light in the basement. Home Assistant will then send a REST-Command to a ~SmartButton~ SceneSwitch in the second floor which lights up the white and shows in that case that there is a light burning. With the click of the button i can turn off all lights then (useful for example when kids forget their lights... ;) ).

@tech-geek-4 I have implemented something similar with my garage door so that I can see whether the garage door is open using a switch's LED (scene switch). You can create a job via REST-API for the scene switch. There you can, for example, set the desired lights to 0, i.e. off. You also set a system FLAG (as described by woodworm) to True. E.g. system flag: AllLightsOut = true. If you now do something via Home Assistant and want to turn on the switch LED, you set the system flag to False. The easiest way to do this is via a job. Create a job via the REST-API which sets the flag to false and with the REST call GET /api/jobs/{id}/setflags you can trigger it from Homeassistant. Then you only have to set the brightness of the switch to 100 for Background and 0 for Foreground. This means that if the system flag is set to True as in the paired job, the brightness is 0 and if the system flag does not match, i.e. False, the switch's LED lights up. As soon as you press the switch, all lights are switched off according to the job and the flag is set to True and the switch's LED no longer lights up.

If you need help with the implementation, please do not hesitate to ask. May I ask you how you did the integration in Homeassitant? I would also like to do this, but can't find an integration. Can you help me with this?

tech-geek-4 commented 3 months ago

If you need help with the implementation, please do not hesitate to ask. May I ask you how you did the integration in Homeassitant? I would also like to do this, but can't find an integration. Can you help me with this?

@kinnkler Thanks for your suggestion. It would indeed be helpful when you could quickly help me. Of course i will help as far as i can with the integration topic. I suggest that we move to a personal conversation to not bother others with our "private" conversation...;) I opened up a private repo and invited you to it. Maybe you can give me a quick hello via an issue topic to start.