create seperate wind sensors (direction strenght)

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
curious
Posts: 132
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

create seperate wind sensors (direction strenght)

Post by curious »

I want to show some "wind-values" from buienradar presented as separate sensor values.
When I create a virtual sensor with sensortype Wind, a sensor is created that can contain multile values.

How do I create a sensor for "winddirection", a sensor for "windstrength" etc ?
elmortero
Posts: 248
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: create seperate wind sensors (direction strenght)

Post by elmortero »

Hi,

You could use dzvents to first read the separate values you want direction and then write them to the virtual sensors you create for them.
(for example: wDir = domoticz.devices('yourWindsensor').direction)
curious
Posts: 132
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: create seperate wind sensors (direction strenght)

Post by curious »

@elmortero,

I use dzevnts to split the separate values, but I first need to create the virtual sensors for every separate value

But when I create a sensor with the type wind, I get a sensor that expects 5 values. And I want to have a wind sensor with one value
create virtual sensor.JPG
create virtual sensor.JPG (20.04 KiB) Viewed 1511 times
Attachments
created device.JPG
created device.JPG (19.17 KiB) Viewed 1511 times
elmortero
Posts: 248
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: create seperate wind sensors (direction strenght)

Post by elmortero »

You should use custom sensors
curious
Posts: 132
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: create seperate wind sensors (direction strenght)

Post by curious »

That is an option indeed, but I would like to use it in Dashticz, that automatically can change windspeed into Bft which I prefer.
elmortero
Posts: 248
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: create seperate wind sensors (direction strenght)

Post by elmortero »

Hi,

This might be something for you. I don't know about Dashticz as I do not use it.
I made following (dzVents) script and created 4 virtual sensors:
  • Beaufort - a custom sensor with Bft as axis Label
  • Wind Condition - a text sensor with the Beaufort description
  • Wind Description - a text sensor that shows the Beaufort conditions
  • Sea Condition - a text sensor that shows the sea conditions

Code: Select all

return {
	active = true,
	on = {
		timer = {'every 5 minutes'}
		},

	execute = function(domoticz)
	local windDev = domoticz.devices('Wind')				--declare your windspeed device
	local bftDev = domoticz.devices('Beaufort')				--custom sensor
	local windCond = domoticz.devices('Wind Condition')		--text sensor
	local bftLand = domoticz.devices('Wind Description')	--text sensor
	local bftSea = domoticz.devices('Sea Condition')	--text sensor with Sea Conditions
	local windSpeed = windDev.speed							--read windspeed value from your wind device

--description of labels mentioned below
-- bft: the Beaufort value as derived from Beaufort Scale based on current windspeed
-- bftTtext: wind condition as derived from Beaufort Scale based on current Beaufort value (from bft)
-- bftDescLand: Wind condigion description as derived from Beaufort Scale based on current Beaufort value (from bft)
	
	if windSpeed < 1 then 
		bft = 0
		bftTtext = "Calm"
		bftDescLand = "Smoke rises vertically"
		bftDescSea = "Sea like a mirror"
		elseif windSpeed > 1 and windSpeed <= 5 then
		bft = 1
		bftTtext = "Light Air"
		bftDescLand = "Direction shown by smoke drift but not by wind vanes"
		bftDescSea = "Ripples without foam crests"
		elseif windSpeed > 5 and windSpeed <= 11 then
		bft = 2
		bftTtext = "Light Breeze"
		bftDescLand = "Wind felt on face - leaves rustle. Wind vane moved by wind"
		bftDescSea = "Small wavelets still short but more pronounced"		
	elseif windSpeed > 11 and windSpeed <= 19 then
		bft = 3
		bftTtext = "Gentle Breeze"
		bftDescLand = "Leaves and small twigs in constant motion. Light flags extended"
		bftDescSea = "Large wavelets, crests begin to break"
		elseif windSpeed > 19 and windSpeed <= 28 then
		bft = 4
		bftTtext = "Moderate Breeze"
		bftDescLand = "Raises dust and loose paper. Small branches moved."
		bftDescSea = "Small waves becoming longer. Fairly frequent white horses"
	elseif windSpeed > 28 and windSpeed <= 38 then
		bft = 5
		bftTtext = "Fresh Breeze"
		bftDescLand = "Small trees in leaf begin to sway. Crested wavelets form on inland waters."
		bftDescSea = "Moderate waves. Many white horses"
		elseif windSpeed > 38 and windSpeed <= 49 then
		bft = 6
		bftTtext = "Strong Breeze"
		bftDescLand = "Large branches in motion. Whistling heard in telegraph wires. Umbrellas used with difficulty."
		bftDescSea = "Large waves. Extensive white foam crests"
		elseif windSpeed > 49 and windSpeed <= 61 then
		bft = 7
		bftTtext = "Near Gale"
		bftDescLand = "Whole trees in motion. Inconvenience felt when walking against the wind."
		bftDescSea = "Sea heaps up, spindrift begins"
		elseif windSpeed > 61 and windSpeed <= 74 then
		bft = 8
		bftTtext = "Gale"
		bftDescLand = "Twigs break off trees. Generally impedes progress."
		bftDescSea = "Moderately high waves of greater length. Crest edges break into spindrift;"
		elseif windSpeed > 74 and windSpeed <= 88 then
		bft = 9
		bftTtext = "Strong Gale"
		bftDescLand = "Slight structural damage (chimney pots and slates removed)."
		bftDescSea = "High waves, sea begins to roll"
		elseif windSpeed > 88 and windSpeed <= 102 then
		bft = 10
		bftTtext = "Storm"
		bftDescLand = "Seldom experienced inland. Trees uprooted. Considerable structural damage"
		bftDescSea = "Very high waves, rolling becomes heavy."
	elseif windSpeed > 102 and windSpeed <= 117 then
		bft = 11
		bftTtext = "Violent Storm"
		bftDescLand = "Very rarely experienced. Accompanied by widespread damage."
		bftDescSea = "Exceptionally high waves."
		elseif windSpeed > 117 then
		bft = 12
		bftTtext = "Hurricane"
		bftDescLand = "Devastation"
		bftDescSea = "The air is filled with foam and spray, visibility seriously affected"
		end
		
--updating the sensors if different from current so no unneeded updates are done
  --read current info
		local currbft = tonumber(bftDev.rawData[1])
  --update info if beaufort changed
		if currbft ~= bft then 
		bftDev.updateCustomSensor(bft)
		windCond.updateText(bftTtext)
		bftLand.updateText(bftDescLand)
		bftSea.updateText(bftDescSea)
		end
		
	end
}
 
bft.JPG
bft.JPG (40.8 KiB) Viewed 1414 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest