Announcement

Collapse
No announcement yet.

Question: best way of keeping track of device values for a condition

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Question: best way of keeping track of device values for a condition

    So, I have a plugin and for one of my conditions I need to track the value of the device. That is to say I need to know the value before the change and then set the value to the new value. I am doing this via HSEvent and all is working well.

    My question is on what is the best way to store this. Right now I'm using a SQLite database to hold the values, but this obviously has some downsides such as the time to retrieve and then save the values as they change. I was wondering if anyone thought it would be better to just store it in memory while the plugin is running. My concern about using memory was that if a user adds too many conditions, it would use up too much memory and then managing the triggers might be a pain (though I could use Linq to filter them, so may be not).

    So which would probably be the preferred method for storing the values? Either way I have to reset the stored values on plugin initiation.

    #2
    So, after pondering on it and realizing that I was already storing my triggers for easier retrieval when on the events page, I decided to just use that instead of SQLite. Good thing is that I got some experience using SQLite in .net.

    I also realized that I didn't need to store the previous value. The HSEvent for device change sends in the previous value and the new value. This made comparing the two pretty darn easy.

    Comment

    Working...
    X