JTK – Notes and Ramblings Things we have found …

12/23/2018

Seneye Home on the Pi

Filed under: General,Home Automation — taing @ 6:15 pm

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

Can’t access c$

Filed under: General,Router/PC Config — taing @ 5:54 pm

Recently I found on one of my systems that I was unable to access c$ even when using admin credentials. The solution can be found at https://support.microsoft.com/en-us/help/951016/description-of-user-account-control-and-remote-restrictions-in-windows The Fix It For Me feature of the article is no longer supported but the description of the manual fix via regedit works:

  1. Click Start, click Run, type regedit, and then press ENTER.
  2. Locate and then click the following registry subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
  3. If the LocalAccountTokenFilterPolicy registry entry does not exist, follow these steps: 
    1. On the Edit menu, point to
      New, and then click DWORD Value.
    2. Type
      LocalAccountTokenFilterPolicy, and then press ENTER.
  4. Right-click LocalAccountTokenFilterPolicy, and then click
    Modify.
  5. In the Value data box, type
    1, and then click OK.
  6. Exit Registry Editor.

Powered by WordPress