Sonoff TH with SI7021 humidity sensor

Hi all,
I've got an sonoff TH (tasmota) switch with an SI7021 temperature and humidity sensor on it
I would like to create a node that switches the sonoff on when reaching an max humitidy so it can start a fan, and of course the other way to shut it off.
Any pointers or sombody has the same problem?
Thx

What part don't you know how to do?

  1. Read the humidity
  2. Compare it with a limit
  3. Switch the fan off/on

[Edit] If point 2 is the issue see this recent thread asking a very similar question Front montant du signal
Read the full thread.

yes, it's indeed 1 and 2 i can see the values but don't know ho to seperate the humidity and feed it to the switch to compare

This is the msg.payload
{"Time":"2020-09-24T12:05:24","SI7021":{"Temperature":20.1,"Humidity":61.5,"DewPoint":12.5},"TempUnit":"C"}

OK, I suggest start by reading the node red docs page Working With Messages which will show you how to do it I think. Also look through the other docs there. In fact it is probably worth taking and hour out and watching the node red essentials vidoes which are linked from the docs. You will save yourself time in the long run.

Do also read the thread. If you just use a simple comparison then the fan will almost certainly switch on and off repeatedly while near the threshold due to noise on the signal.

Played a little with it , this is the result of my payload
16-10-2020 17:33:19node: PAYLOAD
msg.payload : string[161]
string[161]
{
"Time": "2020-10-16T16:33:20",
"SI7021": {
"Temperature": 17.3,
"Humidity": 62.8,
"DewPoint": 10.1
},
"TempUnit": "C"
}

Wich is completely different from the example

When i try to show me the value for the humidity in the payload msg.payload.humidity it gives me an undefined error .
Am ik missing someting here ?

That is because it is a string, run it through the json node to create the javascript object. Then msg.payload.humidity will be available

thx, but it's the same...

flows (7).json (1.1 KB)

export flow to clipboard and paste the flow between backticks example below. i do not download files.
```
paste text here
```

Please place between backticks as asked, it provides a copy link and makes helpers life easier. And delete the other post. Messy threads are hard to read

sorry newbie here, i don't understand what you mean by this :wink:

1 Like

```
{"somecode":"with formating",["is preseved"]}
```
becomes this

{"somecode":"with formating",["is preseved"]}

and is neat and tidy, i can also copy it by just one click.

1 Like
[{"id":"c898090f.b95ff8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"4c08d1e5.de955","type":"debug","z":"c898090f.b95ff8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.humidity","targetType":"msg","statusVal":"","statusType":"auto","x":620,"y":260,"wires":[]},{"id":"77a11fe6.eb698","type":"Tasmota Sensor","z":"c898090f.b95ff8","broker":"11f388b0.3a1d17","device":"tasmota","name":"","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","rules":[],"x":200,"y":260,"wires":[["4b2e48e1.c40808"]]},{"id":"4b2e48e1.c40808","type":"json","z":"c898090f.b95ff8","name":"","property":"payload","action":"obj","pretty":true,"x":390,"y":260,"wires":[["4c08d1e5.de955"]]},{"id":"11f388b0.3a1d17","type":"mqtt-broker","z":"","name":"Domoticz master","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"anything","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

you forgot S17021 msg.payload.SI7021.Humidity

[{"id":"6b248168.5c73c","type":"inject","z":"ace010cf.0ce08","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{ \"Time\": \"2020-10-16T16:33:20\", \"SI7021\": { \"Temperature\": 17.3, \"Humidity\": 62.8, \"DewPoint\": 10.1 }, \"TempUnit\": \"C\" }","payloadType":"str","x":180,"y":300,"wires":[["70888398.2fe344"]]},{"id":"70888398.2fe344","type":"json","z":"ace010cf.0ce08","name":"","property":"payload","action":"","pretty":true,"x":390,"y":260,"wires":[["e43dc9a4.f059e8"]]},{"id":"e43dc9a4.f059e8","type":"debug","z":"ace010cf.0ce08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.SI7021.Humidity","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":260,"wires":[]}]

Thx, working now!!!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.