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

Easy to use, 100% Lua-based event scripting framework.
Post Reply
schulpr
Posts: 120
Joined: Thursday 01 January 2015 10:10
Target OS: NAS (Synology & others)
Domoticz version: Beta
Contact:

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

Post by schulpr » Monday 19 March 2018 18:42

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

User avatar
waaren
Posts: 816
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

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

Post by waaren » Tuesday 20 March 2018 0:48

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 409 times
The attachment Wind.PNG is no longer available
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

schulpr
Posts: 120
Joined: Thursday 01 January 2015 10:10
Target OS: NAS (Synology & others)
Domoticz version: Beta
Contact:

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

Post by schulpr » Tuesday 20 March 2018 8: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

User avatar
waaren
Posts: 816
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

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

Post by waaren » Tuesday 20 March 2018 9:33

schulpr wrote:
Tuesday 20 March 2018 8: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.
Last edited by waaren on Tuesday 20 March 2018 11:12, edited 1 time in total.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

User avatar
waaren
Posts: 816
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

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

Post by waaren » Tuesday 20 March 2018 11:11

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
}
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

schulpr
Posts: 120
Joined: Thursday 01 January 2015 10:10
Target OS: NAS (Synology & others)
Domoticz version: Beta
Contact:

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

Post by schulpr » Tuesday 20 March 2018 18:25

@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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests