I can see that pilight is capable of sensing that I’m holding in a button on a remote by creating multiple “hits” when I look at the output from pilight-receive
. It can produce several “hits” per second. I would like to use this fact in order to create an automation that can do different things depending on how long the button has been pressed (dimming a light for a long press and toggle it off or on with a short press). The problem is when I use the pilight addon in HA those multiple “hits” in quick succession turn in to single “hits” with several seconds in between. I think this is by design in order not to spam the event bus:
In pylight.py it says:
def _handle_code(self, call):
"""Check if received code by the pilight-daemon.
If the code matches the receive on/off codes of this switch the switch
state is changed accordingly.
"""
# - True if off_code/on_code is contained in received code dict, not
# all items have to match.
# - Call turn on/off only once, even if more than one code is received
if any(self._code_on_receive):
for on_code in self._code_on_receive:
if on_code.match(call.data):
on_code.run(switch=self, turn_on=True)
break
if any(self._code_off_receive):
for off_code in self._code_off_receive:
if off_code.match(call.data):
off_code.run(switch=self, turn_on=False)
break
I’m not skilled enough to alter this, so I’m need of some assistance. How do I remove or improve the spam filter the pilight addon uses?