Average 5 readings from a Single device

Okay here is the output of Status 0
15:40:02 RSL: STATUS = {"Status":{"Module":0,"DeviceName":"D1Mini","FriendlyName":["D1 Mini - Universal Parent (192."],"Topic":"tasmota_FB0779","ButtonTopic":"0","Power":1,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}
15:40:02 RSL: STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://thehackbox.org/tasmota/release/tasmota.bin","RestartReason":"Software/System restart","Uptime":"0T00:28:56","StartupUTC":"2020-07-18T14:11:06","Sleep":50,"CfgHolder":4617,"BootCount":14,"BCResetTime":"2020-07-18T14:11:29","SaveCount":38,"SaveAddress":"F6000"}}
15:40:02 RSL: STATUS2 = {"StatusFWR":{"Version":"8.3.1(sensors-he)","BuildDateTime":"2020-07-04T09:53:17","Boot":31,"Core":"2_7_1","SDK":"2.2.2-dev(38a443e)","Hardware":"ESP8266EX","CR":"437/699"}}
15:40:02 RSL: STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["Sheares",""],"TelePeriod":300,"Resolution":"55C180C0","SetOption":["00008001","280514000100060000005A00000000000000","00000000","80000000"]}}
15:40:03 RSL: STATUS4 = {"StatusMEM":{"ProgramSize":625,"Free":376,"Heap":22,"ProgramFlashSize":1024,"FlashSize":4096,"FlashChipId":"16405E","FlashMode":3,"Features":["00000809","8F8AA787","0415A3A5","B7FFBFCD","01DA9BC4","64367CE7","00000072"],"Drivers":"1,2,3,4,5,6,8,9,10,14,16,17,20,21,24,25,29,34,95","Sensors":"1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,26,28,31,34,37,39,40,42,43,51,52,55,56,58,59,62,64,66,67"}}
15:40:03 RSL: STATUS5 = {"StatusNET":{"Hostname":"tasmota_FB0779-1913","IPAddress":"192.168.0.173","Gateway":"192.168.0.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.0.8","Mac":"98:F4:AB:FB:07:79","Webserver":2,"WifiConfig":4,"WifiPower":17.0}}
15:40:03 RSL: STATUS7 = {"StatusTIM":{"UTC":"2020-07-18T14:40:03","Local":"2020-07-18T15:40:03","StartDST":"2020-03-29T02:00:00","EndDST":"2020-10-25T03:00:00","Timezone":"+01:00","Sunrise":"05:06","Sunset":"20:45"}}
15:40:03 RSL: STATUS10 = {"StatusSNS":{"Time":"2020-07-18T15:40:03","SR04":{"Distance":197.614}}}
15:40:03 RSL: STATUS11 = {"StatusSTS":{"Time":"2020-07-18T15:40:03","Uptime":"0T00:28:57","UptimeSec":1737,"Heap":22,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":29,"MqttCount":0,"POWER":"ON","Wifi":{"AP":1,"SSId":"Sheares","BSSId":"FC:EC:DA:E6:F7:27","Channel":4,"RSSI":74,"Signal":-63,"LinkCount":1,"Downtime":"0T00:00:03"}}}
15:41:17 RSL: STATE = {"Time":"2020-07-18T15:41:17","Uptime":"0T00:30:11","UptimeSec":1811,"Heap":23,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"POWER":"ON","Wifi":{"AP":1,"SSId":"Sheares","BSSId":"FC:EC:DA:E6:F7:27","Channel":4,"RSSI":100,"Signal":-49,"LinkCount":1,"Downtime":"0T00:00:03"}}
15:41:17 RSL: SENSOR = {"Time":"2020-07-18T15:41:17","SR04":{"Distance":197.632}}

Would you prefer a print screen, this looks like gobbledygook :crazy_face:

This is fine :slight_smile: I will write a rule for you. Not 100% sure about the syntax, but should get you close enough.

1 Like

You are an absolute legend and a huge asset to this HE community. I really do appreciate your time and effort you put in.

1 Like
Rule1 ON SR04#value<150 DO power1 1 ENDON ON SR04#value>170 DO power1 0 ENDON
Rule1 1

This should work, I do suggest to keep the present and not present distances a bit a part, since the difference is going to be rather significant anyway. You could also add filters with a more complex rule so that a person walking under the sensor wouldn't trigger it. That I leave as an exercise to you:P The docs have lots of examples:
https://tasmota.github.io/docs/Rules/

EDIT: SR04#value might need to be SR04#distance

Yes it was SR04#distance

Thanks again @markus

You're welcome!

So all working then? With the Presence driver and all?

Yes working 100% (just need to slow the readings down, I think that is with Teleperiod, but I will have a look). Have tested it and it works well. as you said I think this is more stable than with the arduino software. I will go and install this in the garage tomorrow.

P.S. I have more of your software and drivers running on my HE than anything else. :wink: :grin: :partying_face: :sunglasses:

1 Like

Yes, and that would not affect the Presence Sensor update speed, so you can set it to whatever you want. Last I used a distance sensor with Tasmota was back with 7.x, Teleperiod did not limit the updates from that sensor back then, but I do think it does now. If not, ask again and I'll come up with something. It should work though.

Take a photo :wink:

Nice to hear that they are coming to good use. :slight_smile:

Maybe I missed earlier in the thread but what hardware are you using for the ultrasonic sensor and arduino?

I have the Wemos D1 mini and an HC-SR04 ultrasonic sensor.

I use a soap box and drill 2 holes through it and put the ultra sonic sensors through it, then I connect it to the plug point near the garage motor.

Will post a pic for you :wink:

1 Like

@markus

I think you correct, I did change the TelePeriod to 60 and it does not slow down the sensor readings which are running at about 4 seconds.

P.S. Do any of these look like they might work?

Sensor18 PMSx003 particle dust sensor
0..32000 = control sensor polling interval to extend lifetime

Sensor20 Nova Fitness SDS011 dust sensor.
1..255 = number of seconds before TelePeriod to poll the sensor

No, those would not be right. So the sensor child device get constant updates, not just inside Tasmota? I will have a look later, not in front of the computer any more today.

looking more to limit false positives, like you said if someone walks under it i don't want it to trigger straight away, would like it to read maybe every 30 seconds. it does do a lot of logging as well, keeps saying switch is off, which I know you can turn off the logging.

No worries, you have have been a huge help, I will keep checking and see if I can find anything.

You can make a rule which doesn't trigger except for around the hight of your car, much more or less could be filtered.

You can also improve the rules to not update the switch state unless it actually changes. Most of what you're looking for are things that can be done with rules. :slight_smile:

Looks like the Teleperiod limits the updates to HE, so that should work, I was watching the updates in the Tasmota GUI and that seems to update every 4 seconds. I will install it and then see if I need to change anything.

This looks like it worked

Rule1 ON Tele-SR04#distance<150 DO power1 1 ENDON ON Tele-SR04#distance>170 DO power1 0 ENDON

1 Like

Here is a simple averaging app courtesy of the folks at Hubitat

Average

@markus here is a pic of the ultrasonic sensor I made up.

So basically it is a D1 mini board, with an HC-SR04 ultrasonic sensor, and a soap box. Double sided tape to the ceiling of my garage above my car.

2 Likes

Nice, that's a neat solution!

1 Like