esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
404 stars 26 forks source link

Support for Sonoff MS01 #1729

Open stskrp opened 2 years ago

stskrp commented 2 years ago

Describe the problem you have/What new integration you would like Support for Sonoff MS01 moisture sensor

Please describe your use case for this integration and alternatives you've tried: Sonoff TH10/16 now has support for new sensor - MS01 https://sonoff.tech/product/accessories/ms01/ It is already supported in Tasmota https://github.com/arendst/Tasmota/pull/15335/files But not sure how to port it to esphome. Would be great to have support for MS01 is esphome too.

Additional context

kahhu3 commented 1 year ago

I'm using the Tasmota software successfully but would appreciate support in ESP home as well.

Zebble commented 1 year ago

Trying to add this through PR#3901 and I'm stuck. I'm getting output, but it doesn't match Tasmota. I'm getting small neg ative values (-3.1) instead of positive values. Other values seem to be close.

emes30 commented 1 year ago

Hi @Zebble, I fixed negative values. Tasmota's computations can be negative also. But then we've got this:

if (humidity < 0) humidity = 0.1f;

so I've just added this to your code if (*humidity < 0) *humidity = 0.1f;

and it works.

ffabrice78 commented 1 year ago

Hi, Can u send me your yaml, i have the entity but no data. Thx

emes30 commented 1 year ago

Here is my fork https://github.com/emes30/esphome/tree/components-dht-ms01 Check it out. If you have entity then your yaml seems ok, check pins and connections.

ffabrice78 commented 1 year ago

Hi,

external_components:

switch:

  • platform: gpio name: "THR316 Relay" pin: GPIO21 id: relay
  • platform: gpio pin: GPIO27 id: sensor_power restore_mode: ALWAYS_ON

sensor:

  • platform: dht pin: 25 model: MS01 humidity: name: "Soil Moisture" update_interval: 60s

Here is my yaml, i use ur fork, but i don't have data, just error

emes30 commented 1 year ago

What error ? Can you paste your logs here ?

j-k-olofsson commented 1 year ago

[10:57:17][C][dht:043]: Pin: GPIO25 [10:57:17][C][dht:049]: Model: DHT22 (or equivalent) [10:57:17][C][dht:052]: Update Interval: 15.0s

[10:57:17][C][dht:054]: Device Class: 'temperature' [10:57:17][C][dht:054]: State Class: 'measurement' [10:57:17][C][dht:054]: Unit of Measurement: '°C' [10:57:17][C][dht:054]: Accuracy Decimals: 1

[10:57:17][C][dht:055]: Device Class: 'humidity' [10:57:17][C][dht:055]: State Class: 'measurement' [10:57:17][C][dht:055]: Unit of Measurement: '%' [10:57:17][C][dht:055]: Accuracy Decimals: 0

[10:57:27][W][dht:198]: Requesting data from DHT failed! [10:57:27][W][dht:085]: Invalid readings! Please check your wiring (pull-up resistor, pin number).

YAML: sensor:

Coroebus commented 1 month ago

Hi,

does SONOFF MS01 is working with ESPHome now ?

Thank You :)