Page 7 of 10
15326 - [WebServer] Depricated RType
Posted: Wednesday 16 August 2023 7:02
by kiddigital
Run your domoticz instance with `-debuglevel webserver,received,auth` and maybe the debug logs tells us something why authentication does not work.
Most security related improvements where done in 2023.1 and it works in that version. So weird why it does not in 2023.2
Re: 15326 - [WebServer] Depricated RType
Posted: Wednesday 16 August 2023 7:13
by Lokonli
Gravityz wrote: ↑Tuesday 15 August 2023 19:52
trusted network setting is ok. everything(homebridge,docker,domoticz) is running on the same host and ip address 192.168.1.50
all the containers use the same network setting
127.0.0.*;192.168.1.*
i even added 192.168.1.50:8581(this is the homebridge instance)
also switched on basic api authorisation but this did not help either.
it seems i am not the only one with this problem
https://github.com/akamming/homebridge- ... t/issues/1
for now i switched back to 2023.1
hopefully somebody will figur out what the problem is
On 2023.2 can you check the reply of the following:
Code: Select all
curl "http://192.168.50:8084/json.htm?type=command¶m=getauth"
It should give the name of the authorized used.
Re: 15326 - [WebServer] Depricated RType
Posted: Wednesday 16 August 2023 17:06
by Gravityz
the reply on the curl command tested from my router(192.168.1.1) is
Ronald@RT-AX88U-8028:/tmp/home/root# curl "
http://192.168.1.50:8084/json.htm?type= ... am=getauth"
{
"rights" : 2,
"status" : "OK",
"title" : "GetAuth",
"user" : "admin",
"version" : "2023.2 (build 15503)"
}
the reply from my synology(docker host where everything runs)
root@DISKSTATION:~# curl "
http://192.168.1.50:8084/json.htm?type= ... am=getauth" {
"rights" : 2,
"status" : "OK",
"title" : "GetAuth",
"user" : "admin",
"version" : "2023.2 (build 15503)"
}
root@DISKSTATION:~#
i tested both the old curl command as well as the new curl command from the commandline and now it seems to work
the homebridge themostat only seems to work if you use a valid username:password (i created ronald:ronald in domoticz)
also it only works with basic auth on, otherwise it still gives the same 401 error
for now i switched back to 15092 again because the thermostat plugin is generating a lot of depreciated lines and i need to wait before akamming creates a new plugin which uses the new json structure.
Re: 15326 - [WebServer] Depricated RType
Posted: Wednesday 16 August 2023 17:36
by kiddigital
Gravityz wrote: ↑Wednesday 16 August 2023 17:06...
the homebridge themostat only seems to work if you use a valid username:password (i created ronald:ronald in domoticz)
also it only works with basic auth on, otherwise it still gives the same 401 error
If the homebridge is within the Trusted network, than there is no need to provide a username (and pass). But if you do, than it needs to be valid username/password. If invalid, even within the Trusted network, it will be rejected.
btw.. it is good (and secure) practise to give each 'system/plugin' that needs access to the API, their own user/pass. That way it is clear who does what on your system and you can confine systems/plugins to the device(s) they should manage and prevent them to access devices they should not.
Gravityz wrote: ↑Wednesday 16 August 2023 17:06for now i switched back to 15092 again because the thermostat plugin is generating a lot of depreciated lines and i need to wait before akamming creates a new plugin which uses the new json structure.
No need to switch back, the messages are only informational and do no harm.
Re: 15326 - [WebServer] Depricated RType
Posted: Wednesday 16 August 2023 17:46
by Gravityz
thanks
if you do not need a username password when everything is in the trusted network i suspect there is something wrong with this thermostat plugin.
with domoticz 15092(2023.1) and plugin without user:password(left blank)
basic auth off: no error everything working
basic auth on:error 401
with domoticz 15503(2023.2) and plugin without user:password(left blank)
basic auth off: error 401
basic auth on:error 401
with domoticz 15503(2023.2) and plugin WITH user:password(ronald:ronald)
basic auth off: error 401
basic auth on:no erros everything working
Re: 15326 - [WebServer] Depricated RType
Posted: Wednesday 16 August 2023 18:06
by kiddigital
I think the plug-in expect a user/pass to be present. Which it should as it is more secure.
The fact that it could work without, within the Trusted network, does not mean it should.
And to clarify, you can not turn ‘Basic Auth’ on or off. Basic Auth is always available when accessing domoticz over HTTPS. By default, domoticz does not accept Basic Auth when accessed over HTTP as the user/pass info is sent as clear text and not encrypted. But you can tell domoticz to accept it by enabling ‘Basic Auth over HTTP’.

Re: 15326 - [WebServer] Depricated RType
Posted: Wednesday 16 August 2023 18:56
by Gravityz
ok that part is clear.
so somehow the new domoticz can not handle it when no user:password is specified with this plugin
it can be that there still is a bug in the plugin
it could also be that the security in 2023.1 was not functioning properly ang now in 2023.2 they fixed it.
then it is still strange that the trusted network setting should be used(regardless of user:password being specified or not)
but aparently it is not using it
Re: 15326 - [WebServer] Depricated RType
Posted: Wednesday 16 August 2023 19:43
by kiddigital
Gravityz wrote:ok that part is clear.
…
then it is still strange that the trusted network setting should be used(regardless of user:password being specified or not)
but aparently it is not using it
I don’t understand what you mean here. You should preferably use user/pass (or other forms of authentication) OR use Trusted network. Not both to give acces to a system/plugin. And again if any kind of authentication is provided, regardless valid or invalid, Trusted network settings will not be used to authenticate the request.
Re: 15326 - [WebServer] Depricated RType
Posted: Wednesday 16 August 2023 21:34
by Gravityz
kiddigital wrote: ↑Wednesday 16 August 2023 19:43
Gravityz wrote:ok that part is clear.
…
I don’t understand what you mean here. You should preferably use user/pass (or other forms of authentication) OR use Trusted network. Not both to give acces to a system/plugin. And again if any kind of authentication is provided, regardless valid or invalid, Trusted network settings will not be used to authenticate the request.
this is exactly what i mean.
i think some kind of authentification is provided by the plugin, even when the user/password is blank.
security in 2023.1 aparently was not that strict and trusted network was used.
security in 2023.2 probably got upgraded and has problems with the passed credentials thus trusted network is not used but since credentials are not correct it generates the 401 error
when putting in existing credentials and basic auth on it is accepted.
i have to wait and see how the plugin designer interpet my findings.
for now i can indeed switch to 2023.2 and take the warnings for granted
Re: 15326 - [WebServer] Depricated RType
Posted: Friday 25 August 2023 12:40
by pierrotori
i remove all my lua script and i confirm i have a material use not good syntax
viewtopic.php?p=304297&sid=1a90d1664973 ... 48#p304297
Re: 15326 - [WebServer] Depricated RType
Posted: Friday 25 August 2023 15:36
by waltervl
Code: Select all
Deprecated RType (devices) for API request. Handled via fallback (getdevices)
The devices command is normally called by an external user interface (Dashticz, an external app, a custom template/theme etc) or some external script.
It perhaps could be called by a python plugin.
It should not be called by an integrated hardware gateway. Domoticz internally has no references to old commands anymore except for the fallbacks.
It could be that your browser still uses old javascripts but that should be solved by clearing your browser cache.
Check the IP address that is mentioned in the deprecated status log call. If it is your domoticz server, check and update dashticz, scripts, custom themes, custom templates and plugins.
If it is another client, check that client.
Re: 15326 - [WebServer] Depricated RType
Posted: Saturday 26 August 2023 10:29
by guigui
Hello!
I'm having trouble finding the change in the API for the following command:
Code: Select all
type=command¶m=udevice&idx=100&nvalue=0&svalue=237
which allows me to log the electricity voltage.
When I search in the appropriate section (
https://www.domoticz.com/wiki/Domoticz_ ... 7s#Voltage), I still have the syntax of the old API...
No matter how much I change and try:
Code: Select all
type=command¶m=updatedevice&idx=100&nvalue=0&svalue=237'
type=command¶m=getdevices&idx=100&nvalue=0&svalue=237'
Nothing works except:
Code: Select all
type=command¶m=udevice&idx=100&nvalue=0&svalue=237'
which is the old syntax and gives me an error in the log!
Does anyone have the same problem?
Re: 15326 - [WebServer] Depricated RType
Posted: Saturday 26 August 2023 14:59
by waltervl
This seems not a api change issue but a authorisation issue. Api command is OK, Check your log file
Please use another topic for this or make a new one.
Re: 15326 - [WebServer] Depricated RType
Posted: Saturday 26 August 2023 17:05
by Gravityz
i am using the same command and it is runnig fine
192.168.1.50,8084,/json.htm?type=command¶m=udevice&idx=344&nvalue=0&svalue=[Watermeter#Total]
you do know that you need to turn on ALLOW BASIC-AUTH in the domoticz settings.
things will not work anymore without it.
Re: 15326 - [WebServer] Depricated RType
Posted: Friday 01 September 2023 12:39
by desertdog
I am trying to flip a switch according to the documentation. My call is starting with the type=command, but I still get the Depricated RType error. What is wrong with this json call?
Code: Select all
https://USER:PASSWORD@SERVER_IP:4010/json.htm?type=command¶m=switchlight&idx=731&switchcmd=ON
Re: 15326 - [WebServer] Depricated RType
Posted: Friday 01 September 2023 12:49
by waltervl
desertdog wrote: ↑Friday 01 September 2023 12:39
I am trying to flip a switch according to the documentation. My call is starting with the type=command, but I still get the Depricated RType error. What is wrong with this json call?
Code: Select all
https://USER:PASSWORD@SERVER_IP:4010/json.htm?type=command¶m=switchlight&idx=731&switchcmd=ON
Are you sure it is coming from this command? Switchlight is not changed...
What is the exact Depricated RType message you get? it should state the command you tried to use. And the IP address it is coming from.
Re: 15326 - [WebServer] Depricated RType
Posted: Friday 01 September 2023 14:16
by basmaaks
Some can help me out ?
got the message :
[WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (127.0.0.1)
in my log.
I think it's coming from script below but don't know what to modify ?
Code: Select all
return {
on = {
timer = { 'every 2 minutes' },
httpResponses = { 'unifi_loggedin' , 'unifi_data' }
},
data = {
presenceHistory = { history = true, maxMinutes = 6 } -- Change maxMinutes value to appropriate for your devices
},
execute = function(domoticz, item)
local controllerUrl = 'https://192.168.178.42/' --Change IP and Port to your Unifi Controller settings
local controllerLogin = 'SOME_USER' -- Your username for Unifi Controller
local controllerPassword = 'SOME_PASSWORD'-- Your password for Unifi Controller
local devices = {
['BasIphone13'] = 784, -- Telefoon Bas
['iPhonevanHeidi'] = 783, -- Telefoon Heidi
['iPhonemathijs'] = 785 -- Telefoon Mathijs
}
if (item.isTimer) then
local cookie = '/home/pi/domoticz/domocookie.txt'
domoticz.utils.osExecute('rm ' .. cookie .. ' &' )
domoticz.openURL({
url = controllerUrl .. 'api/auth/login',
method = 'POST',
postData = {
['password'] = controllerPassword,
['username'] = controllerLogin
},
callback = 'unifi_loggedin'
})
end
if (item.isHTTPResponse and item.ok) then
if (item.trigger == 'unifi_loggedin') then
domoticz.openURL({
url = controllerUrl .. 'proxy/network/api/s/default/stat/sta',
method = 'GET',
callback = 'unifi_data'
})
end
if (item.trigger == 'unifi_data') then
local presenceHistory = domoticz.data.presenceHistory
for mac, device in pairs(devices) do
local isPresent = string.find(item.data, mac)
presenceHistory.add({
['mac'] = mac,
['isPresent'] = not (isPresent == nil)
})
local wasPresent = presenceHistory.reduce(function(acc, item)
if (item.data.mac == mac and item.data.isPresent) then
acc = acc + 1
end
return acc
end, 0)
if (wasPresent == 0) then
domoticz.devices(device).switchOff().checkFirst()
else
domoticz.devices(device).switchOn().checkFirst()
end
end
end
end
end
}
Re: 15326 - [WebServer] Depricated RType
Posted: Friday 01 September 2023 14:23
by Gravityz
not sure but as far as i can tell you get that error when trying to access domoticz through http or https
this script looks like it is accessing something else(unifi controller) so i doubt it is causing this error(don't shoot me if i'm wrong)
i would check everything which is trying to acces domoticz like
homebridge
homebridge plugings
scripts from you router which are accessing domoticz
calls from esp devices, watermeters
etc,etc
also if it is coming from this script you should see the message every 2 minutes, what is the interval of the messages?
Re: 15326 - [WebServer] Depricated RType
Posted: Friday 01 September 2023 14:42
by basmaaks
Gravityz wrote: ↑Friday 01 September 2023 14:23
not sure but as far as i can tell you get that error when trying to access domoticz through http or https
this script looks like it is accessing something else(unifi controller) so i doubt it is causing this error(don't shoot me if i'm wrong)
i would check everything which is trying to acces domoticz like
homebridge
homebridge plugings
scripts from you router which are accessing domoticz
calls from esp devices, watermeters
etc,etc
also if it is coming from this script you should see the message every 2 minutes, what is the interval of the messages?
sometimes none for several hours in the log and sometimes every 1 minute 4 times in one second. Homebridge is running mqqt and only recieving one temp sensor from domoticz.
got a script running (Python) for my lux sensor, that runs every 5 minutes
Code: Select all
#!/usr/bin/python
import smbus
import time
import
os
# Define some constants from the datasheet
DEVICE = 0x23 # Default device I2C address
POWER_DOWN = 0x00 # No active state
POWER_ON = 0x01 #
Power on
RESET = 0x07 # Reset data register value
bus = smbus.SMBus(1)
def convertToNumber(data):
# Simple function to convert 2 bytes of data
# into a decimal number. Optional parameter 'decimals'
# will round to specified number of decimal places.
result=(data[1] + (256 * data[0])) / 1.2
return (result)
def readLight(addr=DEVICE):
# Read data from I2C interface
data = bus.read_i2c_block_data(addr,0x20)
return convertToNumber(data)
def main():
lightLevel=readLight()
print("Light Level : " + format(lightLevel,'.2f') + " lx")
time.sleep(0.5)
cu1 = 'curl -s -i -H "Accept: application/json" "http://127.0.0.1:8085/json.htm?type=command¶m=udevice&idx=854&svalue='
cu2 = str(readLight())
cu3 = '"'
cu = cu1 + cu2 + cu3
retvalue = os.system(cu)
if __name__=="__main__":
main()
but i don't see a problem in this script
Re: 15326 - [WebServer] Depricated RType
Posted: Friday 01 September 2023 15:09
by Gravityz
that looks fine, i use the same command
do you have the edomoticz plugin in homebridge?