Open jacotec opened 2 years ago
It's two steps.
The messages are all documented here.
https://pethublocal.github.io/devices
Put hub into adoption mode and hit the connect button on the device
15 Adoption Mode to adopt new devices - Disabled (0), Enabled (2), Adopt using bottom Button (0x82)
https://github.com/PetHubLocal/pethublocal/blob/main/pethublocal/generate.py#L99
And using the command line tool
pethublocal cmd -h Hxxx -d Hub -c Adopt
Puts it into adoption mode
Provisioning tags to devices
The complexity here is I need in code to manage the tag offset and which free one to use. There are 32 offsets in all devices. So it shouldn't be too bad just having written that.
Message 11 - Tag Provisioning For all the devices that aren't a pet door Or for the pet door
91-309 Provisioned tags - 7 bytes for each provisioned tag with the first byte being the tag type
The only issue with provisioning is I haven't figured out the calculation for the HDX tags on the pet door. So in that case it's just easier to use the add pet button on the door
But yes I agree my documentation does need some work with sorting it into functional groups around actions.
Maybe, if you work on your docs, make it understandable for "normal" users who are not that deep in the protocol / programming stuff. Your project really deserves a huge user base, and from the Twitter messages of the latest cloud mess there are lots of users interested in your alternative ;-)
Keep the hurdles low :-)
Unfortunately having to poison the DNS has proven high enough for the average user.
I have worked fairly hard on the documentation especially the protocol and calls so if any crazy individual wanted to pick up building the stack in another language they could.
But once I sort out some other code commits I will work on refactoring the documentation along with my day job.
Patches are also welcome as the documentation source is all public.
Don't misunderstand me, I highly appreciate all your work along with job, wife, kids, pets, house, garden ... ;-))
I just want to help collecting things which might be difficult for users (to make it easier to apply tasks beyond DNS poisioning, for which alone you at least need more than most commercial routers can do)
So... Funny story on this, now I have managed to figure out how to patch the firmware, as long as you can have a local custom DNS entry that is 18 characters long by byte patching the firmware. https://gist.github.com/plambrechtsen/c574f7db8b2635e22810447c5e1ba846 So once I improve health wise I plan to add this as well, so a one off dns poisoning and then you can have it pointing to a host your specify.
@plambrechtsen Sorry to hear you're having health issues! Get well soon!
@plambrechtsen I really need help adding my second cat flap.
I've paired the cat flap with the Hub (Pressed the button on the button of the hub, pressed the connect button on the flap) and basically PHL got the second flap. But it's not working beyond that point.
The section in pethubconfig.json is really, really short:
"117503CFF9D5B370": {
"Name": "Gehege",
"Product_Id": 6,
"Serial_Number": "",
"Mac_Address": "117503CFF9D5B370",
"Index": 0,
"State": "Online",
"RSSIHex": "000000",
"LastHeard": "-216871065",
"New_Device": true
}
There are lots of config parameters missing which are available with the main flap. I've added a "test pet" to the new flap, it's also not showing anywhere.
Do I need to add some config parts manually? Or how should that work?
I wanted to add a feeder today but ran into the same situation. Have a basic stub now in pethubconfig.json and pethublocal is throwing errors about missing attributes, e.g.
023-07-06 12:36:11.149181+00:00box.exceptions.BoxKeyError: "'Box' object has no attribute 'Bowl_Count'"
or
2023-07-06 15:56:06.125708+00:00box.exceptions.BoxKeyError: "'Box' object has no attribute 'Battery'"
@jacotec how did you manage with your additional flap?
P.S. I used the connect button at the hub itself. The CLI command got me the following output:
/code/run $ pethublocal cmd -h H010-0813157 -d Hub -c Adopt
INFO:pethublocal:Loading Config file pethubconfig.json
DEBUG:pethublocal:Generate Message Hub:H010-0813157 Product:1, Operation:Adopt
mosquitto_pub -q 1 -t %s -m '%s' error Unknown message
I added now the missing elements. For the feeder, the final JSON looks like this now (if someone needs it):
"B19A03C0F9D5B370": { "Name": "Feeder", "Product_Id": 4, "Serial_Number": "U004-xxxx", "Mac_Address": "B19A03C0F9D5B370", "Index": 2, "State": "Offline", "RSSIHex": "000000", "LastHeard": "1504508068", "New_Device": true, "Battery": "6.444", "Bowl_Count": 2, "Close_Delay": 4000, "Bowl_Target": [ "50", "50" ], "Bowl_Weight": [ "55.61", "0.78" ], "Lid_State": "Animal_Closed", "Time_Open": "29", "Bowl_Delta": [ "-0.3", "-51.81" ], "Last_Heard": "-2046369362" }
The documentation is currently missing how to add additional pets or devices.
I currently have a spare cat flap (in case the one in operation dies) and if I need to add / replace it, it would be a bit of playing around and guessing (adding the section in the config with the MAC address and serial and the assigned pets?).
Connecting all back to the original cloud would be some risk (at some point they may provide a hub firmware which prohibits downgrade at all) ... so if that could be documented it'll be awesome.