Simple 'on' command Topic is solved

On various Hardware and OS systems: pi / windows / routers / nas, etc
Post Reply
drwurn
Posts: 42
Joined: Sunday 10 June 2018 16:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

Simple 'on' command

Post by drwurn » Sunday 10 June 2018 17:19

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?
Last edited by drwurn on Sunday 10 June 2018 17:29, edited 1 time in total.

User avatar
jvdz
Posts: 1424
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: Simple 'on' command

Post by jvdz » Sunday 10 June 2018 17:29

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
Last edited by jvdz on Sunday 10 June 2018 18:24, edited 1 time in total.

drwurn
Posts: 42
Joined: Sunday 10 June 2018 16:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Simple 'on' command

Post by drwurn » Sunday 10 June 2018 17:35

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

User avatar
waaren
Posts: 1100
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Simple 'on' command

Post by waaren » Sunday 10 June 2018 18:22

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>
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

User avatar
jvdz
Posts: 1424
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: Simple 'on' command

Post by jvdz » 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

drwurn
Posts: 42
Joined: Sunday 10 June 2018 16:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Simple 'on' command

Post by drwurn » Sunday 10 June 2018 18:31

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"
}

drwurn
Posts: 42
Joined: Sunday 10 June 2018 16:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Simple 'on' command

Post by drwurn » Sunday 10 June 2018 18:32

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

User avatar
jvdz
Posts: 1424
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: Simple 'on' command

Post by jvdz » Sunday 10 June 2018 19:00

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

drwurn
Posts: 42
Joined: Sunday 10 June 2018 16:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Simple 'on' command

Post by drwurn » Sunday 10 June 2018 19:28

GENIUS!!

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

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests