WebThingsIO / gateway-addon-python

Python bindings for developing add-ons for WebThings Gateway
Mozilla Public License 2.0
16 stars 10 forks source link

How to deal with properties that don't have a value yet #81

Closed flatsiedatsie closed 4 years ago

flatsiedatsie commented 4 years ago

How would you advise the following situation be handled?

I could set the property to zero, but that creates other issues. It could trigger rules, or just be confusing. ("The temperature sensor says it's 0 degrees outside, even though it's a warm summer day").

So ideally I'd like to have it show something that indicates the property exists, but no data has been received for it yet. Is this possible?

Can I send a null value?

mrstegeman commented 4 years ago

You could send null, or you could persist the last received value to a file which you would then read back when your adapter starts up.

flatsiedatsie commented 4 years ago

Thanks!