Page 1 of 1

Values 'speed' and 'gust' from DZvents not correct?

Posted: Monday 19 March 2018 17:42
by schulpr
Hi,

When I print the "Wind" values from DZvents to the log the gust value is lower then the speed value. This seems not oké.

local windsnelheid = domoticz.devices('Wind').speed
local windstoten = domoticz.devices('Wind').gust

The values in the dashboard are correct, the gust is higher than the speed. Is this a bug?

Kind regards, Rob

Re: Values 'speed' and 'gust' from DZvents not correct?

Posted: Monday 19 March 2018 23:48
by waaren
I don't see this.

domoticz V3.9049
dzVents 2.41


2018-03-19 23:38:14.246 dzVents: Gust: 3.6
2018-03-19 23:38:14.246 dzVents: Speed: 2.5999999046326
Wind.PNG
Wind.PNG (17.96 KiB) Viewed 1034 times
The attachment Wind.PNG is no longer available

Re: Values 'speed' and 'gust' from DZvents not correct?

Posted: Tuesday 20 March 2018 7:31
by schulpr
@waaren: can you try it with the settings on km/h in stead of m/s?

When I switch to meters per seconds it works as expected.

BR, Rob

Re: Values 'speed' and 'gust' from DZvents not correct?

Posted: Tuesday 20 March 2018 8:33
by waaren
schulpr wrote: Tuesday 20 March 2018 7:31 @waaren: can you try it with the settings on km/h in stead of m/s?

When I switch to meters per seconds it works as expected.

BR, Rob
@schulpr, You are right; I see the same behaviour when switching to km/h.

Looked a bit into it and the explanation is that the speed value comes directly via the dataset from domoticz to dzVents. The conversion to km/h is already done when it arrives at dzvents. The gust value is obtained from the rawdata part which is an integer (10 times the value in m/s). No further conversion is done in the device-adapter wind_device.lua so gust will allways be shown in m/s no matter what you set in your display settings for windmeters.

Re: Values 'speed' and 'gust' from DZvents not correct?

Posted: Tuesday 20 March 2018 10:11
by waaren
dzVents script to get the display setting for windmeter so you can do your own conversion if/when needed.

Code: Select all

--[[ 
   get WindmeterDisplay setting using the (async) json call 
   on my (PI3) system it takes on average 0.5 seconds until script comes back with settings 
   So after script was triggered twice (once by device or timer and 2nd time by httpResponse)
]] --

return {
	on = { 
	devices = { 'Your triggerdevice name'} ,
        timer = { 'every 30 minutes' },		-- timer or device to trigger the script. Can be both or one of them 
        httpResponses = { 'windmeterSetting' }	-- When json call is answered it will trigger this
    },
	
    execute = function(domoticz, item)
	local debug = true
	function debug_print(myLine)
		if debug then print("***** getWindmetersetting ****** "  .. myLine) end
	end
		
	local myIP="nnn.nnn.nnn.nnn"   -- your domoticz system IP
	local myPort="nnnn"			-- your domoticz port
	
	local windmeterDisplaylist = {"m/s" ,"kn/h" , "mph" ,	"Knots" , "Beaufort" }
        
        if item.isHTTPResponse then
		debug_print("Triggered by HTTPResponse")
		if (item.ok) then -- statusCode == 2xx
                	local setting = item.json.WindUnit
                	debug_print("Setting value: " .. setting .. " ==>> Wind meter display: " .. windmeterDisplaylist[setting + 1] )				
		end
	else
		debug_print("Triggered by device or timer") 
            	domoticz.openURL({
                url = "http://" .. myIP .. ":" .. myPort .. "/json.htm?type=settings",
                method = "GET",
                callback = "windmeterSetting"
            })
        end
    end
}

Re: Values 'speed' and 'gust' from DZvents not correct?

Posted: Tuesday 20 March 2018 17:25
by schulpr
@waaren,

For use in my script I just calculate the value 'm/s' with *36/10 to get the right km/h for now.

local windsnelheid = round((domoticz.devices('Wind').speed),1)
local windstoten = round((domoticz.devices('Wind').gust)*36/10,1)

Thanks anyway for your investigation.

Kind regards, Rob