Page 1 of 1
create seperate wind sensors (direction strenght)
Posted: Wednesday 11 October 2017 21:34
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 ?
Re: create seperate wind sensors (direction strenght)
Posted: Thursday 12 October 2017 10:44
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)
Re: create seperate wind sensors (direction strenght)
Posted: Thursday 12 October 2017 19:22
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 (20.04 KiB) Viewed 1514 times
Re: create seperate wind sensors (direction strenght)
Posted: Saturday 14 October 2017 15:49
by elmortero
You should use custom sensors
Re: create seperate wind sensors (direction strenght)
Posted: Sunday 15 October 2017 21:32
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.
Re: create seperate wind sensors (direction strenght)
Posted: Sunday 22 October 2017 12:33
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 (40.8 KiB) Viewed 1417 times