Page 1 of 1
question about error
Posted: Tuesday 23 July 2019 7:56
by mcmikev
Hi,
I run the presence detection with unifi cloudkey script and that was running fine for long time.
Since a few git pulls ago I get errors in the log (and I get mails as well when an error occurs) so I get regular mails now.
The error is : dzVents: Error: (2.4.26) HTTP/1.1 response: 60 ==>> Peer certificate cannot be authenticated with given CA certificates
I know that the cert is not right official because It is self signed and only used internal. How can I stop this error from occuring for internal sites/certs ??
Re: question about error
Posted: Tuesday 23 July 2019 10:42
by waaren
mcmikev wrote: ↑Tuesday 23 July 2019 7:56
The error is : dzVents: Error: (2.4.26) HTTP/1.1 response: 60 ==>> Peer certificate cannot be authenticated with given CA certificates
@mcmikev
Can you please share the script ?
What OS are you on ?
Re: question about error
Posted: Tuesday 23 July 2019 11:49
by mcmikev
rpi3 with stretch
anonymized script
Code: Select all
return {
on = {
timer = { 'every 5 minutes' },
httpResponses = { 'loggedin' , 'data' }
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = 'https://192.168.x.x:8443/api/login', --Change IP and Port to your Unifi Controller settings
method = 'POST',
postData = { ['password'] = 'xxxxxx' , ['username'] = 'xxxxxxx' }, --Change YourPassword en YourUsername to your password en username for Unifi Controller
callback = 'loggedin'
})
end
if (item.isHTTPResponse and item.ok) then
if (item.trigger == 'loggedin') then
domoticz.openURL({
url = 'https://192.168.x.x:8443/api/s/default/stat/sta', --Change IP and Port to your Unifi Controller settings
method = 'GET',
callback = 'data'
})
else
-- iPhone,
local Mac = {'d4:xx:xx:xx:xx:0a'} --Change to mac addresses of devices you want to monitor
local DzIndx = {95,536,694,695} --Change to Domiticz Idx, the position in DxIndx has to be the same as the mac adress for that device in Mac (previous line)
for i,y in ipairs(Mac)
do
home = string.find( item.data , Mac[i])
if (home == nil) then
domoticz.devices(DzIndx[i]).switchOff().checkFirst()
else
domoticz.devices(DzIndx[i]).switchOn().checkFirst()
end
end
end
end
end
}
Re: question about error
Posted: Tuesday 23 July 2019 14:36
by waaren
mcmikev wrote: ↑Tuesday 23 July 2019 11:49
rpi3 with stretch ; anonymized script...
If you change line 15 from
Code: Select all
if (item.isHTTPResponse and item.ok) then
to
Code: Select all
if (item.isHTTPResponse and ( item.ok or item.statusCode == 60 ) ) then
Your script will continue. The error message will still be shown in the log as domoticz / dzVents does see this as an error. If you don't want that you will have to change the runtime module <domoticz dir>/dzVents/runtime/HTTPResponse.lua and comment line 23
Re: question about error
Posted: Friday 23 August 2019 7:22
by mcmikev
Hi Waaren,
In my file on line 23 there is this : self.ok = false
Is that the only line I need to comment out? Getting a bit frustrated with all the errors constantly LOL
Re: question about error
Posted: Friday 23 August 2019 11:02
by waaren
mcmikev wrote:Hi Waaren,
In my file on line 23 there is this : self.ok = false
Is that the only line I need to comment out? Getting a bit frustrated with all the errors constantly LOL
Yes. Just try it and if it works, you will have to repeat that edit every domoticz update.
Re: question about error
Posted: Tuesday 27 August 2019 18:56
by mcmikev
Remarked line 23 (placed - - before it, without the spaces between) but stil the same error.
Any other ideas?
Re: question about error
Posted: Tuesday 27 August 2019 19:28
by waaren
mcmikev wrote: ↑Tuesday 27 August 2019 18:56
Remarked line 23 (placed - - before it, without the spaces between) but stil the same error.
Any other ideas?
Yes, change line 20-23 (now)
Code: Select all
if self.statusCode >= 200 and self.statusCode <= 299 then
self.ok = true
else
self.ok = false
if ( not testResponse ) and ( utils.log(self.protocol .. " response: " .. self.statusCode .. " ==>> " .. self.statusText ,utils.LOG_ERROR) ) then end
end
to
Code: Select all
if self.statusCode >= 200 and self.statusCode <= 299 then
self.ok = true
else
self.ok = false
if self.statusCode ~= 60 then
if ( not testResponse ) and ( utils.log(self.protocol .. " response: " .. self.statusCode .. " ==>> " .. self.statusText ,utils.LOG_ERROR) ) then end
end
end
Re: question about error
Posted: Tuesday 27 August 2019 19:46
by mcmikev
just made the changes. Let's see
Thanks
Re: question about error [Solved]
Posted: Friday 30 August 2019 7:01
by mcmikev
Yes the error is gone with that edit ! thanks Waaren