Simple 'on' command Topic is solved

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
drwurn
Posts: 68
Joined: Sunday 10 June 2018 16:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Simple 'on' command

Post 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?
Last edited by drwurn on Sunday 10 June 2018 17:29, edited 1 time in total.
User avatar
jvdz
Posts: 2336
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Simple 'on' command

Post 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
Last edited by jvdz on Sunday 10 June 2018 18:24, edited 1 time in total.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
drwurn
Posts: 68
Joined: Sunday 10 June 2018 16:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Simple 'on' command

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Simple 'on' command

Post 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>
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
jvdz
Posts: 2336
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Simple 'on' command

Post by jvdz »

What details are shown in the devices tab for this IDX 1 dummy switch?

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

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
drwurn
Posts: 68
Joined: Sunday 10 June 2018 16:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Simple 'on' command

Post 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"
}
drwurn
Posts: 68
Joined: Sunday 10 June 2018 16:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Simple 'on' command

Post 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
User avatar
jvdz
Posts: 2336
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Simple 'on' command

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
drwurn
Posts: 68
Joined: Sunday 10 June 2018 16:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Simple 'on' command

Post by drwurn »

GENIUS!!

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

Who is online

Users browsing this forum: No registered users and 1 guest