TX20 Wind sensor with Tasmota

Moderator: leecollings

javalin
Posts: 71
Joined: Tuesday 30 April 2019 16:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Portugal
Contact:

TX20 Wind sensor with Tasmota

Post 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.
Attachments
Capture.JPG
Capture.JPG (60.88 KiB) Viewed 4732 times
javalin
Posts: 71
Joined: Tuesday 30 April 2019 16:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Portugal
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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
javalin
Posts: 71
Joined: Tuesday 30 April 2019 16:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Portugal
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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/
Rafaelko
Posts: 11
Joined: Monday 27 November 2023 17:37
Target OS: -
Domoticz version:
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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.
User avatar
waltervl
Posts: 5392
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Rafaelko
Posts: 11
Joined: Monday 27 November 2023 17:37
Target OS: -
Domoticz version:
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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?
Rafaelko
Posts: 11
Joined: Monday 27 November 2023 17:37
Target OS: -
Domoticz version:
Contact:

Re: TX20 Wind sensor with Tasmota

Post by Rafaelko »

In MQTT Explor I see the data.
How do I get the data on IDX?
User avatar
waltervl
Posts: 5392
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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 )
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Rafaelko
Posts: 11
Joined: Monday 27 November 2023 17:37
Target OS: -
Domoticz version:
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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.
User avatar
waltervl
Posts: 5392
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Rafaelko
Posts: 11
Joined: Monday 27 November 2023 17:37
Target OS: -
Domoticz version:
Contact:

Re: TX20 Wind sensor with Tasmota

Post by Rafaelko »

TX20 is not visible in MQTT Explorer.
Rafaelko
Posts: 11
Joined: Monday 27 November 2023 17:37
Target OS: -
Domoticz version:
Contact:

Re: TX20 Wind sensor with Tasmota

Post by Rafaelko »

in tele is TX20 visible but not in domoticz/in
Rafaelko
Posts: 11
Joined: Monday 27 November 2023 17:37
Target OS: -
Domoticz version:
Contact:

Re: TX20 Wind sensor with Tasmota

Post by Rafaelko »

MQTT receives data but does not send it to domoticz
Rafaelko
Posts: 11
Joined: Monday 27 November 2023 17:37
Target OS: -
Domoticz version:
Contact:

Re: TX20 Wind sensor with Tasmota

Post by Rafaelko »

Bildschirmfoto 2023-11-29 um 19.07.37.png
Bildschirmfoto 2023-11-29 um 19.07.37.png (81.96 KiB) Viewed 2563 times
Bildschirmfoto 2023-11-29 um 19.05.55.png
Bildschirmfoto 2023-11-29 um 19.05.55.png (134.43 KiB) Viewed 2563 times
Bildschirmfoto 2023-11-29 um 19.04.03.png
Bildschirmfoto 2023-11-29 um 19.04.03.png (96.73 KiB) Viewed 2563 times
User avatar
waltervl
Posts: 5392
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Rafaelko
Posts: 11
Joined: Monday 27 November 2023 17:37
Target OS: -
Domoticz version:
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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
User avatar
waltervl
Posts: 5392
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Rafaelko
Posts: 11
Joined: Monday 27 November 2023 17:37
Target OS: -
Domoticz version:
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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.
User avatar
waltervl
Posts: 5392
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: TX20 Wind sensor with Tasmota

Post by waltervl »

So the rules are not working. Perhaps ask it in the Tasmota support as this is not related to Domoticz.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Rafaelko
Posts: 11
Joined: Monday 27 November 2023 17:37
Target OS: -
Domoticz version:
Contact:

Re: TX20 Wind sensor with Tasmota

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests