HTTP binding cache and ignore response value

I am using the HTTP binding to control my CT50 thermostat. I am using caching since the status returns a handful of values and the thermostat’s webserver is not that great and times out and hangs sometimes. A valid response looks like:

An invalid response looks like:

A valid response with incorrect data looks like:

I am persisting these into mysql and graphing the temp, however the -1 values throughs the graph off like crazy.

So my question is, is there a way to ignore the -1 value and not persist it?

Several approaches come to mind.

  • A JavaScript transform that extracts the value and converts the -1’s to 0s (or some other more “sane” value)
  • A proxy Item and a Rule; your current Item gets updates, triggers a rule which only postUpdates the proxy Item when the value isn’t -1; make sure to use the proxy Item for your chart
  • Don’t automatically persist the Item and instead have a rule that triggers when the Item is updated and call MyItem.persist only if the value isn’t -1 (if mysql isn’t your default persistence the call would be MyItem.persist(“mysql”))
1 Like

I went ahead and wrote a few line bash script to just look through all the tables and delete the ones that had a -1 value.