• 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
Help: switch a gpio switch with webcontrol on pilight stable
#1
I was triying to change state of this device:

"devices": {
"sw1_filt": {
"protocol": [ "relay" ],
"id": [{
"gpio": 3
}],
"state": "on",
"default-state": "off"
},


with this commandline curl:

curl -v -G http://192.168.1.7:5001/send --data-urlencode "{\"action\":\"control\",\"code\":{\"device\":\"sw1_filt\",\"state\":\"on\"}}"

I allways receive

{"message":"failed"} response

Ive tried a lot of changes on api ("message" instead "action" , "send" instead "control") and other options I could see around forum an wiki documentation.

Im runnig pilight-daemon version v7.0-140-ga2719cf

Please anybody can help me.

Thanks
 
Reply
#2
Please use code tags as described in the forum rules.
 
Reply
#3
Sorry. I dont know why my navigator dont shows tags...
 
Reply
#4
@curlymo the posting box no longer shows code tags :/

@segalion I just noticed this too, you need to write the tags manually for now...
 
Reply
#5
I cant edit or post a message here.

I want to reproduce same post with formated code, and allways response:


Please correct the following errors before continuing:
  • The message is missing. Please enter a message.


I was triying to change state of this device:



with this commandline curl:


Code:
curl -v -G http://192.168.1.7:5001/send --data-urlencode "{\"action\":\"control\",\"code\":{\"device\":\"sw1_filt\",\"state\":\"on\"}}"



I allways receive


Code:
{"message":"failed"}

response

Ive tried a lot of changes on api ("message" instead "action" , "send" instead "control") and other options I could see around forum an wiki documentation.

Im runnig pilight-daemon version v7.0-140-ga2719cf

Please anybody can help me.

Please, I need help this week to put a project in production as soon as posible.


Thanks
 
Reply
#6
@segalion
As with other posts said, I think you're mixing up different cmds for different versions.
With your last post you have:

Quote:Im runnig pilight-daemon version v7.0-140-ga2719cf

Clearly that's saying "I'm Nightly".

The cmd you use is -- afaik -- NOT nightly, but standard!??

Code:
curl -v -G http://192.168.1.7:5001/send --data-urlencode "{\"action\":\"control\",\"code\":{\"device\":\"sw1_filt\",\"state\":\"on\"}}"

Have a look at the Nightly page https://www.pilight.org/nightly/
which has:

Quote:To mimic pilight-control behavior using the REST API:
   
https://x.x.x.x:xx/control?device=switch&state=on
https://x.x.x.x:xx/control?device=label&values[label]=computer is disconnected&values=red

The REST API can parse regular URL input, POST messages, and GET messages.


So you need a different cmd, maybe like this:

Code:
curl -v -G http://192.168.1.7:5001/control?device=sw1_filt&state=on

Give it a try Spiteful


 
Reply
#7
You are right. I have confussing diferent pilight versions.
Thanks for all.
 
Reply
#8
ok so good
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  pilight cpu usage possibly associated with noticeable sluggishness? hepcat72 4 141 01-28-2020, 08:02 PM
Last Post: hepcat72
  apt.pilight.org stable Release' is not signed. thomasol 2 255 01-23-2020, 11:34 PM
Last Post: thomasol
  pilight and SIGNALduino cc1101 Caleus 0 138 01-19-2020, 09:13 AM
Last Post: Caleus
  filter stopped working after update to pilight 8.1.5 zlin50 19 617 01-03-2020, 02:15 PM
Last Post: curlymo
Question [Solved] Openweathermap with pilight 7.0-40 doesn't work Seebueb 2 162 01-01-2020, 06:45 PM
Last Post: Seebueb
  [Solved] Strange receive problem with 433Mhz Receiver and pilight 8.1.5 vanillaice30 15 794 12-18-2019, 11:09 AM
Last Post: vanillaice30
  pilight error after update to 8.1.5 on Odroid C2 WitchDoctor 3 362 11-29-2019, 09:56 PM
Last Post: curlymo
  pilight crashing randomly PatiB 7 605 11-16-2019, 10:50 PM
Last Post: curlymo
  [Fixed] RaspberryPi4 pilight 8.1.5 - Send isn't working DominikB1993 4 616 10-18-2019, 10:25 PM
Last Post: DominikB1993
  Real 433Mhz Remote is disturbed by pilight service henne111 2 504 10-06-2019, 06:18 PM
Last Post: wo_rasp

Forum Jump:


Browsing: 1 Guest(s)