Closed waltervl closed 2 months ago
Mm oke a breaking change. any idea when it will go out of beta? Thanks for the heads up
There is still some discussion which old API calls will be supported by a deprecation warning (see the forum discussion) untill one or 2 stable versions. Perhaps add the api calls you are using in the forum topic.
In latest beta build the list of backwards compatible API commands is extended https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s#Warning_Beta_Build_15326.2C_1-jun-2023_.28and_newer.29
Hi @waltervl , thx for updating the wiki.
One change, 'events' is not backwards compatible as in the old situation it used the 'param' parameter (which conflicts with type=command) and now it used the 'evparam' parameter.
Hi @waltervl , thx for updating the wiki.
One change, 'events' is not backwards compatible as in the old situation it used the 'param' parameter (which conflicts with type=command) and now it used the 'evparam' parameter.
So what should it be? Something like
/json.htm?type=command¶m=events&evparam=list
these are all the urls the apps currently use:
public interface Url {
@SuppressWarnings("unused")
interface Action {
String ON = "On";
String OFF = "Off";
String UP = "Up";
String STOP = "Stop";
String DOWN = "Down";
String PLUS = "Plus";
String MIN = "Min";
String CLOSE = "Close";
String OPEN = "Open";
}
interface ModalAction {
String AUTO = "Auto";
String ECONOMY = "AutoWithEco";
String AWAY = "Away";
String DAY_OFF = "DayOff";
String CUSTOM = "Custom";
String HEATING_OFF = "HeatingOff";
}
@SuppressWarnings("SpellCheckingInspection")
interface Category {
String ALLDEVICES = "/json.htm?type=devices";
String DEVICES = "/json.htm?type=devices&filter=all&used=true";
String FAVORITES = "/json.htm?type=devices&filter=all&used=true&favorite=1";
String VERSION = "/json.htm?type=command¶m=getversion";
String DASHBOARD = ALLDEVICES + "&filter=all";
String SCENES = "/json.htm?type=scenes";
String SWITCHES = "/json.htm?type=command¶m=getlightswitches";
String WEATHER = ALLDEVICES + "&filter=weather&used=true";
String CAMERAS = "/json.htm?type=cameras";
String CAMERA = "/camsnapshot.jpg?idx=";
String UTILITIES = ALLDEVICES + "&filter=utility&used=true";
String PLANS = "/json.htm?type=plans";
String TEMPERATURE = ALLDEVICES + "&filter=temp&used=true";
String SWITCHLOG = "/json.htm?type=lightlog&idx=";
String TEXTLOG = "/json.htm?type=textlog&idx=";
String SCENELOG = "/json.htm?type=scenelog&idx=";
String SWITCHTIMER = "/json.htm?type=timers&idx=";
String SCENETIMER = "/json.htm?type=scenetimers&idx=";
}
@SuppressWarnings({"SpellCheckingInspection", "unused"})
interface Switch {
String DIM_LEVEL = "Set%20Level&level=";
String COLOR = "&hue=%hue%&brightness=%bright%&iswhite=false";
String KELVIN = "&kelvin=";
String WWCOLOR = "&brightness=%bright%&color={\"m\":2,\"t\":%ww%,\"r\":0,\"g\":0,\"b\":0,\"cw\":%cw%,\"ww\":%ww%}";
String GET = "/json.htm?type=command¶m=switchlight&idx=";
String CMD = "&switchcmd=";
String LEVEL = "&level=";
}
@SuppressWarnings("SpellCheckingInspection")
interface ModalSwitch {
String GET = "/json.htm?type=command¶m=switchmodal&idx=";
String STATUS = "&status=";
}
@SuppressWarnings("SpellCheckingInspection")
interface Scene {
String GET = "/json.htm?type=command¶m=switchscene&idx=";
}
@SuppressWarnings("SpellCheckingInspection")
interface Temp {
String GET = "/json.htm?type=command¶m=udevice&idx=";
String VALUE = "&nvalue=0&svalue=";
String GRAPH = "/json.htm?type=graph&sensor=temp&idx=";
}
@SuppressWarnings("SpellCheckingInspection")
interface Favorite {
String GET = "/json.htm?type=command¶m=makefavorite&idx=";
String SCENE = "/json.htm?type=command¶m=makescenefavorite&idx=";
String VALUE = "&isfavorite=";
}
interface Protocol {
String HTTP = "http://";
String HTTPS = "https://";
}
@SuppressWarnings("SpellCheckingInspection")
interface Device {
String STATUS = "/json.htm?type=devices&rid=";
String SET_USED = "/json.htm?type=setused&idx=";
}
@SuppressWarnings("unused")
interface Sunrise {
String GET = "/json.htm?type=command¶m=getSunRiseSet";
}
@SuppressWarnings({"unused", "SpellCheckingInspection"})
interface Plan {
String GET = "/json.htm?type=plans";
String DEVICES = "/json.htm?type=command¶m=getplandevices&idx=";
}
@SuppressWarnings({"unused", "SpellCheckingInspection"})
interface Log {
String GRAPH = "/json.htm?type=graph&idx=";
String GRAPH_RANGE = "&range=";
String GRAPH_TYPE = "&sensor=";
String GET_LOG = "/json.htm?type=command¶m=getlog&loglevel=";
String GET_FROMLASTLOGTIME = "/json.htm?type=command¶m=getlog&lastlogtime=";
}
@SuppressWarnings({"unused", "SpellCheckingInspection"})
interface Notification {
String NOTIFICATION = "/json.htm?type=notifications&idx=";
}
@SuppressWarnings({"unused", "SpellCheckingInspection"})
interface Security {
String GET = "/json.htm?type=command¶m=getsecstatus";
String CHECKLOGIN = "/json.htm?type=command¶m=logincheck";
String NEWCHECKLOGIN = "/logincheck";
}
@SuppressWarnings({"unused", "SpellCheckingInspection"})
interface UserVariable {
String UPDATE = "/json.htm?type=command¶m=updateuservariable";
}
@SuppressWarnings("SpellCheckingInspection")
interface System {
String SUNRISE = "/json.htm?type=command¶m=getSunRiseSet";
String UPDATE = "/json.htm?type=command¶m=checkforupdate&forced=true";
String USERVARIABLES = "/json.htm?type=command¶m=getuservariables";
String EVENTS = "/json.htm?type=events¶m=list";
String EVENTS_UPDATE_STATUS = "/json.htm?type=events¶m=updatestatus&eventid=";
String RGBCOLOR = "/json.htm?type=command¶m=setcolbrightnessvalue&idx=";
String KELVIN = "/json.htm?type=command¶m=setkelvinlevel&idx=";
String FULLLIGHT = "/json.htm?param=fulllight&type=command&idx=";
String NIGHTLIGHT = "/json.htm?param=nightlight&type=command&idx=";
String SETTINGS = "/json.htm?type=settings";
String CONFIG = "/json.htm?type=command¶m=getconfig";
String SETSECURITY = "/json.htm?type=command¶m=setsecstatus";
String UPDATE_DOWNLOAD_UPDATE = "/json.htm?type=command¶m=downloadupdate";
String UPDATE_DOWNLOAD_READY = "/json.htm?type=command¶m=downloadready";
String UPDATE_DOMOTICZ_SERVER = "/json.htm?type=command¶m=execute_script&scriptname=update_domoticz&direct=true";
String ADD_MOBILE_DEVICE = "/json.htm?type=command¶m=addmobiledevice";
String CLEAN_MOBILE_DEVICE = "/json.htm?type=command¶m=deletemobiledevice";
String LANGUAGE_TRANSLATIONS = "/i18n/domoticz-";
String SEND_NOTIFICATION = "/json.htm?type=command¶m=sendnotification";
String NOTIFICATIONTYPES = "/json.htm?type=notifications";
String USERS = "/json.htm?type=users";
String AUTH = "/json.htm?type=command¶m=getauth";
String LOGOFF = "/json.htm?type=command¶m=dologout";
String LOG = "/json.htm?type=command¶m=addlogmessage&message=";
}
interface Event {
String ON = "&eventstatus=1";
String OFF = "&eventstatus=0";
}
}
public interface FavoriteAction {
String ON = "1";
String OFF = "0";
}
So you still have some API calls without fallback eg
String CAMERAS = "/json.htm?type=cameras";
String SWITCHLOG = "/json.htm?type=lightlog&idx=";
String TEXTLOG = "/json.htm?type=textlog&idx=";
String SCENELOG = "/json.htm?type=scenelog&idx=";
String SWITCHTIMER = "/json.htm?type=timers&idx=";
String SCENETIMER = "/json.htm?type=scenetimers&idx=";
String EVENTS = "/json.htm?type=events¶m=list";
@galadril , I will try to create a PR with the changes for the file mentioned.
Unfortunately I am not able to compile/test, hope that is ok.
@kiddigital It is better to have more fallback.... eases everybody that uses the Domoticz API.... See also https://www.domoticz.com/forum/viewtopic.php?f=6&t=40415&start=60
FYI: With PR https://github.com/domoticz/domoticz/pull/5720 more fallbacks were introduced.
Hello, im still have API problems on Domoticz Premium App! Menu Events not working. Give error "OPSS..." I'm still looking to wait for an app update as soon as possible, in order to solve this problem! Well, I think the events menu is sorely missed. thanks.
Modified title as these API changes also have been implemented in the recently released stable 2023.2 version.
ok so im pushing a new beta build which should detect if it should use the new or old api urls.
Going to remove the old v1 urls, so people need to upgrade after x amount of months backwards compatibility. (first on beta to test)
A warning for your app as Domoticz API has changed in latest beta 15326 (1-jun-2023) https://www.domoticz.com/wiki/Domoticz_ ... d_newer.29
For users using API calls from outside Domoticz there has been some changes in API calls. They now always should be of the form /json.htm?type=command¶m=command
For example
/json.htm?type=graph will be /json.htm?type=command¶m=graph
/json.htm?type=devices will be /json.htm?type=command¶m=getdevices
More info in Forum topic https://www.domoticz.com/forum/viewtopic.php?p=303581#p303581
This wiki page will be updated with the new API format