• 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
REST API - send behaviour
#1
I have a small shell-script

Code:
curl --request POST 'http://raspi-off.localnet:5001/send?' \
     --data 'protocol=kaku_switch_old&on=1&id=2&unit=1'
sleep 2
curl --request POST 'http://raspi-off.localnet:5001/send?' \
     --data 'protocol=kaku_switch_old&on=1&id=1&unit=1'
sleep 2
curl --request POST 'http://raspi-off.localnet:5001/send?' \
     --data 'protocol=kaku_switch&on=1&id=7464862&unit=2'

sleep 5

curl --request POST 'http://raspi-off.localnet:5001/send?' \
     --data 'protocol=kaku_switch_old&off=1&id=2&unit=1'
sleep 2
curl --request POST 'http://raspi-off.localnet:5001/send?' \
     --data 'protocol=kaku_switch_old&off=1&id=1&unit=1'
sleep 2
curl --request POST 'http://raspi-off.localnet:5001/send?' \
     --data 'protocol=kaku_switch&off=1&id=7464862&unit=2'

sleep 2

Running this serveral times, I am getting on each run different results. Sucess means: device is switched off or on resp.

Code:
pi@raspi-inf /var/www/html $ ./send-curl.sh
{"message":"failed"}{"message":"success"}{"message":"success"}{"message":"failed"}{"message":"failed"}{"message":"failed"}
pi@raspi-inf /var/www/html $ ./send-curl.sh
{"message":"failed"}{"message":"success"}{"message":"success"}{"message":"failed"}{"message":"failed"}{"message":"success"}
pi@raspi-inf /var/www/html $ ./send-curl.sh
{"message":"success"}{"message":"success"}{"message":"success"}{"message":"failed"}{"message":"failed"}{"message":"success"}
pi@raspi-inf /var/www/html $ ./send-curl.sh
{"message":"failed"}{"message":"success"}{"message":"success"}{"message":"failed"}{"message":"failed"}{"message":"success"}
pi@raspi-inf /var/www/html $ ./send-curl.sh
{"message":"success"}{"message":"failed"}{"message":"success"}{"message":"failed"}{"message":"failed"}{"message":"success"}

If I get the message FAILED, then I see in the pilight.log "archtech_switch...: insufficient numer or arguments".

Code:
...
Dec 08 18:27:39:176668] pilight-daemon: ERROR: arctech_switch_old: insufficient number of arguments
[Dec 08 18:27:41:252989] pilight-daemon: INFO: client connected, ip 192.168.10.2, port 55811
[Dec 08 18:27:47:485664] pilight-daemon: INFO: client connected, ip 192.168.10.2, port 55812
[Dec 08 18:27:49:566583] pilight-daemon: INFO: client connected, ip 192.168.10.2, port 55813
[Dec 08 18:27:51:637064] pilight-daemon: INFO: client connected, ip 192.168.10.2, port 55814
[Dec 08 18:27:56:741041] pilight-daemon: INFO: client connected, ip 192.168.10.2, port 55815
[Dec 08 18:27:56:741983] pilight-daemon: ERROR: arctech_switch_old: insufficient number of arguments
[Dec 08 18:27:58:839857] pilight-daemon: INFO: client connected, ip 192.168.10.2, port 55816
[Dec 08 18:27:58:840787] pilight-daemon: ERROR: arctech_switch_old: insufficient number of arguments
[Dec 08 18:28:00:914069] pilight-daemon: INFO: client connected, ip 192.168.10.2, port 55817
...

What is wrong with my installation?

The idea behind this test: When I leave my home, I want to switch off different devices. On return, these devices should be switched on again. With IFTTT, a web-request will be sent to my webserver upon leaving my area (Maker Channel).. The web-request in turn will switch the devices with curl communicationg to pilight via the REST API. On Return the same procedure will happen in the opposite direction.
 
Reply
#2
Off topic: I use the ping device to ping our smartphones, when ping fails (after 3 tries, 1 try per minute) it switches off all lights
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  [Fixed] RaspberryPi4 pilight 8.1.5 - Send isn't working DominikB1993 4 67 10-18-2019, 10:25 PM
Last Post: DominikB1993
  pilight-send does not stop (terminate) va13 3 683 05-15-2019, 06:06 PM
Last Post: curlymo
  REST API problem kaku_screen_old / elro_800_switch with pilight 8.1.4 pisperate 4 524 12-20-2018, 09:26 PM
Last Post: pisperate
  RSL366 receive fine, can't send? pukington 2 636 02-15-2018, 11:04 AM
Last Post: pukington
  pilight-send for like rc-switch "send" mindau 1 1,467 01-18-2018, 07:46 AM
Last Post: madmoses
  send-repeats and elro_800_switch Tiberian 2 1,131 11-04-2017, 06:24 PM
Last Post: Tiberian
  Webserver (REST API) - POST TopdRob 7 1,763 10-25-2017, 11:17 PM
Last Post: curlymo
Question How to send custom code? abash 2 1,075 10-11-2017, 06:11 PM
Last Post: curlymo
  pilight send URLEncode sibi 0 813 07-17-2017, 08:59 PM
Last Post: sibi
  i can send alright - no luck receiving varmluft 3 1,231 02-26-2017, 09:16 PM
Last Post: wo_rasp

Forum Jump:


Browsing: 1 Guest(s)