• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Home Assistant switch gpio
#1
I have succesfully reached to integrate HA with another Raspberrpy pi running pilight with relays conected to gpio. But this only works with “send” control, but not receiving changes in state of switch from pilight.
This is my related HA config…
Code:
pilight:
 host: 192.168.1.5
 port: 5000
 whitelist:
   protocol:
     - relay
switch:
 - platform: pilight
   switches:
     sw1_filt:
       name: Piscina filtrar
       on_code:
         protocol: relay
         'gpio': 2
         'on': 1
       off_code:
         protocol: relay
         'gpio': 2
         'off': 0
     sw2_filt_speed:
       name: Piscina vel.filtrado
       on_code:
         protocol: relay
         'gpio': 3
         'on': 1
       off_code:
         protocol: relay
         'gpio': 3
         'off': 0
       on_code_receive:
         protocol: relay
         'gpio': 3
         state: 'on'
         echo: true
       off_code_receive:
         protocol: relay
         'gpio': 3
         state: 'off'
         echo: true
The related pilight config (pilight v.8)
Code:
   "devices": {
           "sw1_filt": {
                   "protocol": [ "relay" ],
                   "id": [{
                           "gpio": 2
                   }],
                   "default-state": "off",
                   "state": "on"
           },
           "sw2_filt_speed": {
                   "protocol": [ "relay" ],
                   "id": [{
                           "gpio": 3
                   }],
                   "state": "off",
                   "default-state": "off"
           },
   "settings": {
           "port": 5000,
           "standalone": 0,
           "log-level": 6,
           "pid-file": "/var/run/pilight.pid",
           "log-file": "/var/log/pilight.log",
           "webserver-enable": 1,
           "webserver-root": "/usr/local/share/pilight/webgui",
           "webserver-http-port": 5001,
           "webserver-https-port": 5002,
           "webserver-cache": 1,
           "gpio-platform": "raspberrypi2"
   },

I have tried lots of “on_code_receive” and “off_code_receive” options:
'gpio': 3
'gpio': '3'
gpio: 3
gpio: '3'
'state'
echo on and offf
...


 but remains the same:

when I change switch from pilight webgui, the state of HA switch is not updated, so seems that piligh-receive in HA dont work.

This is the output of “pilight-receive” command in the remote raspberry pi (running pilight), when I turn on - turn off one switch:
pi@rpi2:~ $ pilight-receive -F datetime,cpu_temp
{
“origin”: “sender”,
“protocol”: “relay”,
“message”: {
“gpio”: 3,
“state”: “on”
},
“repeat”: 1,
“uuid”: “0000-b8-27-eb-24787e”
}
{
“origin”: “sender”,
“protocol”: “relay”,
“message”: {
“gpio”: 3,
“state”: “off”
},
“repeat”: 1,
“uuid”: “0000-b8-27-eb-24787e”
}

Any help would be apreciated...
 
Reply
#2
So pilight works as expected but HA not? Shouldn't you ask @ HomeAssistent for help?
 
Reply
#3
(08-29-2018, 05:34 PM)curlymo Wrote: So pilight works as expected but HA not? Shouldn't you ask @ HomeAssistent for help?

I have asked at HomeAssistant comunity, but seems nobody uses pilight.

Maybe someone here can give me any clue...
 
Reply
#4
I don't. Sorry.
 
Reply
#5
For me, the config below works. After changing the config, I have to restart HA twice and the on_code_receive is not working 100%

Code:
        on_code:
          protocol: impuls
          systemcode: 31
          programcode: 1
          'on': 1
        off_code:
          protocol: impuls
          systemcode: 31
          programcode: 1
          'off': 1
        on_code_receive:
          protocol: impuls
          systemcode: 31
          programcode: 1
          state: 'on'
        off_code_receive:
          protocol: impuls
          systemcode: 31
          programcode: 1
          state: 'off'
 
Reply
#6
I have SOLVED:

I had to change “recv_codes_only=False” in instance of pilight_client in the pilight.py code of HA.

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

Now all events from pilight are been puted on HA bus!!! Without this, only those event with "origin":"receiver" work fine, and others (like "origin":"sender") are filtered at python pilight library level.

The problem is that actuually HA-pilight-receive-events only work fine with RF external codes. I doesnt work with internal gpios,generic switches, etc.

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



More here:
https://community.home-assistant.io/t/pi...oken/67411


And reported bug to HA here:
https://github.com/home-assistant/home-a...sues/16539

Thanks for all
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Solved - On / Off Command is the same command tigrablue 11 374 07-23-2019, 11:24 AM
Last Post: curlymo
  Raspberry PI, gpio-ir-tx and pilight not starting lordslash 5 693 06-11-2019, 05:19 PM
Last Post: curlymo
  GPIO input -> starting a rule scootermacro 1 157 06-09-2019, 07:40 AM
Last Post: curlymo
  Google Assistant coupled to pilight hansrijn2 4 1,071 05-29-2019, 06:54 PM
Last Post: curlymo
  [solved] kwmobile: repeating the remote signal doesn't work dawncrow 9 885 10-25-2018, 03:46 PM
Last Post: dawncrow
  ["SOLVED"] Not able to control intertechno ITR-1500 Kambaramba 12 1,443 10-03-2018, 05:52 PM
Last Post: curlymo
  [solved] raw and debug Traeumer 2 479 09-27-2018, 09:43 PM
Last Post: Traeumer
  Segmentation fault wth gpio-platform raspberrypi1b1 meloen 12 1,151 09-10-2018, 07:44 PM
Last Post: curlymo
  smtp / solved Traeumer 7 664 08-21-2018, 08:47 PM
Last Post: curlymo
  [SOLVED] pilight wont start since update from 8.0.8 to 8.1.2 pukington 5 1,449 08-08-2018, 05:34 PM
Last Post: curlymo

Forum Jump:


Browsing: 1 Guest(s)