Replies: 5 comments 18 replies
-
I've just received this same sensor, seems this is what's coming up when searching for "Tasmota TDS" now. I've not encountered Berry SCript before but would agree that some standard method of entering conversion scripts for raw analog inputs would be very helpful. |
Beta Was this translation helpful? Give feedback.
-
While this does not address the specific suggestion, my strategy for handling such adjustments would be to instead create a driver in Berry, providing the data both on the Tasmota front page and in the regular JSON payloads for sensor data. Such a driver could subscribe to the sensor readings with a As it would also pick up analog data via the regular JSON payloads (internally generated about every second), one small annoyance is that the "upgraded" value put into the sensor payload would be based on the prior analog value, as Berry code cannot directly read analog, maybe a couple of seconds behind only. In your case, I'd want to generalize such a driver to recognize Tasmota being configured for temperature in C/F, to make it work with both. |
Beta Was this translation helpful? Give feedback.
-
@sfromis A big thanks for providing an alternative approach. The following Berry script is based on your TMP117 driver. It adds a new driver that performs the TDS sensor conversion and handles C/F temperatures (per your suggestion). As this approach looks perfectly reasonable, the value of adding a new AdcParam value that calls a Berry function seems questionable, where the benefits would be to make Tasmota more intuitive and align Tasmota with ESPEasy where sensor values can have a user-supplied conversion algorithm.
|
Beta Was this translation helpful? Give feedback.
-
Hello folks, This driver here, as far as I understand it, reads values and does conversions, but the triggers for actions are still rules. My experiment to play with berry is: I'm trying to read the hall effect sensor from an ESP32 and switch a relay on values below zero. My question: how can react faster than 1 second to value changes on rules? Or am I totally on the wrong track here? |
Beta Was this translation helpful? Give feedback.
-
Okay, I am also looking into writing my own driver for sensors outputting analog values. |
Beta Was this translation helpful? Give feedback.
-
I've successfully connected a Total Dissolved Solids sensor to an ESP32 (configured as an ADC Analog input). The TDS sensor outputs an analog voltage that can be converted to a parts per million (PPM) value. The sensor details are here:
http://www.cqrobot.wiki/index.php/TDS_(Total_Dissolved_Solids)_Meter_Sensor_SKU:_CQRSENTDS01
Currently, Tasmota natively supports converting raw ADC values to temperature, light, pH (among others) using the AdcParam command and hard-coded logic.
The following Berry script converts the raw TDS sensor voltage to a PPM value:
The PPM conversion relies on a separate temperature reading and a non-linear algorithm (and a conversion from Fahrenheit to Celsius).
Could you please consider adding support for a new AdcParam value where param1 would be the name of a Berry rule/function, and where the Berry rule/function returns a value? The goal is to allow arbitrary conversion of raw ADC values into meaningful values.
If there's an easier and/or better approach, can you please point me in the right direction?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions