You get a lot of messages because the binary stream fits a lot of different (or not so different …) protocolls. Usually it makes sence to compile pilight only with the procotolls of the devices you own (check troubleshooting section in the manual).
Additionally there are two other methods in place to prevent event bus spamming:
There is a whitelist feature in the pilight hub component. In your case you can e.g. specify that only messages with the ev1527 protocol are put onto the event bus.
Messages are often repeated, to make sure that the receiver gets it. While you see all repeated messages in the pilight-debug output you show, they are not put onto the HA event bus! Only the first repeat is forwarded to home-assistant.
To you second question (sensor for movement):
As you found out the motion detector only sends a message when a movement is detected, but since there is no no movement message I would not use a HASS sensor for this. A sensor has a state, but movement is not state but a trigger. So just create an automation that trriggers on the movement event, without a sensor.
Thanks so much for the reply. So useful to know about the whitelist - I think I had skimmed that when I read the documentation but that perfect.
I think I understand what you mean for using the automation instead - i.e its a trigger not a state, but how do I express this in a HASS automation - what do I write for the ‘movement event’ under the trigger section? I would normally write an automation off the back of a state change in a motion sensor.
i have seen several threads on the forum about motion detectors who only send movement and no “no movement”
most people seek a way to set the sensor to “no movement” after a little time.
i dont recall if there were any succesfull results, but i think its wise to search the forum.
some off them were also about door sensors which didnt detect close, just opening.
i dont see a way to make a trigger from a movement without a sensor.
there is no event for movement, just for state change.
You want an event that is fired when the received pilight code says that the movement sensor triggered.
Thus do the following e.g.: (like I mentioned above in this thread ;-)):
I see! Brilliant thanks for this. Through my ‘understanding’ of the documentation there were two ways to integrate Pilight - through a Switch and a Sensor - I didn’t realise we could address Pilight events directly like that! I guess Pilight is just pumping its events onto the HASS event bus. Gives me some more ideas!
Thanks for taking the time to explain this David - maybe I/someone should write this as a note for the Pilight documentation in case, like me, they didn’t get it.
@ReneTode@privatesam
I agree that the event system is not known /does not have to be known to the average user and the explanation in the pilight docu is much too short here. An example how to trigger on a move event would be great. Maybe one of you want to extend the docu?
@ReneTode:
Your link explains some build-in events of Home Assistant. But a lot of components create their own events. The internal communication in HASS is done via the event bus. When you have a hub compenent for some protocol/interface the received data is put on the event bus to make them available to other components. These other components are e.g. switches, lights, automation, etc.This concept is for example also used for the mqtt components. To check what events are created in your setup just click on the developer tools:
Yes, the real deal is the pilight hub component offering pilight_received events and a send service. The switch / sensor components just make use of this hub component.
This concept is very generic. One can e.g. just look for a temperatur value in the data to trigger an automation. No additional components are needed.
in my case there is not much more there, then in the documentation.
but it is nice to know there is more, because then i can help others more.
i didnt know that components also could have own events. on the formentioned page it only says that components can fire and listen to events. not that they can have its own type off event. thats why i asked.
that’s a pilight error. Need to check your /etc/pilight/config.json and make sure either a) your ports are set up correctly or b) that pilight is actually running (ps -A | grep pilight)