• 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
Using API webserver send page
#1
Hi,

I have setup pilight stable 6.0, and added some elro_800_switches succesfully. I can manage them with my remote, webpage. But now i want to switch them using de web send page.

I followed the instructions from http://www.pilight.org/development/api/#webserver, and i get a {"message":"success"} back, but the light doesn't switch.

The url i send is: send?%7B%0A%09%22action%22%3A%20%22send%22%2C%0A%09%22code%22%3A%20%7B%0A%09%09%22device%22%3A%20%22Lampbijdekeuken%22%2C%0A%09%09%22state%22%3A%20%22on%22%09%7D%0A%7D, translated:
Code:
send?{
    "action": "send",
    "code": {
        "device": "Lampbijdekeuken",
        "state": "on"    }
}
I also tried "action": "control" as stated in http://forum.pilight.org/Thread-Big-conf...ite?page=3, but that doesn't resolve my issue.

Anybody know's what i'm supposed to drop here? The docs seems a but unclear to me..
 
Reply
#2
You indeed need to use action control. This worked here:

Code:
{"action":"control","code":{"device":"kerstlicht","state":"off"}}
Ofc, urlencoded.
 
Reply
#3
Thanks for your quick response. Finally i found it: I had to remove all space's and tabs inside the message.. So it's working now!

my send message:
Code:
{"action":"control","code":{"device":"Lampbijdekeuken","state":"on"}}
translated as
Code:
send?%7B%22action%22%3A%22control%22%2C%22code%22%3A%7B%22device%22%3A%22Lampbijdekeuken%22%2C%22state%22%3A%22on%22%7D%7D
is working now!

You also need to put "send?" before the code, and do not 'encode' the question mark! Thats not working. Smile

ps: handy translator here: http://meyerweb.com/eric/tools/dencoder/
 
Reply
#4
Hey, I have a similar issue here with a "generic_label". Target is, using curl from other Pi send free disk space to pilight.

Label settings (without overhead):
Code:
"gen-lbl-satahdd-diskspace": {
                        "protocol": [ "generic_label" ],
                        "id": [{
                                "id": 202
                        }],
                        "label": "(none)",
                        "color": "black"
                },
Calling URL (encoded):
Code:
curl http://192.168.122.65:5001/send?%7B%22action%22%3A%22control%22%2C%22code%22%3A%7B%22device%22%3A%22gen-lbl-satahdd-diskspace%22%2C%22state%22%3A%22$size%22%7D%7D
URL (decoded):
Code:
curl http://192.168.122.65:5001/send?{"action":"control","code":{"device":"gen-lbl-satahdd-diskspace","state":"$size"}}
Also tried this without any changes:
Code:
curl http://192.168.122.65:5001/send?{"action":"control","code":{"device":"gen-lbl-satahdd-diskspace","label":"$size"}}
I then get a following message:
Code:
{"message":"success"}#
.. but nothing happens. Tailing /var/log/pilight.log gives this:
Code:
[ May 28 09:31:15:31498] pilight-daemon: ERROR: generic_label: insufficient number of arguments

What am I missing?
 
Reply
#5
http://forum.pilight.org/Thread-api-does...9#pid12909
 
Reply
#6
Thanks, working like a charm. I doubt I would have looked into that one topic though..
BTW, you have used my naming scheme there.. I'm impressed.. Big Grin
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Can't send or receive on Raspberry Pi Zero W ChristophH 12 440 04-09-2020, 06:34 PM
Last Post: curlymo
  pilight-send seems successful but doesn't actually send RF signal ayeyebrazov 37 1,962 03-31-2020, 01:02 PM
Last Post: curlymo
  NOTICE: 433gpio send buffer full HuberDe 3 426 10-31-2019, 12:10 PM
Last Post: curlymo
  [Fixed] RaspberryPi4 pilight 8.1.5 - Send isn't working DominikB1993 4 863 10-18-2019, 10:25 PM
Last Post: DominikB1993
  [Already fixed in 8.1.2] Loss of webserver-connection Ulrich.Arnold 34 4,775 08-02-2019, 02:25 PM
Last Post: curlymo
  pilight-send does not stop (terminate) va13 3 962 05-15-2019, 06:06 PM
Last Post: curlymo
  RSL366 receive fine, can't send? pukington 2 877 02-15-2018, 11:04 AM
Last Post: pukington
  pilight-send for like rc-switch "send" mindau 1 1,758 01-18-2018, 07:46 AM
Last Post: madmoses
  send-repeats and elro_800_switch Tiberian 2 1,413 11-04-2017, 06:24 PM
Last Post: Tiberian
  Webserver (REST API) - POST TopdRob 7 2,224 10-25-2017, 11:17 PM
Last Post: curlymo

Forum Jump:


Browsing: 1 Guest(s)