Local Deployment for SureFlap / SurePetCare Connect using only local MQTT Broker

I’m looking to reverse engineer the sureflap cloud backend.

This is a completely different approach to the built-in Home Assistant Integrations to the SurePetCare Cloud:

PetHubLocal requires you to poison the DNS entry the hub connects to hub.api.surehub.io to an internal host, so that the hub no longer connects to the Cloud service but it only connects locally.

To achieve this I have mostly reverse engineered the SureFlap Connect series hardware Hub. With a primary focus on “Me In The Middle” aka MITMing the traffic from the Hub to the SurePetCare cloud after figuring out how to open the AWS IoT MQTT Client Certificate by finding how the password is calculated on a per-hub basis. This has involved building a python frontend and Hub <-> Home Assistant translation to translate MQTT messages generated by the hub into Home Assistant messages and vice versa.

Documentation: https://pethublocal.github.io/
Code: GitHub - PetHubLocal/pethublocal: Replacement for SurePetCare "Connect" cloud service connecting via MQTT to Home Assistant

There are two ways you can deploy PetHubLocal:

The HAOS Addon assumes you are using the embedded Mosquitto MQTT Broker and deploys the addon along side exposing the ports required by the hub (80/443/8883) and connects back to the main broker.

Standalone you can deploy it in a Docker container, or run it interactively using tmux or something to keep it running as a background process.

I recommend you start at the documentation to understand how it all fits together, and if updating your internal DNS, and potentially flashing custom firmware onto your hub if it has been upgraded sounds all a bit too much then this project probably isn’t for you.

10 Likes

Great idea!

I don’t have many skills in this area but will help out with testing and data.

I have 3 flaps, 2 feeders and three hubs.

100% love this idea
I have 1 catflap and 3 feeders, let me know if anything i can do to help at all

Seems like a great idea!

I have 1 cat flap, and 4 feeders, and would be happy to test / help in anyway I can!

Me to i have 1hub and 1 feeder tks for the idea
Please hurry

Happy to help with testing.
Hub + 2 feeders and 2 cats here !

Does anyone have a H004 serial number hub? There seem to be 10 revisions from H001 to H010. If so I wouldn’t mind if you could PM me your serial number and the mac address of the hub.

Nope, sorry … mine is H008!

So it appears it might be easier to reverse the air protocol and build a custom gateway. Anyone else with a CC2531 that ideally has the external antenna as then you should be able to pick up the Miwi traffic from the hub and the door / feeder and interested in running a docker image to sniff traffic.

Hi,

I have a working system that runs on a Pi and communicates with my SurePet Feeder. It publishes the readings to MQTT.

The Repo is:

Mark

@peterl Happy to help testing. I have a H009 Hub

If you still need information for a H004 hub, I have this revision.

K.

Do you still need someone to help with a pet door? I see the above github repo only works with the feeders currently. Would love to move my door over to mqtt locally. Cloud is more down than up for me for some reason.

I have a feeder and pet door. So am working on both. Need to confirm everything is the same with the cat flap. But so far it looks to all use the same messages.
The hardware required will probably end up being something very similar to this project. With just a esp32 or 8266 and the MRF24J40. https://doc.riot-os.org/group__boards__esp32__mh-et-live-minikit.html

1 Like

I like the idea of the ESP with MRF24J40 more than a Pi3. Really excited.

I do like the MH-ET LIVE MiniKit setup, but can’t find it anywhere. Looks like we either email that email address on that site or look at the easier obtainable arduinos.

Is this the easiest (not cheapest though) combination that will work?

wifi-ble-click (esp32-wroom-32) + bee-click (MRF24J40MA)

Or should I look at this esp with this socket board on to which I then put the MRF24J40 which seems to be very easily accessible.

I have just published my first initial cut of the Wemos ESP32 Arduino code with the MRF24J40 radio controller.

My focus is similar to Mark having a local hub as the constraints of re-using the existing hub were such that I couldn’t easily use it.

Currently the code segfaults every few minutes due to an issue with the interrupt handler which I think should be fairly easy to solve and plan to do that over the next few days. I also have python code I am working on to take all the messages off the MQTT topic that the Wemos Hub puts on and converts them into Home Assistant messages. The code is incredibly rough but will commit it when I am feeling happier with it.

I have also fabricated the PCBs for the MRF24J40 to plug into the Wemos and have included the gerber file from Gunar Schorcht which I found here: https://doc.riot-os.org/group__boards__esp32__mh-et-live-minikit.html

Questions and feedback or idea

1 Like

Do you think in future a CPL and BOM can be included to make it easier to let jlcpcb do the SMT assembly? Just asking for others, for now I will print and diy.

Unfortunately JLCPCB doesn’t support the MRF24J40MA so you can’t have them do it for you. But the MA is a single PCB that solders directly only the fabricated PCB so it is a super simple job to solder on. I have sourced the MAs from rsonline or Ali and they are a standard component which is slightly on the more expensive side for Zigbee radios.

However if you don’t mind opening your hub or perhaps you bricked it there is one inside there too. :wink:

Added further documentation to the feeder message decode the feeder messages:


And the issue I have around the calculation of the CRC value of the frame and if it is an xored value or not, plus there are two digits I am not sure about for the xor key that I would like to figure out.