• 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
Issue send actions over Socket API in AdHoc network
Dear all,

I've been using pilight for min. 3 years now and so far for every issue that I came across I was able to find a solution by reading the manual or someone had posted a solution on the forum. However, this time I couldn't find a solution for my rather exotic issue.

In order to have batter coverage I'd moved to an adhoc setup which is working well in general. As long as I use the REST API or the build in WebIf to switch my devices everything works as it's supposed to.

Sample http request: pi:5001/send?protocol=pollin&on=1&systemcode=9&unitcode=2&uuid=0000-b8-27-eb-dffca2

The uuid is important here. If it's not provided the socket will not switch. This is a known fact and not my issue.

The actual issue is that I'm not able to switch my devices using the Socket API. Also, I've noticed that the uuid parameter is not documented as part of the action object. I believe if the uuid could be passed over via the Socket API it would solve my issue. On the WebIf the switches change when I send  the Socket message, but my device doesn't switch.

The version of pilight I'm running here is 8.1.4 from the nightly repo.

Any advice would be welcome.

Can you try switching the sockets using pilight-send while passing the UUID parameter?
(02-27-2019, 09:53 PM)curlymo Wrote: Can you try switching the sockets using pilight-send while passing the UUID parameter?

That doesn't work either. The WebIf recognizes the switch, but the pollin device doesn't.
Switching with the WebIf, Android app or via http works fine though.
To be on one line. What's WebIf?
WebIf = the web interface - the build in web server of pilight.
The webserver translates those REST API calls to socket messages as well, so i'm amazed it doesn't work.

Here are the relevant lines:
Let me get this straight sending requests over REST API works fine.
// 20190303160749
// h t t p://pi:5001/send?protocol=pollin&on=1&systemcode=9&unitcode=1&uuid=0000-b8-27-eb-dffca2

 "message": "success"

However, sending a message like this example to port tcp 5000 doesn't.

{  "action": "send",  "code": { "protocol": [ "pollin" ],    "systemcode": 9,    "unitcode": 2,   "on": 1   } }

I get the reply


But nothing happens.
I had no success sending this kind of messages in an AdHoc setup.
It works well in a single instances setup. 

The same result with pilight-send. Executing this command
pilight-send -S= -P=5000 -p=pollin -s=9 -u=1 --on --uuid=0000-b8-27-eb-dffca2
pilight-send -S= -P=5000 -p=pollin -s=9 -u=1 --off --uuid=0000-b8-27-eb-dffca2
flicks the switch on the web interface but no reaction from my device.

Pressing the button on the web interface works fine.
This is something i need to dig deeper into.
This issue should be fixed now in the latest nightly.
Latest nightly seems to not work with adhoc settings.
At my system the pilight-daemon debug tells me „connection to pilight daemon lost“ and is going into an infinite „trying to reconnect“-loop.

Possibly Related Threads...
Thread Author Replies Views Last Post
  Bug: double free or corruption in pilight-send blackzombie 12 1,570 10-07-2019, 08:15 PM
Last Post: blackzombie
  [Fixed] Segmentation fault when using Socket API wrong tomk 2 539 08-19-2019, 07:09 PM
Last Post: curlymo
  Send pulsestream via API Phunkafizer 19 2,818 02-27-2019, 09:54 PM
Last Post: curlymo
  pilight-send and pilight-daemon DieterK 0 961 06-20-2018, 12:44 AM
Last Post: DieterK
  AdHoc network with 2 Raspberry and 2 GPIO transmitter not working webdandy 29 9,665 09-06-2017, 02:39 PM
Last Post: wseifert
  BUG: BMP180 in AdHoc Network Alex 5 2,091 06-19-2016, 02:24 PM
Last Post: Alex
  AdHoc network with different senders Mr.Montesa 6 3,445 02-11-2016, 01:29 PM
Last Post: Karel
  Switching ceiling fan with pilight-send -p raw gadget 4 3,352 01-12-2016, 07:39 PM
Last Post: eunger
  cannot bind to the ssdp multicast network wo_rasp 1 3,232 09-22-2015, 12:10 PM
Last Post: curlymo
  Disable adhoc network? heikoh81 5 4,071 09-17-2015, 09:01 PM
Last Post: heikoh81

Forum Jump:

Browsing: 1 Guest(s)