The Seneye Home normally wants to be connected to a Windows PC to log its reading to the cloud. Naturally, I see no reason for the cloud to be involved. {Insert rant about unnecessary cloud connections for home devices here} Fortunately, Seneye has released at least a partial API for reading on a Raspberry Pi.
https://github.com/seneye/SUDDriver
There is a handy page describing compiling and testing the samples from the above: https://raspberrypidiyblog.wordpress.com/2018/01/17/seneye-suddriver-raspberrypi/
Compiling the code required I change line 464 of linux/hid.c from:
tmp = (hid_device_info*)malloc(sizeof(struct hid_device_info));
to
tmp = (struct hid_device_info *)malloc(sizeof(struct hid_device_info));
Over at https://doughall.me/2017/06/30/seneyemqttpt1/ is a discussion on using Python on the Pi to get the device readings. His code can be found at https://github.com/dhallgb/Seneye-MQTT.
Following these instructions I installed python modules pprint, pyusb, paho-mqtt and bitstring(not mentioned but required) using pip install. It was necessary to update the 10-local.rules file to indicate the correct idVendor and idProduct: idVendor=24f7 and idProduct=2204. These need to be in hex in the udev files. They are in decimal in the python source.
I have also updated the python script to not use bitstring and to use struct instead.
def mungReadings(p): s = {} scrap, scrap, TS, flag1, flag2, scrap, pH, NH3, thermo, scrap = unpack('<BBLBBHHHL46s', p) s['InWater']=bool(flag1 & 0b00000100) s['SlideNotFitted']=bool(flag1 & 0b00001000) s['SlideExpired']=bool(flag1 & 0b00010000) s['pH']=float(pH)/100 # divided by 100 s['NH3']=float(NH3)/1000 # divided by 1000 s['Temp']=float(thermo)/1000 # divided by 1000 j = json.dumps(s, ensure_ascii=False) return(j)
Still working on how to register a Seneye slide without the Windows PC. From the Seneye SUDDriver wiki:
Slide codes are retrieved from an API hosted on the seneye cloud. In order to use it, your account will need activating to allow permission. You can request access to this by E-mail by asking for “SUD Developer Access” and we will send you the terms and conditions to be sent to you for agreement.
https://github.com/seneye/SUDDriver/wiki/Activating-a-seneye-slide-for-your-SUD#retrieving-a-slide-code