Write variables to a text file on a network share

Posted on
Thu May 19, 2016 10:25 am
srkinard offline
Posts: 320
Joined: Apr 10, 2016
Location: Austin, Texas

Write variables to a text file on a network share

I use Blue Iris running on a Windows box for all my security cameras, and one of the features it has is being able to overlay text onto the cam footage from a Macro (basically a pointer to a TXT file.)

I use a utility called Blue Iris Tools to do this with weather info and CPU/Mem/Disk status is the BI server, but I'm thinking I'd like to take certain device states and/or variables and overlay them onto the camera for that room.

Like my server room...I have a temp/humidity sensor in there, so I'd like to dump some information into a TXT file that is stored on the Mac Pro fileserver. The Blue Iris windows machine has a GPO that automatically connects it to a folder called "SharedMedia" so there's a central repository all of my systems can read and write to for file/data exchange.

What would be the best way to do this? AppleScript? Python?

For sake of examples, lets say I wanted to save some formatted info to this file:
/Volumes/SharedMedia/BlueIris/Macro2.txt

Here's what I'd like to pull data from (used Karl's Utilities to dump the device list and all)
Code: Select all
1532285937                                       Arduino 1 - Temperature:  sensorValue("87.8"), sensorValue.ui("87.8 °F")
1750325374                                       Arduino 1 - Humidity:  sensorValue("35.0"), sensorValue.ui("35.0 %")
1757912877                                       Computer Room Server Power:  accumEnergyTimeDelta("1435801"), accumEnergyTimeDelta.ui("1435801 seconds"), accumEnergyTotal("394.555"), accumEnergyTotal.ui("394.555 kWh"), curEnergyLevel("553.353"),
                                                                           :  curEnergyLevel.ui("553.353 W"), onOffState("True")


Getting sensorValue.ui for each one except the AeonLabs SmartSwitch, getting curEnergyLevel.ui from that one.

and having the TXT file look like:

Code: Select all
Room Temp:      87.8ºF
Room Humidity:  35.0 %
Power Use:      553.353 W


Thoughts on the best way to extract and format that data into a TXT file in the designated destination?

Posted on
Thu May 19, 2016 11:30 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Write variables to a text file on a network share

Something like this should do it. Totally untested.

Code: Select all
temperature = indigo.variables[1532285937].sensorValue.ui
humidity = indigo.variables[1750325374].sensorValue.ui
power = indigo.variables[1757912877].curEnergyLevel.ui

file = open("/Volumes/SharedMedia/BlueIris/Macro2.txt","w")
file.write("Room Temp:\t%s\n" %  temperature)
file.write("Room Humidity:\t%s\n" %  humidity)
file.write("Power Use:\t%s\n" %  power)
file.close()


You run that script as an action on a scheduled event, run as often as you want to update the file.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests