• 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
  problem publish to pilight MQTT server Emiks5 4 264 08-31-2020, 07:45 PM
Last Post: Emiks5
  pilight for Raspbian Buster (raspberry pi 4) ? starob 32 8,770 08-10-2020, 09:12 AM
Last Post: simanuel
  pilight switch node in node-red framp 0 381 06-24-2020, 10:01 PM
Last Post: framp
  pilight-control TML 13 1,255 05-27-2020, 07:51 AM
Last Post: curlymo
  stable/nightly Release is no longer signed DSLeX 1 545 05-14-2020, 01:09 PM
Last Post: peteratoce
  API Requests by HTTP from other devices fore use in pilight scootermacro 2 607 05-10-2020, 08:19 AM
Last Post: scootermacro
  pilight-send seems successful but doesn't actually send RF signal ayeyebrazov 37 3,804 03-31-2020, 01:02 PM
Last Post: curlymo
  pilight 8.1.5 not working on Raspberry pi after reboot beejayf 4 1,067 03-08-2020, 12:14 AM
Last Post: beejayf
  Sender GPIO constantly under power (sometimes) scootermacro 1 383 03-06-2020, 07:37 PM
Last Post: curlymo
  Trigger a configured switch from other computer by CLI beejayf 3 446 02-24-2020, 07:17 PM
Last Post: beejayf

Forum Jump:


Browsing: 1 Guest(s)