Page 2 of 9

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 9:18
by EdwinK
Didn't think of that one. I have the Machinon theme in use. Trying to switch to default one now.

Edit: It did fix the camera thing, but the devices error still come up. So i guess I need to look further into this.

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 10:12
by Loky31
kiddigital wrote: Monday 05 June 2023 7:06 No mistake, matter of cleaning up old inconsistencies.

Should be easy to fix. Maybe ask the either the author to fix it for you or do it yourself.

Look for the API calls that do not start with `type=command`.

Example `type=devices` should become `type=command&param=getdevices`
Ok thanks for the answer.
Hum many troubles for not a lot...
I revert to a backup but I'm facing something weird. I do not have all the switches in the "switch" tab... the list is short whereas they are all in the device list.
getting crazy after this update... lesson learnt : stop beta !

Is there a way to update to a specific version of domotics? for instance I'm in build 15178, how do I do to go to build 15191 for instance?

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 10:49
by kiddigital
The following RTypes have been migrated to their appropriate Command alternatives

Code: Select all

			// Migrated RTypes to regular commands
			RegisterCommandCode("getusers", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetUsers(session, req, root); });
			RegisterCommandCode("getsettings", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetSettings(session, req, root); });
			RegisterCommandCode("getdevices", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetDevices(session, req, root); });
			RegisterCommandCode("gethardware", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetHardware(session, req, root); });
			RegisterCommandCode("events", [this](auto&& session, auto&& req, auto&& root) { Cmd_Events(session, req, root); });
			RegisterCommandCode("getnotifications", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetNotifications(session, req, root); });
			RegisterCommandCode("createvirtualsensor", [this](auto&& session, auto&& req, auto&& root) { Cmd_CreateMappedSensor(session, req, root); });
			RegisterCommandCode("createdevice", [this](auto&& session, auto&& req, auto&& root) { Cmd_CreateDevice(session, req, root); });

			RegisterCommandCode("getscenelog", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetSceneLog(session, req, root); });
			RegisterCommandCode("getscenes", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetScenes(session, req, root); });
			RegisterCommandCode("addscene", [this](auto&& session, auto&& req, auto&& root) { Cmd_AddScene(session, req, root); });
			RegisterCommandCode("deletescene", [this](auto&& session, auto&& req, auto&& root) { Cmd_DeleteScene(session, req, root); });
			RegisterCommandCode("updatescene", [this](auto&& session, auto&& req, auto&& root) { Cmd_UpdateScene(session, req, root); });
			RegisterCommandCode("getmobiles", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetMobiles(session, req, root); });
			RegisterCommandCode("getcameras", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetCameras(session, req, root); });
			RegisterCommandCode("getcameras_user", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetCamerasUser(session, req, root); });
			RegisterCommandCode("getschedules", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetSchedules(session, req, root); });
			RegisterCommandCode("gettimers", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetTimers(session, req, root); });
			RegisterCommandCode("getscenetimers", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetSceneTimers(session, req, root); });
			RegisterCommandCode("getsetpointtimers", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetSetpointTimers(session, req, root); });
			RegisterCommandCode("getplans", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetPlans(session, req, root); });
			RegisterCommandCode("getfloorplans", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetFloorPlans(session, req, root); });
			RegisterCommandCode("getlightlog", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetLightLog(session, req, root); });
			RegisterCommandCode("gettextlog", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetTextLog(session, req, root); });
			RegisterCommandCode("gettransfers", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetTransfers(session, req, root); });
			RegisterCommandCode("dotransferdevice", [this](auto&& session, auto&& req, auto&& root) { Cmd_DoTransferDevice(session, req, root); });
			RegisterCommandCode("createrflinkdevice", [this](auto&& session, auto&& req, auto&& root) { Cmd_CreateRFLinkDevice(session, req, root); });
			RegisterCommandCode("createevohomesensor", [this](auto&& session, auto&& req, auto&& root) { Cmd_CreateEvohomeSensor(session, req, root); });
			RegisterCommandCode("bindevohome", [this](auto&& session, auto&& req, auto&& root) { Cmd_BindEvohome(session, req, root); });
			RegisterCommandCode("custom_light_icons", [this](auto&& session, auto&& req, auto&& root) { Cmd_CustomLightIcons(session, req, root); });
			RegisterCommandCode("deletedevice", [this](auto&& session, auto&& req, auto&& root) { Cmd_DeleteDevice(session, req, root); });
			RegisterCommandCode("getshareduserdevices", [this](auto&& session, auto&& req, auto&& root) { Cmd_GetSharedUserDevices(session, req, root); });
			RegisterCommandCode("setshareduserdevices", [this](auto&& session, auto&& req, auto&& root) { Cmd_SetSharedUserDevices(session, req, root); });
			RegisterCommandCode("graph", [this](auto&& session, auto&& req, auto&& root) { Cmd_HandleGraph(session, req, root); });
});
			RegisterCommandCode("setused", [this](auto&& session, auto&& req, auto&& root) { Cmd_SetUsed(session, req, root); });

A small set of the RTypes still work as they are mapped to their new Commands:

Code: Select all

				if (rtype.compare("settings") == 0)
				{
					altrtype = "getsettings";
				}
				else if (rtype.compare("users") == 0)
				{
					altrtype = "getusers";
				}
				else if (rtype.compare("devices") == 0)
				{
					altrtype = "getdevices";
				}
				else if (rtype.compare("hardware") == 0)
				{
					altrtype = "gethardware";
				}
				else if (rtype.compare("events") == 0)
				{
					altrtype = "events";
				}
				else if (rtype.compare("notifications") == 0)
				{
					altrtype = "getnotifications";
				}
				else if (rtype.compare("createdevice") == 0)
				{
					altrtype = "createdevice";
				}
When ever an RType API call is received, a message will appear in the log.

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 11:35
by pipiche
gizmocuz wrote: Friday 02 June 2023 14:04 For external API queries, RType queries have been replaced by normal queries.
We might need to update the wiki for these left overs.
The user interface commands (web gui) have been modified
Would it be possible to know to which version of domoticz this relate to. This is required to provide backward compatibility of the plugins

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 11:46
by Loky31
Maybe a crazy idea there, but would it be somehow possible to capture and "translate" those former API calls to the new format ?
A kind of proxy somehow :)

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 14:44
by waltervl

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 16:10
by jvdz
This will be a challenge for standalone applications like DTGBOT to maintain backwards compatibility for current production systems while also implementing support for the current Beta's. :shock:

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 16:36
by waltervl
jvdz wrote: Monday 05 June 2023 16:10 This will be a challenge for standalone applications like DTGBOT to maintain backwards compatibility for current production systems while also implementing support for the current Beta's. :shock:
As I see it most important calls will work and only give deprecation warnings in the log.

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 16:50
by kiddigital
jvdz wrote: Monday 05 June 2023 16:10 This will be a challenge for standalone applications like DTGBOT to maintain backwards compatibility for current production systems while also implementing support for the current Beta's. :shock:
True, goal is to keep this period as short as possible meaning a new Stable is due soon. And looking into keeping some of the most important changed calls to 'translate' them internally. Some are already but maybe that small list gets extended.

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 17:42
by jvdz
Keeping the period short isn't the issue here as there is no cutoff for me implementing the change in DTGBOT.
I need to support both since Domoticz internals doesn't and we honestly may not expect every user of domoticz upgrade at once.
I guess the design/change choice was made so I will go for the approach of retrieving the Revision first and depending on that either use the OLD or NEW format.

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 17:43
by jvdz
waltervl wrote: Monday 05 June 2023 16:36 As I see it most important calls will work and only give deprecation warnings in the log.
As I see it this statement doesn't buy me anything as it doesn't support the version I use in DTGBOT. ;)
... and the warning means it really will be remove at some point of time ...right? When?

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 17:49
by kiddigital
jvdz wrote:
waltervl wrote: Monday 05 June 2023 16:36 As I see it most important calls will work and only give deprecation warnings in the log.
As I see it this statement doesn't buy me anything as it doesn't support the once I use in DTGBOT. ;)
... and the warning means it really will be remove at some point of time ...right? When?
Which ones do you look for?

And yes, eventually (6-18 months?) the backward compatibility support will go away.

We can’t keep supporting Users that do not want to upgrade for ever. Same goes for DTGBOT users. They can also choose to stay on an older version compatible with their older domoticz version.

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 17:57
by jvdz
kiddigital wrote: Monday 05 June 2023 17:49 Which ones do you look for?
In my case it is type=devices/scenes/plans .
kiddigital wrote: Monday 05 June 2023 17:49 And yes, eventually (6-18 months?) the backward compatibility support will go away.
We can’t keep supporting Users that do not want to upgrade for ever. Same goes for DTGBOT users. They can also choose to stay on an older version compatible with their older domoticz version.
Understand how it works, hence my rhetorical question/comment. :)
So please don't worry about it, I know now what the issue is and my only approach is to maintain backwards compatibility for a longer period so will do as I mentioned and using the appropriate format based on the returned revision from the "/json.htm?type=command&param=getversion" restcall.
Tnx

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 22:50
by EdwinK
Don't understand much of this. Hope I'll have more time to look at this later this week. Or maybe next. For now I will have to life with the messages in the status log.

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 23:03
by Lokonli
Are you using Dashticz?

Dashticz still is using the outdated API at some places causing the log massages in Domoticz.

I'm preparing a fix.

Re: 15326 - [WebServer] Depricated RType

Posted: Monday 05 June 2023 23:06
by Loky31
Revert to a version still compatible and will stop update afterthat as I have too many things relying on those calls, and more important some that I'm not able to update myself...

Bye bye domoticz upgrade then ;)

Re: 15326 - [WebServer] Depricated RType

Posted: Tuesday 06 June 2023 8:30
by EdwinK
Lokonli wrote: Monday 05 June 2023 23:03 Are you using Dashticz?

Dashticz still is using the outdated API at some places causing the log massages in Domoticz.

I'm preparing a fix.
Yes, using Dashticz. :) Waiting for a fix then ;)

Re: 15326 - [WebServer] Depricated RType

Posted: Tuesday 06 June 2023 9:28
by jvdz
Isn't dzVents causing these messages too as I see some 28 references that needs changing in the current github source of which 12 seem to be in the core code?:

Code: Select all

\domoticz\dzVents\runtime\device-adapters\evohome_device.lua
  43,7: 					"/json.htm?type=setused&idx=" .. device.id ..

\domoticz\dzVents\runtime\device-adapters\generic_device.lua
  153,6: 				'/json.htm?type=setused&used=true&name=' ..
  172,8: 						'/json.htm?type=setused&used=true&protected=true' ..
  179,8: 						'/json.htm?type=setused&used=true&protected=false' ..

\domoticz\dzVents\runtime\device-adapters\group_device.lua
  56,8: 						'/json.htm?type=updatescene&scenetype=1' ..
  64,54: 			local url = domoticz.settings['Domoticz url'] .. '/json.htm?type=updatescene&scenetype=1' ..
  72,54: 			local url = domoticz.settings['Domoticz url'] .. '/json.htm?type=updatescene&scenetype=1&protected=true' ..
  80,54: 			local url = domoticz.settings['Domoticz url'] .. '/json.htm?type=updatescene&scenetype=1&protected=false' ..

\domoticz\dzVents\runtime\device-adapters\scene_device.lua
  51,54: 			local url = domoticz.settings['Domoticz url'] .. '/json.htm?type=updatescene&scenetype=0' ..
  59,54: 			local url = domoticz.settings['Domoticz url'] .. '/json.htm?type=updatescene&scenetype=0' ..
  67,54: 			local url = domoticz.settings['Domoticz url'] .. '/json.htm?type=updatescene&scenetype=0&protected=true' ..
  75,54: 			local url = domoticz.settings['Domoticz url'] .. '/json.htm?type=updatescene&scenetype=0&protected=false' ..

\domoticz\dzVents\runtime\integration-tests\descriptionScript.lua
  16,49: 			local url = dz.settings['Domoticz url'] ..  "/json.htm?type=scenes"

\domoticz\dzVents\runtime\integration-tests\domoticzTestTools.lua
  285,27: 		-- http://localhost:8080/json.htm?type=hardware
  338,26: 		--http://localhost:8080/json.htm?type=setused&idx=1&name=vdSwitch&description=des&strparam1=&strparam2=&protected=false&switchtype=0&customimage=0&used=true&addjvalue=0&addjvalue2=0&options=

\domoticz\dzVents\runtime\integration-tests\IconScript.lua
  12,49: 			local url = dz.settings['Domoticz url'] ..  '/json.htm?type=devices&rid=' .. item.id

\domoticz\dzVents\runtime\tests\testDevice.lua
  672,41: 			assert.is_same('http://127.0.0.1:8080/json.htm?type=setused&used=true&protected=false&idx=1', res)
  688,41: 			assert.is_same('http://127.0.0.1:8080/json.htm?type=setused&used=true&protected=false&idx=1', res)
  722,41: 			assert.is_same('http://127.0.0.1:8080/json.htm?type=setused&used=true&name=myDevice&description=Description+1&idx=1&switchtype=2&customimage=24', res)
  805,41: 			assert.is_same('http://127.0.0.1:8080/json.htm?type=setused&idx=1&setpoint=&state=Off&mode=Permanent&used=true', res)
  1551,42: 				assert.is_same('http://127.0.0.1:8080/json.htm?type=updatescene&scenetype=0&protected=false&idx=1&name=myScene&description=Description+1', res)
  1554,42: 				assert.is_same('http://127.0.0.1:8080/json.htm?type=updatescene&scenetype=0&protected=true&idx=1&name=myScene&description=Description+1', res)
  1557,42: 				assert.is_same('http://127.0.0.1:8080/json.htm?type=updatescene&scenetype=0&idx=1&name=a&description=Description+1', res)
  1560,42: 				assert.is_same('http://127.0.0.1:8080/json.htm?type=updatescene&scenetype=0&idx=1&name=myScene&description=groupie', res)
  1622,42: 				assert.is_same('http://127.0.0.1:8080/json.htm?type=updatescene&scenetype=1&protected=false&idx=1&name=myGroup&description=Description+1', res)
  1625,42: 				assert.is_same('http://127.0.0.1:8080/json.htm?type=updatescene&scenetype=1&protected=true&idx=1&name=myGroup&description=Description+1', res)
  1628,42: 				assert.is_same('http://127.0.0.1:8080/json.htm?type=updatescene&scenetype=1&idx=1&name=a&description=Description+1', res)
  1631,42: 				assert.is_same('http://127.0.0.1:8080/json.htm?type=updatescene&scenetype=1&idx=1&name=myGroup&description=groupie', res)

Re: 15326 - [WebServer] Depricated RType

Posted: Tuesday 06 June 2023 21:02
by Lokonli
EdwinK wrote: Tuesday 06 June 2023 8:30
Lokonli wrote: Monday 05 June 2023 23:03 Are you using Dashticz?

Dashticz still is using the outdated API at some places causing the log massages in Domoticz.

I'm preparing a fix.
Yes, using Dashticz. :) Waiting for a fix then ;)
Can you test Dashticz 3.10.5 beta?

Re: 15326 - [WebServer] Depricated RType

Posted: Tuesday 06 June 2023 22:15
by EdwinK
Will do ;)

Unfortunately, it still gives the same error.