Close

Abracadabra the API has Reappeared

A project log for Livestock and Pet Geofencing

An autonomous system that monitors animals within a zone.

jtJT 02/01/2022 at 21:590 Comments

After a bit of searching, I found the original API methods in the commands folder. I used 

from commands.hub_methods import hub

to import them. Everything works as it should.

Then... I'm not sure what happened, but I plugged the Hub into my computer and connected it to the MINDSTORMS app and it made me update my hub. A little annoying, but okay. Afterward, on a lark, I tried to import hub using

import hub

and this time it worked.

I connected the hub to my Raspberry Pi and read the raw data being sent over the USB connection. The hub automatically sends status updates about the ports, the battery, and the IMU. This status update is sent about twice a second. Learn more here.

I played around with connecting over Bluetooth and had issues maintaining a connection with the hub to my Raspberry Pi 400. I read that others had the same issue as well. I came up with a solution but it involved reconnecting every time the connection was lost. Recently, I came across a Hub2Hub communication method and it uses a Raspberry Pi in its demo. I'm going to give it a shot and report back.

Discussions