Page 1 of 1

Simple 'on' command

Posted: Sunday 10 June 2018 17:19
by drwurn
Hi,

I'm new here and new to domoticz. I'm trying to switch a dummy switch with

Code: Select all

http://<IP ADRESS>:8080/json.htm?type=command&param=switchlight&idx=1&switchcmd=on
but results in
{
"message" : "Error sending switch command, check device/hardware !",
"status" : "ERROR",
"title" : "SwitchLight"
}
obviously I'm missing something (or more).

The IDX is correct and the switch is not protected.
I've red something about the localnetwork but not sure what IP to put there.
tested it with 127.0.0.1 as localnework and

Code: Select all

http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=1&switchcmd=on
in the 'on action' of the virtual switch.

What am I missing?

Re: Simple 'on' command

Posted: Sunday 10 June 2018 17:29
by jvdz
Are you sure about IDX 1?
You can check the appropriate IDX in the devices tab of open this url to show them all via JSON:
http://<IP>:8080/json.htm?type=devices

-or- check a specific device via json with url :
http://<IP>:8080/json.htm?type=devices&rid=<IDX>

( replace <IP> and <IDX> with appropriate values)
Jos

EDIT: Fixed typo

Re: Simple 'on' command

Posted: Sunday 10 June 2018 17:35
by drwurn
Yes positive about IDX1.

First device I've added after a fresh reinstall.

http://<IP>:8080/json.htm?type=devices
confirmes IDX1


http://<IP>:8080/json.htm?type=devices,&rid=<IDX>
gives status ERR

Re: Simple 'on' command

Posted: Sunday 10 June 2018 18:22
by waaren
drwurn wrote:
Sunday 10 June 2018 17:35
http://<IP>:8080/json.htm?type=devices,&rid=<IDX>
gives status ERR
remove the comma after devices.

http://<IP>:8080/json.htm?type=devices&rid=<IDX>

Re: Simple 'on' command

Posted: Sunday 10 June 2018 18:23
by jvdz
What details are shown in the devices tab for this IDX 1 dummy switch?

... and ofcourse what @waaren said! :)

Jos

Re: Simple 'on' command

Posted: Sunday 10 June 2018 18:31
by drwurn
http://<IP>:8080/json.htm?type=devices&rid=1

gives

{
"ActTime" : 1528648010,
"ServerTime" : "2018-06-10 18:26:50",
"Sunrise" : "05:09",
"Sunset" : "21:57",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "Off",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 2,
"HardwareName" : "Dummy (hardware)",
"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
"HardwareTypeVal" : 15,
"HaveDimmer" : false,
"HaveGroupCmd" : true,
"HaveTimeout" : false,
"ID" : "67",
"Image" : "Light",
"IsSubDevice" : false,
"LastUpdate" : "2018-06-10 16:40:49",
"Level" : 0,
"LevelInt" : 0,
"MaxDimLevel" : 0,
"Name" : "TelefoonWerner",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" : [ 0 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"Status" : "Off",
"StrParam1" : "aHR0cDovLzEyNy4wLjAuMTo4MDgwL2pzb24uaHRtP3R5cGU9Y29tbWFuZCZwYXJhbT1zd2l0Y2hsaWdodCZpZHg9MSZzd2l0Y2hjbWQ9b24=",
"StrParam2" : "",
"SubType" : "X10",
"SwitchType" : "On/Off",
"SwitchTypeVal" : 0,
"Timers" : "false",
"Type" : "Lighting 1",
"TypeImg" : "lightbulb",
"Unit" : 5,
"Used" : 1,
"UsedByCamera" : false,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "1"
}
],
"status" : "OK",
"title" : "Devices"
}

Re: Simple 'on' command

Posted: Sunday 10 June 2018 18:32
by drwurn
jvdz wrote:
Sunday 10 June 2018 18:23
What details are shown in the devices tab for this IDX 1 dummy switch?

... and ofcourse what @waaren said! :)

Jos
1 Dummy (hardware) C 5 TelefoonWerner Lighting 1 X10 Off

Re: Simple 'on' command

Posted: Sunday 10 June 2018 19:00
by jvdz
Think I know the issue: The last bit needs to be with a capital O in On: &switchcmd=On

so:
http://<IP ADRESS>:8080/json.htm?type=command&param=switchlight&idx=1&switchcmd=On

Jos

Re: Simple 'on' command

Posted: Sunday 10 June 2018 19:28
by drwurn
GENIUS!!

Thanks a lot, you've just maked my day :)