• 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:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with Protocol gpio_switch
#1
Hi,

this is my first pilight project with a Raspberry 2.
Code:
cat /etc/os-release
Code:
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

It's very simple but it does not work:

3,3 V (GPIO) --> switch (button) --> GPIO1 (wiringx)
On the webgui should be displayed "ON" when the switch is closed (GPIO1 = high) or "OFF" when the switch is open (GPIO1 = low).
That's all.

The installation of pilight is compiled manually. My config.json looks like this:
Code:
{
        "devices": {
                "Schalter": {
                        "protocol": [ "gpio_switch" ],
                        "id": [{
                                "gpio": 1
                        }],
                        "state": "off"
                }
        },
        "rules": {},
        "gui": {
                "Schalter": {
                        "name": "Schalter 1",
                        "group": [ "Heizung" ],
                        "media": [ "all" ],
                        "readonly": 1,
                        "confirm": 0
                }
        },
        "settings": {
                "log-level": 6,
                "pid-file": "/var/run/pilight.pid",
                "log-file": "/var/log/pilight.log",
                "webserver-enable": 1,
                "webserver-root": "/usr/local/pilight/webgui",
                "webserver-http-port": 5001,
                "webserver-cache": 1,
                "gpio-platform": "raspberrypi2"
        },
        "hardware": {},
        "registry": {
                "webserver": {
                        "ssl": {
                                "certificate": {
                                        "secure": 0,
                                        "location": "/etc/pilight/pilight.pem"
                                }
                        }
                },
                "pilight": {
                        "version": {
                                "current": "7.0"
                        }
                }
        }
}
To check the circuit I have entered:
Code:
pilight-daemon -D
The following output is displayed:
Code:
[Oct 21 07:28:55:233766] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/lt.lua v1.0
[Oct 21 07:28:55:234437] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/and.lua v1.0
[Oct 21 07:28:55:235166] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/ge.lua v1.0
[Oct 21 07:28:55:236203] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/modulus.lua v1.0
[Oct 21 07:28:55:236881] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/or.lua v1.0
[Oct 21 07:28:55:237451] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/ne.lua v1.0
[Oct 21 07:28:55:238173] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/intdivide.lua v1.0
[Oct 21 07:28:55:239148] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/gt.lua v1.0
[Oct 21 07:28:55:239642] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/plus.lua v1.0
[Oct 21 07:28:55:240372] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/le.lua v1.0
[Oct 21 07:28:55:240877] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/minus.lua v1.0
[Oct 21 07:28:55:241463] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/multiply.lua v1.0
[Oct 21 07:28:55:242055] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/divide.lua v1.0
[Oct 21 07:28:55:242663] pilight-daemon: DEBUG: loaded event action /usr/local/pilight/operators/eq.lua v1.0
[Oct 21 07:28:55:990126] pilight-daemon: INFO: version v7.0-13-g38ebf7f
[Oct 21 07:28:55:990486] pilight-daemon: DEBUG: ssdp sent search
[ Oct 21 07:28:56:98409] pilight-daemon: INFO: no pilight daemon found, daemonizing
[Oct 21 07:28:56:116770] pilight-daemon: INFO: daemon listening to port: 37173
[Oct 21 07:28:56:118413] pilight-daemon: ERROR: cannot bind to webserver port, address already in use?
[Oct 21 07:28:56:118693] pilight-daemon: ERROR: cannot bind to webserver port, address already in use?
[Oct 21 07:28:56:119079] pilight-daemon: DEBUG: new thread gpio_switch, 1 thread running
[Oct 21 07:28:56:119289] pilight-daemon: DEBUG: new thread socket, 2 threads running
[Oct 21 07:28:56:119486] pilight-daemon: DEBUG: new thread ssdp, 3 threads running
[Oct 21 07:28:56:119775] pilight-daemon: INFO: new client, ip: 127.0.0.1, port: 49814
[Oct 21 07:28:56:119863] pilight-daemon: DEBUG: new thread sender, 4 threads running
[Oct 21 07:28:56:119869] pilight-daemon: DEBUG: client fd: 13
[Oct 21 07:28:56:120276] pilight-daemon: DEBUG: client id: 1
[Oct 21 07:28:56:120802] pilight-daemon: DEBUG: new thread broadcaster, 5 threads running
[Oct 21 07:28:56:123824] pilight-daemon: DEBUG: new thread receive parser, 6 threads running
[Oct 21 07:28:56:124158] pilight-daemon: DEBUG: new thread events client, 7 threads running
[Oct 21 07:28:56:124417] pilight-daemon: DEBUG: new thread events loop, 8 threads running
[Oct 21 07:28:56:124966] pilight-daemon: DEBUG: ssdp sent search
[Oct 21 07:28:56:125677] pilight-daemon: DEBUG: ssdp sent notify
[Oct 21 07:28:56:131425] pilight-daemon: ERROR: The x x GPIO 0 is not set to input mode
[Oct 21 07:28:56:132803] pilight-daemon: DEBUG: broadcasted: {"message":{"gpio":1,"state":"on"},"origin":"receiver","protocol":"gpio_switch","uuid":"0000-b8-27-eb-23f390"}
[Oct 21 07:28:56:212834] pilight-daemon: DEBUG: cpu: 0.000000%
[Oct 21 07:28:56:238796] pilight-daemon: INFO: new client, ip: 192.168.20.122, port: 34998
[Oct 21 07:28:56:238900] pilight-daemon: DEBUG: client fd: 16
[Oct 21 07:28:56:238950] pilight-daemon: DEBUG: client id: 2
[Oct 21 07:28:56:239291] pilight-daemon: DEBUG: socket write succeeded: {"action":"identify","options":{"config":1,"receiver":1},"media":"all"}

[Oct 21 07:28:56:239506] pilight-daemon: DEBUG: socket recv: {"action":"identify","options":{"config":1,"receiver":1},"media":"all"}
[Oct 21 07:28:56:239749] pilight-daemon: DEBUG: socket write succeeded: {"status":"success"}

[Oct 21 07:28:57:133480] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:28:58:134673] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:28:59:135847] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:28:59:215895] pilight-daemon: DEBUG: cpu: 0.133993%
[Oct 21 07:29:00:137037] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:29:01:138292] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:29:01:828763] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[ Oct 21 07:29:02:35574] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:02:218876] pilight-daemon: DEBUG: cpu: 0.075416%
[Oct 21 07:29:02:734463] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:02:997491] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:02:997910] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:02:998385] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:02:998541] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:02:998682] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:03:727922] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:03:960732] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:03:960924] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:04:760700] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:04:968033] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:05:221911] pilight-daemon: DEBUG: cpu: 0.122976%
[Oct 21 07:29:05:952082] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:06:246693] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:07:233577] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:07:589389] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
[Oct 21 07:29:08:224637] pilight-daemon: DEBUG: cpu: 0.089096%
[Oct 21 07:29:09:156185] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:29:10:157356] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:29:11:158530] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:29:11:227414] pilight-daemon: DEBUG: cpu: 0.066625%
[Oct 21 07:29:12:159696] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:29:13:160866] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:29:14:162055] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:29:14:231091] pilight-daemon: DEBUG: cpu: 0.065263%
[Oct 21 07:29:15:163255] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:29:16:164423] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:29:17:165590] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
[Oct 21 07:29:17:234079] pilight-daemon: DEBUG: cpu: 0.061837%
[Oct 21 07:29:18:166756] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
^C[Oct 21 07:29:18:567402] pilight-daemon: INFO: Interrupt signal received. Please wait while pilight is shutting down
The error
Code:
[Oct 21 07:28:56:131425] pilight-daemon: ERROR: The x x GPIO 0 is not set to input mode
is displayed only once.
The error
Code:
[Oct 21 07:28:57:133480] pilight-daemon: ERROR: The x x GPIO 338 is not set to input mode
is displayed when the switch is open and
the error
Code:
[ Oct 21 07:29:02:35574] pilight-daemon: ERROR: The x x GPIO 1961881148 is not set to input mode
is diplayed when I press the button (switch closed).

If I start the service pilight with
Code:
service pilight start
comes no error message and the webgui ist online. But on the webgui is displayed the switch allways "ON".

Can someone help me to find the error.

Thanks
 
Reply
#2
How did you install pilight?
 
Reply
#3
As described in the documentation under Installation - Manually Compiled Version (development). After the necessary installation of "libunwind8-dev", the installation of pilight has been completed without any errors.

Meanwhile, I have also made a clean standard installation of the stable version 8.0.
Code:
root@raspberrypi:/home/pi# cd
root@raspberrypi:~# echo "deb http://apt.pilight.org/ stable main" > /etc/apt/sources.list.d/pilight.list
root@raspberrypi:~# wget -O - http://apt.pilight.org/pilight.key | apt-key add -
--2017-10-21 17:37:47--  http://apt.pilight.org/pilight.key
Auflösen des Hostnamens »apt.pilight.org (apt.pilight.org)« … 94.124.143.207
Verbindungsaufbau zu apt.pilight.org (apt.pilight.org)|94.124.143.207|:80 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: 3079 (3,0K) [application/pgp-keys]
Wird in »»STDOUT«« gespeichert.

-                                           100%[========================================================================================>]   3,01K  --.-KB/s    in 0s

2017-10-21 17:37:47 (44,8 MB/s) - auf die Standardausgabe geschrieben [3079/3079]

OK
root@raspberrypi:~# apt-get update
OK:1 http://archive.raspberrypi.org/debian stretch InRelease
OK:2 http://mirrordirector.raspbian.org/raspbian stretch InRelease
Holen:3 http://apt.pilight.org stable InRelease [3.967 B]
Holen:4 http://apt.pilight.org stable/main armhf Packages [6.358 B]
Es wurden 10,3 kB in 2 s geholt (4.388 B/s).
Paketlisten werden gelesen... Fertig
root@raspberrypi:~# apt-get install pilight
Code:
root@raspberrypi:~# pilight-daemon -V
pilight-daemon version v8.0
But the error remains.
Code:
root@raspberrypi:~# pilight-daemon -D
[Oct 21 15:51:42:204449] pilight-daemon: INFO: version v8.0
[Oct 21 15:51:42:204864] pilight-daemon: DEBUG: ssdp sent search
[Oct 21 15:51:42:310617] pilight-daemon: INFO: no pilight daemon found, daemonizing
[Oct 21 15:51:42:311312] pilight-daemon: INFO: daemon listening to port: 36897
[Oct 21 15:51:42:312923] pilight-daemon: DEBUG: webserver listening to port 5001
[Oct 21 15:51:42:313355] pilight-daemon: DEBUG: new thread gpio_switch, 1 thread running
[Oct 21 15:51:42:313697] pilight-daemon: DEBUG: new thread socket, 2 threads running
[Oct 21 15:51:42:313999] pilight-daemon: DEBUG: new thread ssdp, 3 threads running
[Oct 21 15:51:42:314065] pilight-daemon: DEBUG: cpu: 0.000000%, ram: 1.087222%
[Oct 21 15:51:42:314255] pilight-daemon: DEBUG: new thread sender, 4 threads running
[Oct 21 15:51:42:314528] pilight-daemon: DEBUG: new thread broadcaster, 5 threads running
[Oct 21 15:51:42:314802] pilight-daemon: DEBUG: new thread receive parser, 6 threads running
[Oct 21 15:51:42:315098] pilight-daemon: DEBUG: new thread events client, 7 threads running
[Oct 21 15:51:42:315392] pilight-daemon: DEBUG: new thread events loop, 8 threads running
[Oct 21 15:51:42:315673] pilight-daemon: DEBUG: new thread webserver worker #0, 9 threads running
[Oct 21 15:51:42:316012] pilight-daemon: DEBUG: new thread webserver client, 10 threads running
[Oct 21 15:51:42:316346] pilight-daemon: DEBUG: new thread webserver broadcast, 11 threads running
[Oct 21 15:51:42:316947] pilight-daemon: INFO: new client, ip: 127.0.0.1, port: 49038
[Oct 21 15:51:42:324868] pilight-daemon: DEBUG: client fd: 7
[Oct 21 15:51:42:325033] pilight-daemon: DEBUG: client id: 1
[Oct 21 15:51:42:326363] pilight-daemon: DEBUG: ssdp sent search
[Oct 21 15:51:42:326763] pilight-daemon: DEBUG: ssdp sent notify
[Oct 21 15:51:42:327657] pilight-daemon: DEBUG: ssdp sent notify
[Oct 21 15:51:42:327791] pilight-daemon: DEBUG: ssdp sent search
[Oct 21 15:51:42:333497] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 5 is not set to input mode
[Oct 21 15:51:42:335008] pilight-daemon: DEBUG: broadcasted: {"message":{"gpio":1,"state":"on"},"origin":"receiver","protocol":"gpio_switch","uuid":"0000-b8-27-eb-23f390"}
[Oct 21 15:51:42:431405] pilight-daemon: DEBUG: socket write succeeded: {"action":"identify","options":{"config":1,"core":1},"media":"web"}

[Oct 21 15:51:42:432178] pilight-daemon: INFO: new client, ip: 192.168.20.122, port: 46448
[Oct 21 15:51:42:432336] pilight-daemon: DEBUG: client fd: 14
[Oct 21 15:51:42:432400] pilight-daemon: DEBUG: client id: 2
[Oct 21 15:51:42:432515] pilight-daemon: INFO: new client, ip: 192.168.20.122, port: 46450
[Oct 21 15:51:42:432583] pilight-daemon: DEBUG: client fd: 15
[Oct 21 15:51:42:432638] pilight-daemon: DEBUG: client id: 3
[Oct 21 15:51:42:432799] pilight-daemon: DEBUG: socket recv: {"action":"identify","options":{"config":1,"core":1},"media":"web"}
[Oct 21 15:51:42:433091] pilight-daemon: DEBUG: socket write succeeded: {"status":"success"}

[Oct 21 15:51:42:433251] pilight-daemon: DEBUG: socket recv: {"action":"identify","options":{"config":1,"receiver":1},"media":"all"}
[Oct 21 15:51:42:433473] pilight-daemon: DEBUG: socket write succeeded: {"status":"success"}

[Oct 21 15:51:42:432214] pilight-daemon: DEBUG: socket write succeeded: {"action":"identify","options":{"config":1,"receiver":1},"media":"all"}

[Oct 21 15:51:43:335036] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 338 is not set to input mode
[Oct 21 15:51:44:336905] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 338 is not set to input mode
[Oct 21 15:51:45:316629] pilight-daemon: DEBUG: cpu: 0.119348%, ram: 1.087222%
[Oct 21 15:51:45:317464] pilight-daemon: DEBUG: socket write succeeded: {"values":{"cpu":0.1193483515707483,"ram":1.0872220864891278},"origin":"core","type":-1,"uuid":"0000-b8-27-eb-23f390"}

[Oct 21 15:51:45:317575] pilight-daemon: DEBUG: broadcasted: {"values":{"cpu":0.1193483515707483,"ram":1.0872220864891278},"origin":"core","type":-1,"uuid":"0000-b8-27-eb-23f390"}
[Oct 21 15:51:45:338749] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 338 is not set to input mode
[Oct 21 15:51:46:339946] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 338 is not set to input mode
[Oct 21 15:51:47:340509] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 338 is not set to input mode
[Oct 21 15:51:47:619721] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 1962930092 is not set to input mode
[Oct 21 15:51:47:794398] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 1962930092 is not set to input mode
[Oct 21 15:51:48:212137] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 1962930092 is not set to input mode
[Oct 21 15:51:48:319182] pilight-daemon: DEBUG: cpu: 0.275589%, ram: 1.087222%
[Oct 21 15:51:48:319920] pilight-daemon: DEBUG: socket write succeeded: {"values":{"cpu":0.2755893838743386,"ram":1.0872220864891278},"origin":"core","type":-1,"uuid":"0000-b8-27-eb-23f390"}

[Oct 21 15:51:48:319997] pilight-daemon: DEBUG: broadcasted: {"values":{"cpu":0.2755893838743386,"ram":1.0872220864891278},"origin":"core","type":-1,"uuid":"0000-b8-27-eb-23f390"}
[Oct 21 15:51:48:366029] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 1962930092 is not set to input mode
[Oct 21 15:51:48:366998] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 1962930092 is not set to input mode
[Oct 21 15:51:48:559958] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 1962930092 is not set to input mode
[Oct 21 15:51:48:697088] pilight-daemon: ERROR: The ▒Ū ▒Ū GPIO 1962930092 is not set to input mode
^C[Oct 21 15:51:49:594604] pilight-daemon: DEBUG: received interrupt signal, stopping pilight...
 
Reply
#4
Confirmed to be buggy in current stable. I think the following patch should work until i fixed it properly:
Code:
diff --git a/libs/pilight/protocols/GPIO/gpio_switch.c b/libs/pilight/protocols/GPIO/gpio_switch.c
index 226dbfa..dc2eca1 100644
--- a/libs/pilight/protocols/GPIO/gpio_switch.c
+++ b/libs/pilight/protocols/GPIO/gpio_switch.c
@@ -74,18 +74,24 @@ static void *thread(void *param) {
                jchild = json_first_child(jid);
                if(json_find_number(jchild, "gpio", &itmp) == 0) {
                        id = (int)round(itmp);
+                       pinMode(id, PINMODE_INPUT);
+                       state = digitalRead(id);
                        if(wiringXISR(id, ISR_MODE_BOTH) < 0) {
                                threads--;
                                return NULL;
                        }
-                       state = digitalRead(id);
                }
        }

        createMessage(id, state);

        while(loop) {
+               if(wiringXISR(id, ISR_MODE_BOTH) < 0) {
+                       threads--;
+                       return NULL;
+               }
                irq_read(id);
+               pinMode(id, PINMODE_INPUT);
                nstate = digitalRead(id);
                if(nstate != state) {
                        state = nstate;
 
Reply
#5
Very good work, thank you. With the changes from the patch, the circuit runs smoothly.
 
Reply
#6
Today I can test the protocol with the patch extensively. It works between 10 and 20 minutes without problems. Then the Webgui stops responding and is no longer accessible (Error 404). A restart of the service pilight with
Code:
root@raspberrypi:~# service pilight stop
root@raspberrypi:~# service pilight start
solves the problem for the next minutes. What I noticed is that the CPU load with about 2% is very high. Normal indicates pilight otherwise 0.0x%.
Hope you can help. Thank's
 
Reply
#7
What does the debug output show when the webgui stops working?

Code:
sudo pilight-daemon -D
 
Reply
#8
Start at 15:05:11 with
Code:
pilight-daemon -D
screen output first minute (switch pressed once)
Code:
root@raspberrypi:/home/pi# pilight-daemon -D
[ Oct 22 15:05:11:22503] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/lt.lua v1.0
[ Oct 22 15:05:11:23167] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/and.lua v1.0
[ Oct 22 15:05:11:23879] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/ge.lua v1.0
[ Oct 22 15:05:11:24837] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/modulus.lua v1.0
[ Oct 22 15:05:11:25441] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/or.lua v1.0
[ Oct 22 15:05:11:25986] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/ne.lua v1.0
[ Oct 22 15:05:11:26736] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/intdivide.lua v1.0
[ Oct 22 15:05:11:27360] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/gt.lua v1.0
[ Oct 22 15:05:11:27917] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/plus.lua v1.0
[ Oct 22 15:05:11:28593] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/le.lua v1.0
[ Oct 22 15:05:11:29210] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/minus.lua v1.0
[ Oct 22 15:05:11:29769] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/multiply.lua v1.0
[ Oct 22 15:05:11:30409] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/divide.lua v1.0
[ Oct 22 15:05:11:30972] pilight-daemon: DEBUG: loaded event action /usr/local/p                                                                                             ilight/operators/eq.lua v1.0
[ Oct 22 15:05:11:33515] pilight-daemon: INFO: version v7.0-13-g38ebf7f
[ Oct 22 15:05:11:33892] pilight-daemon: DEBUG: ssdp sent search
[Oct 22 15:05:11:134396] pilight-daemon: INFO: no pilight daemon found, daemoniz                                                                                             ing
[Oct 22 15:05:11:161156] pilight-daemon: INFO: daemon listening to port: 38771
[Oct 22 15:05:11:162646] pilight-daemon: INFO: secured webserver started on port                                                                                             : 5002 (fd 14)
[Oct 22 15:05:11:163113] pilight-daemon: INFO: regular webserver started on port                                                                                             : 5001 (fd 13)
[Oct 22 15:05:11:163675] pilight-daemon: DEBUG: new thread gpio_switch, 1 thread                                                                                              running
[Oct 22 15:05:11:163947] pilight-daemon: DEBUG: new thread socket, 2 threads run                                                                                             ning
[Oct 22 15:05:11:164185] pilight-daemon: DEBUG: new thread ssdp, 3 threads runni                                                                                             ng
[Oct 22 15:05:11:164549] pilight-daemon: DEBUG: new thread sender, 4 threads run                                                                                             ning
[Oct 22 15:05:11:164890] pilight-daemon: DEBUG: new thread broadcaster, 5 thread                                                                                             s running
[Oct 22 15:05:11:165141] pilight-daemon: DEBUG: new thread receive parser, 6 thr                                                                                             eads running
[Oct 22 15:05:11:165380] pilight-daemon: DEBUG: new thread events client, 7 thre                                                                                             ads running
[Oct 22 15:05:11:165597] pilight-daemon: DEBUG: new thread events loop, 8 thread                                                                                             s running
[Oct 22 15:05:11:168836] pilight-daemon: DEBUG: ssdp sent search
[Oct 22 15:05:11:169258] pilight-daemon: DEBUG: ssdp sent notify
[Oct 22 15:05:11:170205] pilight-daemon: INFO: new client, ip: 127.0.0.1, port:                                                                                              47620
[Oct 22 15:05:11:170308] pilight-daemon: DEBUG: client fd: 17
[Oct 22 15:05:11:170364] pilight-daemon: DEBUG: client id: 1
[Oct 22 15:05:11:175694] pilight-daemon: DEBUG: broadcasted: {"message":{"gpio":                                                                                             1,"state":"off"},"origin":"receiver","protocol":"gpio_switch","uuid":"0000-b8-27                                                                                             -eb-23f390"}
[Oct 22 15:05:11:275004] pilight-daemon: DEBUG: socket write succeeded: {"action                                                                                             ":"identify","options":{"config":1,"receiver":1},"media":"all"}

[Oct 22 15:05:11:275362] pilight-daemon: INFO: new client, ip: 192.168.20.122, p                                                                                             ort: 35574
[Oct 22 15:05:11:275502] pilight-daemon: DEBUG: client fd: 19
[Oct 22 15:05:11:275621] pilight-daemon: DEBUG: client id: 2
[Oct 22 15:05:11:275862] pilight-daemon: DEBUG: socket recv: {"action":"identify                                                                                             ","options":{"config":1,"receiver":1},"media":"all"}
[Oct 22 15:05:11:276478] pilight-daemon: DEBUG: socket write succeeded: {"status                                                                                             ":"success"}

[Oct 22 15:05:11:994882] pilight-daemon: DEBUG: cpu: 0.000000%
[Oct 22 15:05:14:997680] pilight-daemon: DEBUG: cpu: 1.162645%
[   Oct 22 15:05:18:506] pilight-daemon: DEBUG: cpu: 1.184361%
[  Oct 22 15:05:21:3737] pilight-daemon: DEBUG: cpu: 1.153923%
[  Oct 22 15:05:24:7056] pilight-daemon: DEBUG: cpu: 1.167757%
[ Oct 22 15:05:27:10342] pilight-daemon: DEBUG: cpu: 1.177322%
[ Oct 22 15:05:30:13586] pilight-daemon: DEBUG: cpu: 1.178162%
[ Oct 22 15:05:33:16509] pilight-daemon: DEBUG: cpu: 1.197291%
[Oct 22 15:05:33:803289] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61820
[Oct 22 15:05:33:804182] pilight-daemon: DEBUG: client fd: 42
[Oct 22 15:05:33:813342] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61821
[Oct 22 15:05:33:813439] pilight-daemon: DEBUG: client fd: 42
[Oct 22 15:05:33:816309] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61822
[Oct 22 15:05:33:816405] pilight-daemon: DEBUG: client fd: 45
[Oct 22 15:05:33:819691] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61826
[Oct 22 15:05:33:819790] pilight-daemon: DEBUG: client fd: 47
[Oct 22 15:05:33:829864] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61827
[Oct 22 15:05:33:830015] pilight-daemon: DEBUG: client fd: 42
[Oct 22 15:05:34:114850] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61825
[Oct 22 15:05:34:115004] pilight-daemon: DEBUG: client fd: 42
[Oct 22 15:05:34:117722] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61823
[Oct 22 15:05:34:117819] pilight-daemon: DEBUG: client fd: 49
[Oct 22 15:05:34:715985] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61824
[Oct 22 15:05:34:716097] pilight-daemon: DEBUG: client fd: 49
[Oct 22 15:05:34:765715] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61828
[Oct 22 15:05:34:766007] pilight-daemon: DEBUG: client fd: 49
[Oct 22 15:05:34:789779] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61829
[Oct 22 15:05:34:789876] pilight-daemon: DEBUG: client fd: 49
[Oct 22 15:05:34:900509] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61830
[Oct 22 15:05:34:900648] pilight-daemon: DEBUG: client fd: 49
[Oct 22 15:05:34:901720] pilight-daemon: DEBUG: new client, ip: 192.168.20.100, port: 61831
[Oct 22 15:05:34:901801] pilight-daemon: DEBUG: client fd: 53
[Oct 22 15:05:34:921150] pilight-daemon: DEBUG: socket recv: {"action":"request config"}
[Oct 22 15:05:34:940524] pilight-daemon: DEBUG: socket recv: {"action":"request values"}
[ Oct 22 15:05:36:17334] pilight-daemon: DEBUG: cpu: 2.760470%
[Oct 22 15:05:38:865464] pilight-daemon: DEBUG: socket write succeeded: {"origin":"update","type":1,"uuid":"0000-b8-27-eb-23f390","devices":["Schalter"],"values":{"timestamp":1508684738,"state":"on"}}

[Oct 22 15:05:38:865590] pilight-daemon: DEBUG: broadcasted: {"origin":"update","type":1,"uuid":"0000-b8-27-eb-23f390","devices":["Schalter"],"values":{"timestamp":1508684738,"state":"on"}}
[Oct 22 15:05:38:865983] pilight-daemon: DEBUG: socket write succeeded: {"message":{"gpio":1,"state":"on"},"origin":"receiver","protocol":"gpio_switch","uuid":"0000-b8-27-eb-23f390"}

[Oct 22 15:05:38:866075] pilight-daemon: DEBUG: broadcasted: {"message":{"gpio":1,"state":"on"},"origin":"receiver","protocol":"gpio_switch","uuid":"0000-b8-27-eb-23f390"}
[ Oct 22 15:05:39:17578] pilight-daemon: DEBUG: cpu: 1.640056%
[ Oct 22 15:05:39:87588] pilight-daemon: DEBUG: socket write succeeded: {"origin":"update","type":1,"uuid":"0000-b8-27-eb-23f390","devices":["Schalter"],"values":{"timestamp":1508684739,"state":"off"}}

[ Oct 22 15:05:39:87709] pilight-daemon: DEBUG: broadcasted: {"origin":"update","type":1,"uuid":"0000-b8-27-eb-23f390","devices":["Schalter"],"values":{"timestamp":1508684739,"state":"off"}}
[ Oct 22 15:05:39:88023] pilight-daemon: DEBUG: socket write succeeded: {"message":{"gpio":1,"state":"off"},"origin":"receiver","protocol":"gpio_switch","uuid":"0000-b8-27-eb-23f390"}

[ Oct 22 15:05:39:88101] pilight-daemon: DEBUG: broadcasted: {"message":{"gpio":1,"state":"off"},"origin":"receiver","protocol":"gpio_switch","uuid":"0000-b8-27-eb-23f390"}
[ Oct 22 15:05:42:17585] pilight-daemon: DEBUG: cpu: 1.242427%
[ Oct 22 15:05:45:17632] pilight-daemon: DEBUG: cpu: 1.176524%
[ Oct 22 15:05:48:17652] pilight-daemon: DEBUG: cpu: 1.172424%
[ Oct 22 15:05:51:17674] pilight-daemon: DEBUG: cpu: 1.174496%
[ Oct 22 15:05:54:17730] pilight-daemon: DEBUG: cpu: 1.165329%
[ Oct 22 15:05:57:17796] pilight-daemon: DEBUG: cpu: 1.163478%
[ Oct 22 15:06:00:17794] pilight-daemon: DEBUG: cpu: 1.161853%
[ Oct 22 15:06:03:17832] pilight-daemon: DEBUG: cpu: 1.194930%
[ Oct 22 15:06:06:17848] pilight-daemon: DEBUG: cpu: 1.167366%
[ Oct 22 15:06:09:17834] pilight-daemon: DEBUG: cpu: 1.165960%
[ Oct 22 15:06:12:17892] pilight-daemon: DEBUG: cpu: 1.172192%
Then it works for about 17 minutes. Now the error:
Code:
[ Oct 22 15:21:45:41483] pilight-daemon: DEBUG: cpu: 1.154397%
[ Oct 22 15:21:48:41450] pilight-daemon: DEBUG: cpu: 1.256396%
[ Oct 22 15:21:51:41433] pilight-daemon: DEBUG: cpu: 1.173907%
[ Oct 22 15:21:54:37757] pilight-daemon: ERROR: wiringX failed to open (▒▒t▒▒K for gpio direction ((▒▒t▒▒K)
[ Oct 22 15:21:54:41478] pilight-daemon: DEBUG: cpu: 0.815874%
[ Oct 22 15:21:57:41451] pilight-daemon: DEBUG: cpu: 0.059093%
[ Oct 22 15:22:00:41403] pilight-daemon: DEBUG: cpu: 0.050444%
[ Oct 22 15:22:03:41384] pilight-daemon: DEBUG: cpu: 0.067316%
[ Oct 22 15:22:06:42371] pilight-daemon: DEBUG: cpu: 0.058351%
[ Oct 22 15:22:09:43340] pilight-daemon: DEBUG: cpu: 0.042922%
[ Oct 22 15:22:12:44451] pilight-daemon: DEBUG: cpu: 0.047715%
[ Oct 22 15:22:15:44523] pilight-daemon: DEBUG: cpu: 0.054412%
[ Oct 22 15:22:18:44568] pilight-daemon: DEBUG: cpu: 0.047762%
[Oct 22 15:22:19:286374] pilight-daemon: INFO: Interrupt signal received. Please wait while pilight is shutting down
 
Reply
#9
Can you try this patch:
PHP Code:
--- ../libs/pilight/protocols/GPIO/gpio_switch.c        2017-10-24 20:37:22.845601000 +0200
+++ ../libs/pilight/protocols/GPIO/gpio_switch.c.new    2017-10-24 20:36:09.772369832 +0200
@@ -74,10 +74,@@
                
jchild json_first_child(jid);
                if(
json_find_number(jchild"gpio", &itmp) == 0) {
                        
id = (int)round(itmp);
-                       if(
wiringXISR(idISR_MODE_BOTH) < 0) {
-                               
threads--;
-                               return 
NULL;
-                       }
+                       
pinMode(idPINMODE_INPUT);
                        
state digitalRead(id);
                }
        }
@@ -
85,13 +82,12 @@
        
createMessage(idstate);

        while(
loop) {
-               
irq_read(id);
                
nstate digitalRead(id);
                if(
nstate != state) {
                        
state nstate;
                        
createMessage(idstate);
-                       
usleep(100000);
                }
+               
usleep(100000);
        }

        
threads--; 
 
Reply
#10
I did a test with the patch over 24 hours. It looks very good. No error and no crash. Now it's running. Thanks a lot and kind regards.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Protocol Program PID AdHoc-Client Bigmama 12 763 01-26-2019, 07:36 PM
Last Post: Bigmama
  REST API problem kaku_screen_old / elro_800_switch with pilight 8.1.4 pisperate 4 438 12-20-2018, 09:26 PM
Last Post: pisperate
Exclamation pilight detect wrong protocol quigg_gt9000 is not quigg_gt1000 PCT 1 762 08-12-2018, 11:13 AM
Last Post: Niek
  need some help with program protocol charlesjacob4695 1 407 05-15-2018, 05:58 PM
Last Post: curlymo
  problem with alecto_wx500 protocol (pilight V7) TheWheel 18 5,089 04-12-2018, 06:38 PM
Last Post: NevelS
  deleyCON remote plug socket (arctec_screen_old protocol) itsMe 6 1,104 04-01-2018, 08:35 PM
Last Post: itsMe
  433MHz sender - receiver problem EndruK 1 688 02-17-2018, 02:24 PM
Last Post: EndruK
  arctech_contact protocol missing open/close signals Niek 2 590 12-23-2017, 07:16 PM
Last Post: Niek
  Extend generic protocol mickey.lm 6 1,048 11-20-2017, 10:51 PM
Last Post: mickey.lm
Star How to bind new protocol with GUI polo 11 1,926 11-12-2017, 10:12 PM
Last Post: curlymo

Forum Jump:


Browsing: 1 Guest(s)