Page 9 of 10

Re: 15326 - [WebServer] Depricated RType

Posted: Saturday 25 November 2023 14:53
by jvdz
houk wrote: ↑Saturday 25 November 2023 14:23 Simpler option is to maintain backward compatibility in domoticz itself and no disabling old format.
I already lost one way to access domoticz via old, not maintained from 2017 year app Imperihome because of changes in domoticz security.
Now another thing in next version will be lost. It shouldn't be like this.
Yea I feel you, I have said about this breaking change what I wanted to say, but decision was made and guess it is an Fait Accompli.

Re: 15326 - [WebServer] Depricated RType

Posted: Saturday 25 November 2023 21:58
by madpatrick
Both Pilot and Domoticz app for IOS are given this error.
Not a big issue because they still are working, but i don’t expect this will be solved.
Both looks abandoned

Re: 15326 - [WebServer] Depricated RType

Posted: Saturday 25 November 2023 22:00
by jvdz
Well the reverse proxy worked for me when the android app had issues. πŸ˜‰

Re: 15326 - [WebServer] Depricated RType

Posted: Sunday 26 November 2023 14:46
by jvdz
This is the proxy definition for OLD requests to New Server which I didn't post in the other topic in case you like to support old API calls with new Domoticz versions:

Code: Select all

server  {
	listen 8081;
	server_name domoapi_Old1New;
	access_log /var/log/nginx/domoapi1new.log;
	error_log /var/log/nginx/domoapi1new.log;
	location / {
		if ($args ~ (^|.*&)type=settings(.*)) { set $args $1type=command&param=getsettings$2; break;}
		if ($args ~ (^|.*&)type=users(.*)) { set $args $1type=command&param=getusers$2; break;}
		if ($args ~ (^|.*&)type=devices(.*)) { set $args $1type=command&param=getdevices$2; break;}
		if ($args ~ (^|.*&)type=hardware(.*)) { set $args $1type=command&param=gethardware$2; break;}
		if ($args ~ (^|.*&)type=events(.*)) { set $args $1type=command&param=events$2; break;}
		if ($args ~ (^|.*&)type=notifications(.*)) { set $args $1type=command&param=getnotifications$2; break;}
		if ($args ~ (^|.*&)type=createdevice(.*)) { set $args $1type=command&param=createdevice$2; break;}
		if ($args ~ (^|.*&)type=scenes(.*)) { set $args $1type=command&param=getscenes$2; break;}
		if ($args ~ (^|.*&)type=plans(.*)) { set $args $1type=command&param=getplans$2; break;}
		if ($args ~ (^|.*&)type=graph(.*)) { set $args $1type=command&param=graph$2; break;}
		if ($args ~ (^|.*&)type=scenelog(.*)) { set $args $1type=command&param=getscenelog$2; break;}
		if ($args ~ (^|.*&)type=mobiles(.*)) { set $args $1type=command&param=getmobiles$2; break;}
		if ($args ~ (^|.*&)type=cameras(.*)) { set $args $1type=command&param=getcameras$2; break;}
		if ($args ~ (^|.*&)type=cameras_user(.*)) { set $args $1type=command&param=getcameras_user$2; break;}
		if ($args ~ (^|.*&)type=schedules(.*)) { set $args $1type=command&param=getschedules$2; break;}
		if ($args ~ (^|.*&)type=timers(.*)) { set $args $1type=command&param=gettimers$2; break;}
		if ($args ~ (^|.*&)type=scenetimers(.*)) { set $args $1type=command&param=getscenetimers$2; break;}
		if ($args ~ (^|.*&)type=setpointtimers(.*)) { set $args $1type=command&param=getsetpointtimers$2; break;}
		if ($args ~ (^|.*&)type=plans(.*)) { set $args $1type=command&param=getplans$2; break;}
		if ($args ~ (^|.*&)type=floorplans(.*)) { set $args $1type=command&param=getfloorplans$2; break;}
		if ($args ~ (^|.*&)type=lightlog(.*)) { set $args $1type=command&param=getlightlog$2; break;}
		if ($args ~ (^|.*&)type=textlog(.*)) { set $args $1type=command&param=gettextlog$2; break;}
		if ($args ~ (^|.*&)type=setused(.*)) { set $args $1type=command&param=setused$2; break;}
		proxy_http_version		1.1;
		proxy_read_timeout		90;
		proxy_set_header        Host $host;
		proxy_set_header        X-Real-IP $remote_addr;
		proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header        X-Forwarded-Proto $scheme;
		proxy_set_header        X-Scheme $scheme;
		proxy_set_header        Upgrade $http_upgrade;
		proxy_set_header        Connection $connection_upgrade;
		add_header              X-Frame-Options SAMEORIGIN;
		proxy_set_header        Authorization "Basic";
		proxy_pass http://localhost:8080/;
	}
}

Re: 15326 - [WebServer] Depricated RType

Posted: Thursday 30 November 2023 0:12
by rewil
type=command&param=switchscene&idx=55&switchcmd=on

switchscene from API not working

Re: 15326 - [WebServer] Depricated RType

Posted: Thursday 30 November 2023 0:44
by waltervl
rewil wrote: ↑Thursday 30 November 2023 0:12 type=command&param=switchscene&idx=55&switchcmd=on

switchscene from API not working
But with switchcmd=On (capital o) it is....

See wiki https://www.domoticz.com/wiki/Domoticz_ ... .2F_Groups

Re: 15326 - [WebServer] Depricated RType

Posted: Thursday 01 February 2024 13:34
by habahabahaba
Hi everybody.

Updated from 2022.2 version and see the same messages.
Spoiler: show
2024-02-01_09-42-04.png
2024-02-01_09-42-04.png (53.45 KiB) Viewed 1837 times
The attachment 2024-02-01_09-42-04.png is no longer available
Yes i read that that is not an error but annoying :oops:

How can i find who is sending and what? And will it cause problems in the future?

Debug mode didnt help.

SystemName "windows"
UseUpdate true
build_time "2024-01-30 11:16:34"
dzvents_version "3.1.8"
hash "731719420"
python_version "3.8.2
status "OK"
title "GetVersion"
version "2024.4"

Only Domoticz and ZigbeeForDomoticz plugin

Re: 15326 - [WebServer] Depricated RType

Posted: Thursday 01 February 2024 13:59
by waltervl
It is sometjing on your server. Could be scripts, a theme, Dashticz that needs to be updated etc.

Re: 15326 - [WebServer] Depricated RType

Posted: Thursday 01 February 2024 14:23
by habahabahaba
waltervl wrote: ↑Thursday 01 February 2024 13:59 It is sometjing on your server. Could be scripts, a theme, Dashticz that needs to be updated etc.
Only native Theme, no Dashticz.

Scripts... disabled everything.. and the same
Spoiler: show
2024-02-01_16-13-53.png
2024-02-01_16-13-53.png (35.72 KiB) Viewed 1826 times
2024-02-01_16-09-40.png
2024-02-01_16-09-40.png (23.04 KiB) Viewed 1826 times
It seems that some zigbee device is sending data

How can i filter out the one?
Or may be the old plugin version? Im using 6.3.015

Re: 15326 - [WebServer] Depricated RType

Posted: Thursday 01 February 2024 14:32
by waltervl
Yes could be the zigbee4Domoticz plugin sending these commands. Did you update it recently?

Edit: from Z4D stable 7 the plugin is compatible with the new API.

Re: 15326 - [WebServer] Depricated RType

Posted: Thursday 01 February 2024 14:55
by habahabahaba
waltervl wrote: ↑Thursday 01 February 2024 14:32 Yes could be the zigbee4Domoticz plugin sending these commands. Did you update it recently?

Edit: from Z4D stable 7 the plugin is compatible with the new API.
I tried but im on windows and its no so easy :)
Gitcmd giving some errors, webUI updating gives nothing.

May be i can download the v.7 and just replace the folder?
Will it work and all devices on their places?

Re: 15326 - [WebServer] Depricated RType

Posted: Thursday 01 February 2024 15:00
by waltervl
habahabahaba wrote: ↑Thursday 01 February 2024 14:55
waltervl wrote: ↑Thursday 01 February 2024 14:32 Yes could be the zigbee4Domoticz plugin sending these commands. Did you update it recently?

Edit: from Z4D stable 7 the plugin is compatible with the new API.
I tried but im on windows and its no so easy :)
Gitcmd giving some errors, webUI updating gives nothing.

May be i can download the v.7 and just replace the folder?
Will it work and all devices on their places?
I dont now, better make a new topic for this in the Zigbee subforum.

Re: 15326 - [WebServer] Depricated RType

Posted: Tuesday 12 March 2024 19:34
by ilex
madpatrick wrote: ↑Saturday 25 November 2023 21:58 Both Pilot and Domoticz app for IOS are given this error.
Not a big issue because they still are working, but i don’t expect this will be solved.
Both looks abandoned
I am affraid You are right :(

Wrote an emil to Pilot developer with no reply at all.

Re: 15326 - [WebServer] Depricated RType

Posted: Saturday 16 March 2024 11:05
by arjan93
I get the "Deprecated RType (graph) for API request. Handled via fallback (graph), please use correct API Command!" error to. After some searching
I found that the problem was created by a script that shows my electricity consumption and cost.

This is the script what triggerd my error:

Code: Select all

local scriptVar = 'ElectricityConsumptionAndCost'

return
{
    on =
    {
        timer = {'every 2 minutes'}, -- Run this script every 2 minutes
        httpResponses = {scriptVar .. '*'},
    },

    logging =
    {
        level = domoticz.LOG_ERROR, -- Change to LOG_DEBUG to debug / Change to LOG_ERROR if script is running properly
        marker = scriptVar,
    },

    data =
    {
        electricity = 
        {
            initial = {},
        },
    },

    execute = function(dz, item)

        -- Variables -------------------------------------------------------
        local inputDevice = dz.devices('Electra') -- Input device (P1)
        local outputDeviceConsumptionToday = dz.devices('Electriciteit Verbruik (vandaag)') -- Output device consumption today
        local outputDeviceConsumptionMonth = dz.devices('Electriciteit Verbruik (maand)') -- Output device consumption month
        local outputDeviceConsumptionYear = dz.devices('Electriciteit Verbruik (jaar)') -- Output device consumption year
        local outputDeviceCostToday = dz.devices('Electriciteit Kosten (vandaag)') -- Output device cost today
        local outputDeviceCostMonth = dz.devices('Electriciteit Kosten (maand)') -- Output device cost month
        local outputDeviceCostYear = dz.devices('Electriciteit Kosten (jaar)') -- Output device cost year

        -- Electricity costs per unit ------
        local costElectricityUnitT1 = 0.36264
        local costElectricityUnitT2 = 0.30987
        local costElectricityUnitR1 = 0.11500
        local costElectricityUnitR2 = 0.11500

        -- Fixed cost per day -------------------------------------------------------------------------------------------------------
        local costElectricityFixedDay = (0.25526 + 1.16656 - 1.7298) -- (Transport cost + Grid operator cost - Energy tax reduction)

        -- Funtion for consumption retrieval ------------
        local function ConsumptionGetGraphData(id, delay)
            local period = 'year'

                electricityURL = dz.settings['Domoticz url'] .. '/json.htm?type=graph&sensor=counter&range=' .. period .. '&idx=' .. id
                dz.openURL({ url = electricityURL, callback = scriptVar .. '_' .. id}).afterSec(delay or 0)

        end

        -- Function for consumption calculation --
        local function makeConsumption(device)
            local currentConsumption

            if device == outputDeviceConsumptionToday then
                currentConsumption = (dz.data.electricity.consumptionTodayT1) + (dz.data.electricity.consumptionTodayT2)
                currentConsumption = currentConsumption - (dz.data.electricity.consumptionTodayR1) - (dz.data.electricity.consumptionTodayR2)
                dz.log('currentConsumption (today): '  .. currentConsumption .. ' kWh', dz.LOG_DEBUG)

            end

            if device == outputDeviceConsumptionMonth then
                currentConsumption = (dz.data.electricity.consumptionMonthT1) + (dz.data.electricity.consumptionMonthT2)
                currentConsumption = currentConsumption - (dz.data.electricity.consumptionMonthR1) - (dz.data.electricity.consumptionMonthR2)
                dz.log('currentConsumption (month): '  .. currentConsumption .. ' kWh', dz.LOG_DEBUG)
                
            end

            if device == outputDeviceConsumptionYear then
                currentConsumption = (dz.data.electricity.consumptionYearT1) + (dz.data.electricity.consumptionYearT2)
                currentConsumption = currentConsumption - (dz.data.electricity.consumptionYearR1) - (dz.data.electricity.consumptionYearR2)
                dz.log('currentConsumption (year): '  .. currentConsumption .. ' kWh', dz.LOG_DEBUG)

            end

            return dz.utils.round(currentConsumption, 3)

        end

        -- Function for cost calculation --
        local function makeCost(device)
            local currentCost

            if device == outputDeviceCostToday then
                currentCost = (dz.data.electricity.consumptionTodayT1 * dz.data.electricity.costElectricityUnitT1) + (dz.data.electricity.consumptionTodayT2 * dz.data.electricity.costElectricityUnitT2)
                currentCost = currentCost - (dz.data.electricity.consumptionTodayR1 * dz.data.electricity.costElectricityUnitR1) - (dz.data.electricity.consumptionTodayR2 * dz.data.electricity.costElectricityUnitR2)
                currentCost = currentCost + (dz.data.electricity.costElectricityFixedDay)
                dz.log('currentCost (today): '  .. currentCost .. ' EUR', dz.LOG_DEBUG)

            end

            if device == outputDeviceCostMonth then
                currentCost = (dz.data.electricity.consumptionMonthT1 * dz.data.electricity.costElectricityUnitT1) + (dz.data.electricity.consumptionMonthT2 * dz.data.electricity.costElectricityUnitT2)
                currentCost = currentCost - (dz.data.electricity.consumptionMonthR1 * dz.data.electricity.costElectricityUnitR1) - (dz.data.electricity.consumptionMonthR2 * dz.data.electricity.costElectricityUnitR2)
                currentCost = currentCost + (dz.data.electricity.costElectricityFixedDay * dz.data.electricity.daysCounterMonth)
                dz.log('currentCost (month): '  .. currentCost .. ' EUR', dz.LOG_DEBUG)
                
            end

            if device == outputDeviceCostYear then
                currentCost = (dz.data.electricity.consumptionYearT1 * dz.data.electricity.costElectricityUnitT1) + (dz.data.electricity.consumptionYearT2 * dz.data.electricity.costElectricityUnitT2)
                currentCost = currentCost - (dz.data.electricity.consumptionYearR1 * dz.data.electricity.costElectricityUnitR1) - (dz.data.electricity.consumptionYearR2 * dz.data.electricity.costElectricityUnitR2)
                currentCost = currentCost + (dz.data.electricity.costElectricityFixedDay * dz.data.electricity.daysCounterYear)
                dz.log('currentCost (year): '  .. currentCost .. ' EUR', dz.LOG_DEBUG)

            end

            return dz.utils.round(currentCost, 2)

        end

        -- Function for updating a Virtual Custom Sensor --
        local function updateCustomSensor(device, value) 
            local currentValue = device.rawData[1]

            if value ~= tonumber(currentValue) then -- Update only necessary when new value differs from the previous one
                device.updateCustomSensor(value)
                dz.log(device.name .. " ==>> Previous value: " .. currentValue .. " ; New value: " .. value,dz.LOG_DEBUG)
            
            end

        end

        -- Function for JSON processing --
        local function ProcessJSON(t)
            local todayVolumeT1, todayVolumeT2, todayVolumeR1, todayVolumeR2 = 0, 0, 0, 0
            local monthVolumeT1, monthVolumeT2, monthVolumeR1, monthVolumeR2 = 0, 0, 0, 0
            local yearVolumeT1, yearVolumeT2, yearVolumeR1, yearVolumeR2 = 0, 0, 0, 0
            local daysCounterMonth = 0
            local daysCounterYear = 0
            local currentDayIdentifier = dz.time.rawDate:sub(1,10)
            local currentMonthIdentifier = dz.time.rawDate:sub(1,4) .. '%-' .. dz.time.rawDate:sub(6,7)
            local day = 86400 -- (24 * 60 * 60)

            for index, inputDevice in ipairs(t) do

                if inputDevice.d == currentDayIdentifier then
                    todayVolumeT1 = todayVolumeT1 + inputDevice.v
                    todayVolumeT2 = todayVolumeT2 + inputDevice.v2
                    todayVolumeR1 = todayVolumeR1 + inputDevice.r1
                    todayVolumeR2 = todayVolumeR2 + inputDevice.r2

                end

                if inputDevice.d:match(currentMonthIdentifier) then
                    monthVolumeT1 = monthVolumeT1 + inputDevice.v
                    monthVolumeT2 = monthVolumeT2 + inputDevice.v2
                    monthVolumeR1 = monthVolumeR1 + inputDevice.r1
                    monthVolumeR2 = monthVolumeR2 + inputDevice.r2
                    daysCounterMonth = daysCounterMonth + 1

                end

                if inputDevice.d:match(dz.time.year) then
                    yearVolumeT1 = yearVolumeT1 + inputDevice.v
                    yearVolumeT2 = yearVolumeT2 + inputDevice.v2
                    yearVolumeR1 = yearVolumeR1 + inputDevice.r1
                    yearVolumeR2 = yearVolumeR2 + inputDevice.r2
                    daysCounterYear = daysCounterYear + 1

                end

            end

            dz.log('daysCounterMonth: '  .. daysCounterMonth, dz.LOG_DEBUG)
            dz.log('daysCounterYear: '  .. daysCounterYear, dz.LOG_DEBUG)

            dz.data.electricity.consumptionTodayT1 = todayVolumeT1
            dz.data.electricity.consumptionTodayT2 = todayVolumeT2
            dz.data.electricity.consumptionTodayR1 = todayVolumeR1
            dz.data.electricity.consumptionTodayR2 = todayVolumeR2
            dz.data.electricity.consumptionMonthT1 = monthVolumeT1
            dz.data.electricity.consumptionMonthT2 = monthVolumeT2
            dz.data.electricity.consumptionMonthR1 = monthVolumeR1
            dz.data.electricity.consumptionMonthR2 = monthVolumeR2
            dz.data.electricity.consumptionYearT1 = yearVolumeT1
            dz.data.electricity.consumptionYearT2 = yearVolumeT2
            dz.data.electricity.consumptionYearR1 = yearVolumeR1
            dz.data.electricity.consumptionYearR2 = yearVolumeR2
            dz.data.electricity.costElectricityUnitT1 = costElectricityUnitT1
            dz.data.electricity.costElectricityUnitT2 = costElectricityUnitT2
            dz.data.electricity.costElectricityUnitR1 = costElectricityUnitR1
            dz.data.electricity.costElectricityUnitR2 = costElectricityUnitR2
            dz.data.electricity.costElectricityFixedDay = (costElectricityFixedDay or 0)
            dz.data.electricity.daysCounterMonth = daysCounterMonth
            dz.data.electricity.daysCounterYear = daysCounterYear

        end

        -- Main -----------------------------------
        if item.isHTTPResponse and item.isJSON then
                ProcessJSON(item.json.result)

        elseif item.isTimer or item.isDevice then
            ConsumptionGetGraphData(inputDevice.id, 0)

            updateCustomSensor(outputDeviceConsumptionToday, makeConsumption(outputDeviceConsumptionToday))
            updateCustomSensor(outputDeviceConsumptionMonth, makeConsumption(outputDeviceConsumptionMonth))
            updateCustomSensor(outputDeviceConsumptionYear, makeConsumption(outputDeviceConsumptionYear))

            updateCustomSensor(outputDeviceCostToday, makeCost(outputDeviceCostToday))
            updateCustomSensor(outputDeviceCostMonth, makeCost(outputDeviceCostMonth))
            updateCustomSensor(outputDeviceCostYear, makeCost(outputDeviceCostYear))

        else
            dz.log('Error retrieving data. Result is: ' .. item.statusText ..' ; Response is: ' .. item.data,LOG_ERROR)

        end

    end
}
Could someone help me with the script? I dont know where the problem is created.

Re: 15326 - [WebServer] Depricated RType

Posted: Saturday 16 March 2024 11:10
by jvdz
This is an pretty easy one as there is only one API call in that script! ;)
Line 49:

Code: Select all

                electricityURL = dz.settings['Domoticz url'] .. '/json.htm?type=graph&sensor=counter&range=' .. period .. '&idx=' .. id
From the API Definitions Wiki:

Code: Select all

Warning Stable 2023.2 (and newer)
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&param=**command**

For example

/json.htm?type=graph will be /json.htm?type=command&param=graph


Re: 15326 - [WebServer] Depricated RType

Posted: Wednesday 20 March 2024 11:10
by arjan93
jvdz wrote: ↑Saturday 16 March 2024 11:10 This is an pretty easy one as there is only one API call in that script! ;)
Line 49:

Code: Select all

                electricityURL = dz.settings['Domoticz url'] .. '/json.htm?type=graph&sensor=counter&range=' .. period .. '&idx=' .. id
From the API Definitions Wiki:

Code: Select all

Warning Stable 2023.2 (and newer)
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&param=**command**

For example

/json.htm?type=graph will be /json.htm?type=command&param=graph

Thanks, that was the trick :D

Re: 15326 - [WebServer] Depricated RType

Posted: Tuesday 09 July 2024 20:26
by McMelloW
@jvdz
Thanks for the solution, works for me too. πŸ‘πŸ‘

Re: 15326 - [WebServer] Depricated RType

Posted: Sunday 02 February 2025 11:41
by waltervl
Note: in beta 2024.7 (december 2024) the old RType API calls have been removed so instead of warnings you now will get errors and no results!!!

Please update your applications and scripts to use the new API calls.

Re: 15326 - [WebServer] Depricated RType

Posted: Tuesday 25 March 2025 16:59
by enboer
I also get this [WebServer] Depricated RType message in 2024.7.
Disabled the scripts\lua, dzvents\scripts, events in the Domoticz GUI, disabled hardware devices/plugins. But this get this message any idea?

Tried to start domoticz with these settings to get some more info:
DAEMON_ARGS="$DAEMON_ARGS -loglevel error,debug -debuglevel webserver"

But then the Domoticz GUI does not come up at all, it keeps trying to load the webpage.

Any help appreciated to get to the source of this issue.

Re: 15326 - [WebServer] Depricated RType

Posted: Tuesday 25 March 2025 17:04
by waltervl
It could well be outside the domoticz server so for example an ESP device updating a Domoticz device.
Is there an IP address connected to the message? Is that IP from an external device or from the server?