question about error  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
mcmikev
Posts: 146
Joined: Tuesday 26 May 2015 8:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: right here
Contact:

question about error

Post 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 ??
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: question about error

Post 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 ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
mcmikev
Posts: 146
Joined: Tuesday 26 May 2015 8:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: right here
Contact:

Re: question about error

Post 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 
}

User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: question about error

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
mcmikev
Posts: 146
Joined: Tuesday 26 May 2015 8:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: right here
Contact:

Re: question about error

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: question about error

Post 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.


Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
mcmikev
Posts: 146
Joined: Tuesday 26 May 2015 8:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: right here
Contact:

Re: question about error

Post by mcmikev »

Remarked line 23 (placed - - before it, without the spaces between) but stil the same error.

Any other ideas?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: question about error

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
mcmikev
Posts: 146
Joined: Tuesday 26 May 2015 8:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: right here
Contact:

Re: question about error

Post by mcmikev »

just made the changes. Let's see

Thanks
mcmikev
Posts: 146
Joined: Tuesday 26 May 2015 8:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: right here
Contact:

Re: question about error  [Solved]

Post by mcmikev »

Yes the error is gone with that edit ! thanks Waaren
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest