Wind Direction with Wemos D1 Mini + Tasmota + Openhab

I thought i would sharemy experience if anybody has something to usein their project :slight_smile:
Some time ago i bought myself Sparkfun Weather Meters and after long time i thought i would use them. At first tried to make electronics with arduino (not so much of success) witch was working but needed two cables (power and LAN). After sime time i figured why not use Wemos D1 Mini with Tasmota firmware? It suited my needs and after some time i got it connected.
Physical connection is quite simple - A0 connected to pin (as well 10K resistor to 3.3V) and the other pin is grounded.
With Tasmota i had to use sensors.bin because it’s the onlyone that gives A0 to software.
I do have mqtt broker allready working and openhab is 2.4.
At first made one Item for RAW value from Tasmota:

Number sensorwind_WindDirRAW "Wind Dir RAW [%s]"  { mqtt="<[mqtt:sonoff/tele/sensorwind/SENSOR:state:JSONPATH($.ANALOG.A0)]" }

And then “banged my head” - how to get right letters fro Wind direction…
After reading openhab docs and forum i started to play with scale transformation.

And it’s easy:

Number WindDirection "Wind as letter [SCALE(analogtowinddir.scale):%s]" { mqtt="<[mqtt:sonoff/tele/sensorwind/SENSOR:state:JSONPATH($.ANALOG.A0)]" }

And then comes the scale file i wanted to share :slight_smile:


I know it makes only real (predefined values) but the analog voltage is not so “pretty” but … it suites my needs. If wanted the last row can be " […]=DirectionUnknown" or something like that.
If anybody want’s they can fine tune the scales but the idea stay’s the same.

1 Like