I'm a hardware engineer developing a multi-sensor board that will attach to a Raspberry Pi. The first part of the design - the temperature and humidity sensor is working on my Pi Zero (the development platform) but being a hardware guy, I'm getting a little lost in the Octoprint plug in world.
I've gotten to the point where my plugin will read the manufacturing ID from the sensor in a plugin shell and prints it to the log. I also have a standard python script that does the temperature/humidity conversion and prints the results - all good and sane so far. The problem comes when I try to get my plug in to be called on a regular basis. To do the conversion I have to initiate it with an i2c register write, then check a status bit to determine if it is complete. The conversion can take a reasonable amount of time (up to a second). Alternately I can set the sensor up to interrupt the processor with a GPIO transition on a predetermined rate (1/10/100 seconds) - but again, I have no idea how to make a plugin respond to that.
Ideally I would like to add the output of the conversions to the temp graph.
I found code that I might be able to adopt (if I knew how it was called and how the data was inserted) here: https://github.com/1r0b1n0/OctoPrint-Tempsgraph.git
If anyone can point me in the direction of simple example code - I would be very appreciative!