Hello all
I've just setup a D1 mini (4M) with an SR04 attached running Tasmota. This is functioning as expected.
It sends data via MQTT and the MQTT server (mosquito) reports the distance correctly.
However Dom reports the distance incorrectly. It seems as though it moves the decimal point.
16cm is reported as 1.6cm
I've used MQTT as I couldn't work out how to setup a dummy device properly.
Version: 2024.4
Build Hash: 731719420
Compile Date: 2024-01-30 21:16:34
dzVents Version: 3.1.8
Python Version: 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
On Debian 11
mosquitto version 2.0.11
Any assistance would be most helpful.
Regards
Fred
Dom + SR04 incorrect distance Topic is solved
Moderators: leecollings, remb0
-
- Posts: 30
- Joined: Monday 08 June 2020 6:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Dom + SR04 incorrect distance
- Attachments
-
- Tasmota.png (18.3 KiB) Viewed 1160 times
-
- mqtt.png (60.21 KiB) Viewed 1160 times
-
- dom1.png (22.99 KiB) Viewed 1160 times
- waltervl
- Posts: 5843
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Dom + SR04 incorrect distance
What kind of mqtt integration are you using for talking Tasmota with Domoticz?
Mqtt Autodiscover? Mqtt mapper python plugin? Tasmotateach script?
It seems you use mqtt Auto Discover. What is the mqtt config topic for this water level device.
Should be somewhere in the Tasmota topic.
Mqtt Autodiscover? Mqtt mapper python plugin? Tasmotateach script?
It seems you use mqtt Auto Discover. What is the mqtt config topic for this water level device.
Should be somewhere in the Tasmota topic.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- psubiaco
- Posts: 222
- Joined: Monday 20 August 2018 9:38
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Italy
- Contact:
Re: Dom + SR04 incorrect distance
You can write a simple script that, event triggered, that when the distance sensor is updated, it updates a second distance sensor with value/10 to convert mm to cm.
This can be useful expecially for a water tank , so you can use the script to convert the distance (in mm) to the water tank level in cm
(e.g. if distance between sensor and water is 350mm and between sensor and tank floor is 150cm, water tank level = 150-350/10=115cm)
If you need help to write a similar script, I can help you.
This can be useful expecially for a water tank , so you can use the script to convert the distance (in mm) to the water tank level in cm
(e.g. if distance between sensor and water is 350mm and between sensor and tank floor is 150cm, water tank level = 150-350/10=115cm)
If you need help to write a similar script, I can help you.
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
-
- Posts: 30
- Joined: Monday 08 June 2020 6:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dom + SR04 incorrect distance
TasmoticzWhat kind of mqtt integration are you using for talking Tasmota with Domoticz?
Autodiscovery of Tasmota Devices for Domoticz
Topic = Water_LevelIt seems you use mqtt Auto Discover. What is the mqtt config topic for this water level device.
Should be somewhere in the Tasmota topic
Full Topic = %prefix%/%topic%/
I simply don't have the skill set to be writing my own name let alone any kind of script. Sorry.You can write a simple script that, event triggered...
Regards
Fred
- waltervl
- Posts: 5843
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Dom + SR04 incorrect distance
Do you have a link to the description/instruction of Tasmoticz
Autodiscovery of Tasmota Devices for Domoticz?
As I am not aware of this.
You could try to set tasmoticz to send mm instead of cm. There is a factor 10 somewhere... And it is not in Domoticz, if Domoticz gets value 15 it is displayed as 15 cm.
Autodiscovery of Tasmota Devices for Domoticz?
As I am not aware of this.
You could try to set tasmoticz to send mm instead of cm. There is a factor 10 somewhere... And it is not in Domoticz, if Domoticz gets value 15 it is displayed as 15 cm.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 30
- Joined: Monday 08 June 2020 6:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dom + SR04 incorrect distance
https://github.com/joba-1/TasmoticzDo you have a link to the description/instruction of Tasmoticz
Autodiscovery of Tasmota Devices for Domoticz?
What I am confused about is that the MQTT server (mosquito) is receiving the correct value from the Tasmota client, and somehow Domoticz is reading/interpreting it wrong.
Now I'm not sure if the mqtt server is providing the data to Dom properly or if Dom is reading it wrong, and I don't know how to test/check that.
It may be worth my while setting up a dummy device therefore eliminating the need for mqtt, but I don't know how to do that.
It should be noted that I do have numerous other temp/hum/switch/relay devices connected to Dom via mqtt and they all work as expected.
Regards
Fred
- waltervl
- Posts: 5843
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Dom + SR04 incorrect distance
You better make an issue on the tasmoticz python plugin as that seems to do something wrong.
Looking on this line in the plugin https://github.com/joba-1/Tasmoticz/blo ... ta.py#L233
You should use cm as unit instead of mm
Looking on this line in the plugin https://github.com/joba-1/Tasmoticz/blo ... ta.py#L233
You should use cm as unit instead of mm
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 30
- Joined: Monday 08 June 2020 6:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dom + SR04 incorrect distance
Thanks for the reference.
As a result I have managed to resolved the issue.
There is a line in the script
All I did was to remove the /10 from the line so it now reads
This was because the comment "Domoticz distance needs cm but gets mm" is actually incorrect.
I so much appreciate your input and assistance with this problem.
Regards
Fred
As a result I have managed to resolved the issue.
There is a line in the script
Code: Select all
if subtype == 27:
# Domoticz distance needs cm but gets mm
return 0, str(float(value)/10)
Code: Select all
if subtype == 27:
# Domoticz distance needs cm but gets mm
return 0, str(float(value))
I so much appreciate your input and assistance with this problem.
Regards
Fred
Who is online
Users browsing this forum: Amazon [Bot] and 1 guest