I am looking into using HG to read serial data with python. Is it possible to use the python interpreter with HG? I tried importing logging into my script with the intention of being able to log/print data to a file while building a serial program with python but I can't import the logging module.
This is what I have to start with. I would like to log the console output either to stdout when launching HG from the cli or to the log file /usr/local/bin/homegenie/log/homegenie.log. Is that possible?
edit: standard python print gets logged.
Here is what I have started with.
def ser_rec (mymessage):
# this will be called every time a message is received from serial port
hg.Program.Notify("SerialPort String", mymessage);
print mymessage
return None
#setup program stuff
def setup():
portname = "/dev/ttyUSB0"
ser = hg.SerialPort.WithName( portname ).OnMessageReceived( ser_rec ).Connect()
hg.Program.Notify("Python Test", "Hello Python "+portname)
return None
hg.Program.Setup(setup)