Glad that you're finding the plugin useful.
There's no need for you to do any scripting, just follow these steps.
1. Create a new Indigo Schedule and set it to run every 5 minutes.
2. On the Actions tab, select Server Actions --> Script and File Actions --> Execute Script.
3. Make sure to select Embedded Python (it should already be selected)
4. Copy the script above into the scripting window.
Change the following lines at the top of the script:
data_name = 'Some Data' # The header name for your data
full_path = '/Users/username/Documents/Some Data.csv' # Copy the path from the plugin configuration settings
target_lines = 300 # max number of lines in your data file
value = indigo.variable[1401389208].value # where the observation comes from
data_name is a descriptive name of your data, like "Living Room Temperature"
full_path is from the plugin settings -- where your data are stored
target_lines is the number of observations you want to save (in this case 5 min x 4 hours is 48).
value is where the data to save comes from: if it's a variable, just change the ID to match the ID of your variable. If it's a device, change the line to something like this (be sure to change the ID and state name to match yours).
- Code: Select all
indigo.devices[65317564].states["Power_value"]
You can get the reference to the device state by right-clicking on the device state in the Indigo Devices window and selecting "Copy Python Reference".
The whole thing should take less than 5 minutes to set up.