• 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
http GET request error 404 Not Found
#1
I have two servers with pilight on it. Both have pilight 7.0.
Server-Two has been setup recently, Server-One is already running for quite a while. 
Both pilight configurations have the same entries (same devices configured, etc.).
With Server-One I am able to switch devices via:
http://Server-One:5001/control?device= ...

The same url on Server Two (of course with Server-Two in the ip address) leads to the error:
Not Found (error 404). It seems the server does not recognize '/control'

However, Server-Two is able to switch devices via:
http://Server-Two:5001/send?{"action":"control":...
This http request does NOT work on Server-One

Is there some configuration setting which controls how GET http requests?
Thanks - P.
 
Reply
#2
You've missed this in your pilight setup: http://https://manual.pilight.org/en/adhoc-network

Basically, it means that all pilight instances in your network will automatically connect with each other and communicate over the network. The first instance of the pilight-daemon (the one that is started before any others) will become the main daemon, while any subsequent pilight-daemon instances will become clients to this main daemon. All clients are sent the configuration file from the main-daemon, so all nodes work with the same config.

So, your Server-One has become the main daemon which provides the REST api, the webgui, etc. Your Server-Two has become a client node to this main-daemon, and therefore does not serve a webgui or offer the REST api. Therefore, your call to /control? does not work.
 
Reply
#3
Thanks! - the ad-hoc network looks very interesting! I need to take a closer look at it... (I have currently implemented a similar solution by using a mosquitto mqtt broker on my "main" server", the other clients may just subscribe to mqtt messages and just do the switching...) 

However, Server-Two:
- also provides the WebUI 
- also accepts REST calls, just a different url notation:
  http://Server-Two:5001/send?{"action":"control":
  (the above url works on Server-Two)
rather than:
  
http://Server-Two:5001/control?device= 

  (The above does NOT work on Server-Two, only on Server-One, and vice versa!)
  
The result (switching the device) - is the same...
There is just this differenz in the url syntax - which I do not understand. So both server may switch devices, the url syntax is different
 
Reply
#4
If the syntax is different you are also running two different versions.
 
Reply
#5
That's what I thought as well, but calling 'pilight-daemon -V' on

Server-One returns:
  version v7.0-146-g001f2ea

and Server-Two just returns:
  version v7.0

I really don't want to stress that - it's just a bit strange and confusing to me...
It works, which is the important part - it's just not nice to use two different mechanisms
 
Reply
#6
Hmm. I think I see a difference between those numbers Wink

v7.0 is the latest pilight stable version.
v7.0-146-g001f2ea is a developmental nightly version. This means that it is newer than the latest stable and contains developmental code for the next pilight release. The syntax for the REST API has been changed in this version.

So, if you want to use the same API on both Servers, you will need to install the (exact) same version of pilight on both devices.
 
Reply
#7
OK thanks - makes sense.
I like the new API better, it's simpler.
Cheers P.
 
Reply
#8
Yes, that was the point of the new API - it is actually a proper REST API Smile
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  433gpio platform error after raspbian dist upgrade HuberDe 2 37 10-12-2019, 07:35 PM
Last Post: HuberDe
Sad Raspberry Pi: "NOTICE: no pilight ssdp connections found" abusch 8 818 04-30-2019, 09:10 PM
Last Post: curlymo
  error pilightsend, recieve and control hansipi 2 451 11-04-2018, 03:46 PM
Last Post: hansipi
  pilight-receive not found Pikeman 7 977 07-06-2018, 10:44 AM
Last Post: curlymo
  Error with loading LPF firmware Rschnauzer 14 6,951 02-10-2018, 04:21 PM
Last Post: Rschnauzer
  generic_dimmer error / or not visible in 8.0.5 terrar 13 1,550 01-16-2018, 10:04 PM
Last Post: terrar
  Windows HTTP connection andbehtls 1 1,084 01-14-2018, 02:24 PM
Last Post: bnk72
  pilight does no longer start because of hardware error stratege-0815 2 1,004 12-27-2017, 11:16 PM
Last Post: stratege-0815
  ERROR: uv_custom_poll_cb: bad file descriptor Gisto 6 1,523 12-19-2017, 03:03 PM
Last Post: Gisto
  [Solved] Error manual compiling Thuurke 2 1,184 09-02-2017, 05:06 PM
Last Post: Thuurke

Forum Jump:


Browsing: 1 Guest(s)