jheling / freeathome

Free@Home component for Home Assistant
112 stars 41 forks source link

fire on event for binary_sensor on every press #26

Closed kaisten closed 4 years ago

kaisten commented 4 years ago

Hi,

its not really an issue more an enhancement. I was trying myself but couldn't find a working solution. I want to start actions when a light is on and i press the on switch again, for example my bathroom lights are on I press the button again and the speaker starts. Also double click and so on would be possible. I was unable to add that for the binary_sensor could some help me out on that?

bartdorlandt commented 4 years ago

Is that even seen by HA? The double click is new in version 2.4.0 and captured by F@H if a custom scene is linked to the switch. I'm not sure if this is received by HA, since it isn't a state change of the rocker itself. Though the custom scene might change states for other entities.

miezie commented 4 years ago

You can make HA responding on a light switching on... that's an automation.

If you want a feature like this you could also start listening on the websocket available in the FAH API.

miezie commented 4 years ago

Switches are now more recognized in the component. Does this work for you?

kaisten commented 4 years ago

@miezie thank you for the effort. There is event isn't fired again so I cannot tigger anything

miezie commented 4 years ago

You should be able to listen on state changes of the light switches and then do your actions.

kaisten commented 4 years ago

after a while I tried again but there is no state change trigged anymore after the light is on

kaisten commented 4 years ago

I found a way to make use of every press event. Just create a automation in free@home of that actor, this will be recognized as a scene in ha. When that scene will be triggered I can do some actions.