Page 1 of 1

Door Contact - JSON Call

Posted: Thursday 03 November 2016 19:53
by Jzjr
Hi,

I am trying to update a door contact dummy switch through JSON but can't seem to find the correct format. I have tried using switch commands but receive an error.

Can anyone help me to learn the correct command?

Thanks
Fred

Re: Door Contact - JSON Call

Posted: Thursday 03 November 2016 20:16
by safi78
Maybe it helps to show us what command you have used & what error you get? ;)

Re: Door Contact - JSON Call

Posted: Thursday 03 November 2016 21:43
by Egregius
You'll need the udevice command, see wiki.

Re: Door Contact - JSON Call

Posted: Friday 27 January 2017 21:40
by Andrex
I've read the wiki but there is no trace of contacts.
I've tried the udevice (/json.htm?type=command&param=udevice&idx=65&nvalue=0&Status=Open) and even if the result is

Code: Select all

{
   "status" : "OK",
   "title" : "Update Device"
}
the device is not updated, it's always "Closed"

This is the device:

Code: Select all

{
   "ActTime" : 1485549591,
   "ServerTime" : "2017-01-27 21:39:51",
   "Sunrise" : "07:51",
   "Sunset" : "17:21",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "Closed",
         "Description" : "",
         "Favorite" : 0,
         "HardwareID" : 8,
         "HardwareName" : "Dummy",
         "HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
         "HardwareTypeVal" : 15,
         "HaveDimmer" : true,
         "HaveGroupCmd" : true,
         "HaveTimeout" : false,
         "ID" : "00014091",
         "Image" : "Light",
         "IsSubDevice" : false,
         "LastUpdate" : "2017-01-27 21:33:26",
         "Level" : 0,
         "LevelInt" : 0,
         "MaxDimLevel" : 100,
         "Name" : "Andrea Home?",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "Status" : "Closed",
         "StrParam1" : "",
         "StrParam2" : "",
         "SubType" : "Selector Switch",
         "SwitchType" : "Contact",
         "SwitchTypeVal" : 2,
         "Timers" : "false",
         "Type" : "Light/Switch",
         "TypeImg" : "contact",
         "Unit" : 1,
         "Used" : 1,
         "UsedByCamera" : false,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "65"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}
Thanks,
Andrea

Re: Door Contact - JSON Call

Posted: Tuesday 28 November 2017 21:04
by DrEmil
Try this (it works for me):

/json.htm?type=command&param=switchlight&idx=13&switchcmd=On
/json.htm?type=command&param=switchlight&idx=13&switchcmd=Off

Re: Door Contact - JSON Call

Posted: Saturday 05 November 2022 14:38
by Alain
Did you get this working with "open" and "closed"? I don't want it to say "On" or "Off" because it is a contact, not really a switch.