Pilight receive is broken?

I have been trying to configure pilight switchs (gpio) and after lots of debuging around and lots of configuration options tested I finally supossing that the pilight service is broken in HA.

I was not able to get any event received with binary-sensor, sensor, switchs with “on/off_code_received” even automation with event trigger.

The “sending” service works like a charm.

This is the related pilight debug log (in witch you can se that service “receive” is not initiated at all.

homeassistant@rpi3s:~/.homeassistant$ tail -f home-assistant.log |grep pilight
2018-09-06 08:48:15 INFO (MainThread) [homeassistant.loader] Loaded switch.pilight from homeassistant.components.switch.
2018-09-06 08:48:16 INFO (MainThread) [homeassistant.loader] Loaded pilight from homeassistant.components.pilight
2018-09-06 08:48:16 INFO (MainThread) [homeassistant.loader] Loaded binary_sensor.pilight from homeassistant.components.
2018-09-06 08:48:18 DEBUG (MainThread) [homeassistant.components.automation] Automation automation.pilight_door1_closed
initial state True from default initial state
2018-09-06 08:48:18 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=None, new_sta
te=<state automation.pilight_door1_closed=off; last_triggered=None, friendly_name=pilight_door1_closed @ 2018-09-06T08:4
8:18.349905+02:00>, entity_id=automation.pilight_door1_closed>
2018-09-06 08:48:18 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service=set, service_cal
l_id=1974718192-3, service_data=visible=False, entities=['automation.deteccion', 'automation.en_coche', 'automation.kodi
_play_on', 'automation.luz_cocina_off', 'automation.luz_cocina_on', 'automation.luz_entrada_off', 'automation.luz_entrad
a_on', 'automation.palomas', 'automation.piscina_alta_velocidad', 'automation.piscina_baja_velocidad', 'automation.pisci
na_filtrar', 'automation.piscina_no_filtrar', 'automation.plantas', 'automation.puerta_garaje_abierta', 'automation.puls
ador1_1click', 'automation.pulsador1_2click', 'automation.updates', 'automation.kodi_play_off', 'automation.pilight_door
1_closed', 'automation.timer'], object_id=all_automations, name=all automations, domain=group>
2018-09-06 08:48:18 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=None, new_sta
te=<state group.all_automations=off; order=6, entity_id=('automation.deteccion', 'automation.en_coche', 'automation.kodi
_play_on', 'automation.luz_cocina_off', 'automation.luz_cocina_on', 'automation.luz_entrada_off', 'automation.luz_entrad
a_on', 'automation.palomas', 'automation.piscina_alta_velocidad', 'automation.piscina_baja_velocidad', 'automation.pisci
na_filtrar', 'automation.piscina_no_filtrar', 'automation.plantas', 'automation.puerta_garaje_abierta', 'automation.puls
ador1_1click', 'automation.pulsador1_2click', 'automation.updates', 'automation.kodi_play_off', 'automation.pilight_door
1_closed', 'automation.timer'), auto=True, hidden=True, friendly_name=all automations @ 2018-09-06T08:48:18.432530+02:00
>, entity_id=group.all_automations>
2018-09-06 08:48:23 INFO (MainThread) [homeassistant.setup] Setting up pilight
2018-09-06 08:48:23 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: service=send, doma
2018-09-06 08:48:23 INFO (MainThread) [homeassistant.setup] Setup of domain pilight took 0.1 seconds.
2018-09-06 08:48:23 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=pilight>
2018-09-06 08:48:23 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.pilight
2018-09-06 08:48:23 INFO (MainThread) [homeassistant.components.switch] Setting up switch.pilight
2018-09-06 08:48:30 INFO (MainThread) [homeassistant.components.automation] Initialized trigger pilight_door1_closed
2018-09-06 08:48:30 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state automa
tion.pilight_door1_closed=off; last_triggered=None, friendly_name=pilight_door1_closed @ 2018-09-06T08:48:18.349905+02:0
0>, new_state=<state automation.pilight_door1_closed=on; last_triggered=None, friendly_name=pilight_door1_closed @ 2018-
09-06T08:48:30.604167+02:00>, entity_id=automation.pilight_door1_closed>
2018-09-06 08:48:30 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state group.
all_automations=off; order=6, entity_id=('automation.deteccion', 'automation.en_coche', 'automation.kodi_play_on', 'auto
mation.luz_cocina_off', 'automation.luz_cocina_on', 'automation.luz_entrada_off', 'automation.luz_entrada_on', 'automati
on.palomas', 'automation.piscina_alta_velocidad', 'automation.piscina_baja_velocidad', 'automation.piscina_filtrar', 'au
tomation.piscina_no_filtrar', 'automation.plantas', 'automation.puerta_garaje_abierta', 'automation.pulsador1_1click', '
automation.pulsador1_2click', 'automation.updates', 'automation.kodi_play_off', 'automation.pilight_door1_closed', 'auto
mation.timer'), auto=True, hidden=True, friendly_name=all automations @ 2018-09-06T08:48:18.432530+02:00>, new_state=<st
ate group.all_automations=on; order=6, entity_id=('automation.deteccion', 'automation.en_coche', 'automation.kodi_play_o
n', 'automation.luz_cocina_off', 'automation.luz_cocina_on', 'automation.luz_entrada_off', 'automation.luz_entrada_on',
'automation.palomas', 'automation.piscina_alta_velocidad', 'automation.piscina_baja_velocidad', 'automation.piscina_filt
rar', 'automation.piscina_no_filtrar', 'automation.plantas', 'automation.puerta_garaje_abierta', 'automation.pulsador1_1
click', 'automation.pulsador1_2click', 'automation.updates', 'automation.kodi_play_off', 'automation.pilight_door1_close
d', 'automation.timer'), auto=True, hidden=True, friendly_name=all automations @ 2018-09-06T08:48:30.700890+02:00>, enti
2018-09-06 08:48:33 DEBUG (Thread-22) [homeassistant.util.json] JSON file not found: /srv/homeassistant/lib/python3.5/si
2018-09-06 08:48:33 DEBUG (Thread-22) [homeassistant.util.json] JSON file not found: /srv/homeassistant/lib/python3.5/si
2018-09-06 08:48:33 DEBUG (Thread-22) [homeassistant.util.json] JSON file not found: /srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/.translations/pilight.es.json
2018-09-06 08:48:35 DEBUG (Thread-16) [homeassistant.util.json] JSON file not found: /srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/binary_sensor/.translations/pilight.en.json
2018-09-06 08:48:35 DEBUG (Thread-16) [homeassistant.util.json] JSON file not found: /srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/.translations/pilight.en.json
2018-09-06 08:48:35 DEBUG (Thread-16) [homeassistant.util.json] JSON file not found: /srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/.translations/pilight.en.json

Note this registered service:
2018-09-06 08:48:23 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: service=send, domain=pilight>

Maybe I missing a “service=receive, domain=pilight”
Maybe I have a problem with my instalation, or maybe I using latest pilight 8.x, but I suppose it has the same api in receiving json events.
But I suspect for a problem in HA because there are some posts here reporting similar issues (sending work fine, receiving fails at all).

Please, any help would be apreciated.

Please any help could be apreciated.

My pilight is working as it should. I have several temperature sensors with 433MHz and there are all ok. I use version 0.76.2 of Home assistant and pilight 8.x.

Do you know if you see info logs with:

>cat homeassistant.log | grep pilight

something like

INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=pilight, service=send>

but with service=receive


I cant find the error. I have tested everithing and I am little desesperated.
I have made tcpdump at port 5000 on pilight raspberry, and I can see that HA sucessfully register as “receive”, and how the events are sended from pilight to HA. I have seen that make 2 registration (probably one for send and one for receive).

So the problem is inside HA.

So then I m inside pilight.py module, and I can see that problem can be about the filtering whitelist related so I changed to force allways send events on HA bus…

# No whitelist defined, put data on event bus
#        if not whitelist:
hass.bus.fire(EVENT, data)

# Check if data matches the defined whitelist
#        elif all(str(data[key]) in whitelist[key] for key in whitelist):
#            hass.bus.fire(EVENT, data)

_LOGGER.error("testing here")

but remain the same… and no pilight event is sended to ha bus

Please anybody can tell me somethig that help?

Thanks in advance.

could be that pilight_client is started before the set_callback

At the oficial pilight python lib example is set before…


pilight_client.start() # Start the receiver

Please… can developer help me? I havent HA inside code knowledge …

I’m having the same problem - no pilight events on the bus. You’ve got further with your troubleshooting than me. I’m using the latest HA - 0.77

Any help much appreciated!

Happy to test anything.

I am near… I am searching inside deeper and deeper
Maybe the problem here could be a filter inside for “origin” parameter

:param recv_codes_only: If True: only call the callback function when the
pilight-daemon received a code, not for status messages etc.

So only RF codes are ‘received’. As GPIO is marked as “state” chages they are “filtered”.

I had to change “recv_codes_only=False” in instance of pilight_client:

pilight_client = pilight.Client(host=host, port=port, recv_codes_only=False)

Now all events from pilight are been puted on HA bus!!!

The problem is that actyually pilihgt receive events only work fine with RF external codes. I doesnt work with internal gpios,generic switches, etc.

Please, could be great that developers change this, or put an option to select. I think that whitelist filter in HA is powerfull enought to set
as default.


Will test this on my install today and see if we can’t push a fix for this.

How did you get this change to work. i found the relevant line of code in the pilight.py, changed it then restarted pilight and home assistant but its still not working?

Could you describe your scenario? ha config? pilight config?
Do you know if pilight-receive is working fine?

I’m using the latest HA 0.77.3. The pilight in my HA config is:

port: 5000

I think the pilight component loads ok because there’s no errors. pilight-receive is working fine.

My HA is running in a virtual environment and the installation is in /srv/homeassistant. Searching within here I found the pilight.py component file in: ./lib/python3.6/site-packages/pilight/ and edited this file with the change you mention however I’m not sure if this needs to be recompiled in some way - there is a pilight.pyc file in the folder too which I think is somethingto do with python interpreting the py file.

don’t worry about pyc. python detect changes in your code and “compile” then.
It’s a silly question. Do you define pilight sensor or switch? as those defined in pilight? Could you post pilight-receive output?

I only have a couple of switches defined in Pilight. Currently in HA I don’t have any Pilight sensors or switches defnied because I wanted to check that the event bus is seeing the 433 signals first. As far as I can remember the Pilight component should get stuff on to the event bus without having a sensor set up. Here is some pilight-receive output:

“message”: {
“id”: 7,
“state”: “off”
“origin”: “receiver”,
“protocol”: “selectremote”,
“uuid”: “0000-b8-27-eb-2bb59a”,
“repeats”: 1
“message”: {
“systemcode”: 1,
“programcode”: 1,
“state”: “on”
“origin”: “receiver”,
“protocol”: “rsl366”,
“uuid”: “0000-b8-27-eb-2bb59a”,
“repeats”: 1

Hello Privatesam. The bug that I solved was for do not filtering pilight events that doesnt contain “receiver” as “origin” parameter. In my case, piligh was sending events with “origin”=“sender”, and those were filtered by python pilight lib.

Seems that this not affect to you, as you are receiving “origin”: “receiver” as usual RF433 signals…

Please put logger to debug and see if those events are seen in HA events bus.