Page 1 of 1

test sensor values before storing in database

Posted: Monday 11 September 2023 10:40
by mancide
Hi,
Is there way to run a script on a new sensor value before it is stored in the value database?

I think it is possible as I once wrote a script that ate all my sensor values...

What I want to do:
1. a sensor value comes in.
2. I want to do some checking (eg. the water temp of my fish pond can´t be 2000C. Yes, I do get such values...)
3. ignore bad values.

Maybe an (optional) value range for each sensor might be a good idea.

Tom

Re: test sensor values before storing in database

Posted: Monday 11 September 2023 10:49
by waltervl
The hardware gateway (integration or python plugin) should manage this.
There is no possibility to script this.
If you have a Dummy device created you probably using an external script that fills the dummy device. So that script can do the validation first.

Re: test sensor values before storing in database

Posted: Monday 11 September 2023 11:11
by mancide
I don´t think the hardware gateway 'can' solve this problem.

It can´t know how I'm using a sensor. For example, I have a RF sensor in my freezer which should never display 30C. Air temp sensors should display 30C.

Besides that I have temp sensor coming from an RFXCom and from Z-wave. Different hardware, same issue...

Each sensor already has a correction factor that can be set.
If you would add a value range option there, it would solve the problem...

Re: test sensor values before storing in database

Posted: Monday 11 September 2023 11:21
by waltervl
I think there is something else wrong if you have this many incorrect values coming from your sensors.
I do not use RF nor Zwave, only use Zigbee but I never have discrepancies in reported values.

I know Zwave has some checks for incorrect energy readings. But that is still arranged in the hardware gateway as indicated before.