Page 1 of 2
TX20 Wind sensor with Tasmota
Posted: Tuesday 30 April 2019 16:15
by javalin
Hello everybody. At this moment I have plugged a TX20 Wind sensor on a Sonoff Basic with Tasmota, works like a charm and I can read the values from wind sensor perfectly and I would like to collect data and sent it to Domoticz, I tried to setup in Tasmota (Configure Domoticz option), but I dont find a choice for Sensor idx 10 Wind or similar. I think must be possible and I would appreciate any advice. This is de data I would like to sent to domoticz server:
Kind regards.
Re: TX20 Wind sensor with Tasmota
Posted: Wednesday 01 May 2019 0:03
by javalin
This would be a solution?
1) Create a dummy device according my needs
2) Write a dz_Vents script that gathers all data and update the dummy device
Re: TX20 Wind sensor with Tasmota
Posted: Thursday 18 February 2021 9:12
by javalin
The solution have been create a rule in tasmota to publish MQTT message in domoticz as follows:
Rule1
on tele-TX20#Speed#Avg do var1= 5.14444444*%value% endon
on tele-TX20#Speed#Max do var2= 5.14444444*%value% endon
on tele-TX20#Dir#Avg do var3 %value% endon
on tele-TX20#Dir#AvgCard do publish domoticz/in {"idx":295,"svalue":"%var3%;%value%;%var1%;%var2%;0;0"} endon
Important:
1) Domoticz only ACCEPTS wind data input units: 10*m/s, so I have converted knots (my wind sensor unit) to 10*m/s with 5.14444 factor, check:
https://www.domoticz.com/wiki/Domoticz_ ... URL's#Wind
2) To be able convert data to 10*m/s you need compile your own tasmota firmare, check:
https://tasmota.github.io/docs/Rules/
Add the following to user_config_override.h:
#define USE_EXPRESSION // Add support for expression evaluation in rules (+3k2 code, +64 bytes mem)
#define SUPPORT_IF_STATEMENT // Add support for IF statement in rules (+4k2 code, -332 bytes mem)
Beginning with Tasmota version 6.4.1.14, an optional feature for using mathematical expressions in rules was introduced.
Once the feature is enabled, expressions can use of the following operators. They are listed by the order of operations priority, from higher to lower.
( ) (parentheses can be used to explicitly control the order of operations)
^ (power)
% (modulo, division by zero returns modulo "0")
* and / (multiplication and division; division by zero returns "0")
+ and - (addition and subtraction)
3) Wiki how to setup anemometer with ESP8266 chip:
https://tasmota.github.io/docs/TX2x/
Re: TX20 Wind sensor with Tasmota
Posted: Monday 27 November 2023 17:41
by Rafaelko
Hello,
After a long search I found and bought a TX20.
I've been trying to integrate the data into Domotcz for days.
I don't get any ads in Domoticz.
Do I still need dzVents script?
Thank you for your answers.
Re: TX20 Wind sensor with Tasmota
Posted: Monday 27 November 2023 18:52
by waltervl
What data is sent to MQTT?
Does it comply with the Domoticz MQTT rules?
https://www.domoticz.com/wiki/MQTT#MQTT_to_Domoticz
Re: TX20 Wind sensor with Tasmota
Posted: Tuesday 28 November 2023 11:48
by Rafaelko
Hello,
thanks for the reply.
I took the rouls from above. adjust idx.
I don't see the data arriving in Domoticz.
Where can I look?
Re: TX20 Wind sensor with Tasmota
Posted: Tuesday 28 November 2023 12:58
by Rafaelko
In MQTT Explor I see the data.
How do I get the data on IDX?
Re: TX20 Wind sensor with Tasmota
Posted: Tuesday 28 November 2023 16:30
by waltervl
Create a dummy wind device
https://www.domoticz.com/wiki/Dummy_for ... l_Switches
Read the IDX from the edit page of that device or look into the device list (menu Setup - Devices)
Use that IDX in the Tasmota Rules (assuming you have MQTT Client Gateway enabled in your Domoticz environment
https://www.domoticz.com/wiki/MQTT#Add_ ... Gateway.22 )
Re: TX20 Wind sensor with Tasmota
Posted: Wednesday 29 November 2023 11:27
by Rafaelko
I did all of that.
This message comes in
Domoticz Protokoll:
2023-11-29 10:46:35.665 Error: MQTT Gateway Wind: unknown idx received! (idx 0)
MQTT Client Gateway is OK. other devices work.
Re: TX20 Wind sensor with Tasmota
Posted: Wednesday 29 November 2023 16:48
by waltervl
So the MQTT message is not correct as Domoticz gets idx = 0 instead of your idx value.
Can you install MQTT explorer and paste the update message of the device? It should be in domoticz/in
https://www.domoticz.com/wiki/MQTT#Debugging_MQTT
Re: TX20 Wind sensor with Tasmota
Posted: Wednesday 29 November 2023 17:38
by Rafaelko
TX20 is not visible in MQTT Explorer.
Re: TX20 Wind sensor with Tasmota
Posted: Wednesday 29 November 2023 17:39
by Rafaelko
in tele is TX20 visible but not in domoticz/in
Re: TX20 Wind sensor with Tasmota
Posted: Wednesday 29 November 2023 17:46
by Rafaelko
MQTT receives data but does not send it to domoticz
Re: TX20 Wind sensor with Tasmota
Posted: Wednesday 29 November 2023 19:11
by Rafaelko

- Bildschirmfoto 2023-11-29 um 19.07.37.png (81.96 KiB) Viewed 4066 times

- Bildschirmfoto 2023-11-29 um 19.05.55.png (134.43 KiB) Viewed 4066 times

- Bildschirmfoto 2023-11-29 um 19.04.03.png (96.73 KiB) Viewed 4066 times
Re: TX20 Wind sensor with Tasmota
Posted: Wednesday 29 November 2023 19:52
by waltervl
So tasmota rules are not working as it should send something to domoticz/in
Eg
{"idx":1234, "svalue":"an;dr;sp;gu"}
where an and dr are used to show the angle and wind direction, where an is the angle (can be any number and my have digits after the decimal) and dr is the direction. You can use N, NE, E, SE, S, SW, W and NW. sp is the speed in 0.1 m/s and gu is the gust speed in 0.1 m/s.
Re: TX20 Wind sensor with Tasmota
Posted: Thursday 30 November 2023 7:22
by Rafaelko
I use the Rule from javalin:
Rule1
on tele-TX20#Speed#Avg do var1= 5.14444444*%value% endon
on tele-TX20#Speed#Max do var2= 5.14444444*%value% endon
on tele-TX20#Dir#Avg do var3 %value% endon
on tele-TX20#Dir#AvgCard do publish domoticz/in {"idx":592,"svalue":"%var3%;%value%;%var1%;%var2%;0;0"} endon
I Add the following to user_config_override.h:
#define USE_EXPRESSION // Add support for expression evaluation in rules (+3k2 code, +64 bytes mem)
#define SUPPORT_IF_STATEMENT // Add support for IF statement in rules (+4k2 code, -332 bytes mem)
Can it be that the values are not calculated?
on tele-TX20#Speed#Avg do var1= 5.14444444*%value% endon
on tele-TX20#Speed#Max do var2= 5.14444444*%value% endon
When I turn on I don't see the values in MQTT Explorer
Re: TX20 Wind sensor with Tasmota
Posted: Thursday 30 November 2023 16:32
by waltervl
I do not know, I believe there is some log viewing option on Tasmota to see what the device is doing. This is probably in the Console menu on the Tasmota webUI
Re: TX20 Wind sensor with Tasmota
Posted: Thursday 30 November 2023 16:47
by Rafaelko
Is from Tasmota console
Updates every 3 sec.
16:45:36.422 MQT: tele/Windmesser/STATE = {"Time":"2023-11-30T16:45:36","Uptime":"0T04:15:38","UptimeSec":15338,"Heap":24,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"OFF","Wifi":{"AP":1,"SSId":"Rafffaelo","BSSId":"38:10:D5:D2:6F:81","Channel":1,"Mode":"11n","RSSI":44,"Signal":-78,"LinkCount":1,"Downtime":"0T00:00:03"}}
16:45:36.432 MQT: tele/Windmesser/SENSOR = {"Time":"2023-11-30T16:45:36","TX20":{"Speed":{"Act":9.7,"Avg":2.7,"Min":0.0,"Max":22.0},"Dir":{"Card":"SSW","Deg":202.5,"Avg":202.5,"AvgCard":"SSW","Min":202.5,"Max":202.5,"Range":0.0}},"SpeedUnit":"km/h"}
the same Data is in MQTT Explorer.
Re: TX20 Wind sensor with Tasmota
Posted: Thursday 30 November 2023 17:42
by waltervl
So the rules are not working. Perhaps ask it in the Tasmota support as this is not related to Domoticz.
Re: TX20 Wind sensor with Tasmota
Posted: Monday 11 December 2023 23:10
by Rafaelko
It works.
I made a mistake at Copy from Rule.
The word Rule1 must not go in Tasmota Console.
To date I have had no experience with Rules.