TryFi Dog Collar Integration

Has anyone created an integration with the TryFi dog collar? I know they have an API and there’s an integration on HA. Curious if anyone has created one for HE or “converted” the HA one over.

I’m trying to get a presence sensor for our dog without having to attach anything else to her collar, so thinking of leveraging her Fi collar. I’d like to set our Alarm to “Away - Stay” when she’s home, so she doesn’t trip the motion sensors.

You could ask @nickmrawie if they got anywhere after looking into it:

I do not see any "public" API for it readily on their site but Google (and my searching of the site itself) just may not know.

If there is not already a driver out there... I can look into making one for you, ESPECIALLY if they turn out to have a public API (my experiences with private or "hidden" APIs have been mostly successful but with some serious aggravation at times). Obviously I do not have one of these so you would be setting yourself up for a bunch of iterations.

2 Likes

Thank you so much! I’ll go ahead and ask in that post. Not sure how I can tell if the API is private or public, but this is the HA integration for it. I personally wouldn’t need all of that… really just the geolocation stuff.

https://community.home-assistant.io/t/tryfi-dog-gps-collar-integration/244983

Another option is to run an instance of HA and bring the device into Hubitat using HADB.

2 Likes

From the HA community page topic, you can get to the GitHub repo for the dev, which references another project called pytryfi. The home assistant integration is using this python app to actually interact with the tryfi API.

The pytryfi GitHub repo states it’s based off an undocumented API and thus subject to change/break at any time (until the dev can figure out a fix).

Some APIs are able to be reverse-engineered despite not being publicly released by the service that created the API. That applies to this one, apparently.

2 Likes

Unofficial API usage is pretty common. Almost all apps and such rely on APIs to communicate readily with the devices they control (or the company's servers to pass info back and forth). In many cases they are not very well "hidden" (whether intentionally or not) and so external developers can figure out ways to interact with them.

Multiple of my API-related drivers are doing this. Either I have found documentation people have posted about an API or I have dug into them myself. In a couple cases the API is acknowledged by the company as something developers can use but pretty much undocumented. Sometimes, if you ask, a company is working on it or never even thought to "open it up" and is willing to work with you.

Of course the best case is when a company has a decently documented API and is open about allowing people to use it.

2 Likes

I know this is an old topic, but I just remembered and never got a response back from @nickmrawie. How would you approach developing this for HE? Would you piggy back on the pytryfi repo (based off undocumented API) to make an HE integration?

In cases of an undocumented API I would look at whatever existing code there is out there to try to give some ideas. When I created my Blink API driver I searched and found some research people had done to figure it out. From there I tried URLs and commands on my own until I got some basics working and expanded from there. Some projects I have looked at python (or other code) but to be honest most of that is not as useful to me because I do not consider myself much of a coder. But sometimes I can spot some pieces that do make sense or give me an idea on something to try.

I am also assuming that the company did not respond to any request for information about their API.

I sent Customer Service an email for API information and will try to call them and live chat this morning. I’ll give them until the end of the week to respond. I’ve never coded in Groovy (or anything Java-based) before, but I do develop in C# & SQL for a living. Any “Getting Started” stuff you found helpful?

I never coded groovy before my drivers either... and my "college coding classes" are a long time behind me. :slight_smile:

As for getting started:
I looked over the sample code that Hubitat has on Github, checked out how other people did their driver code, and an awful lot of searching on Google for groovy basics...

Another option / workaround (if you have an android phone) would be to use Tasker or Macrodroid to trigger Hubitat virtual switches when the Fi app sends notifications.

That’s a great idea! I wonder if there’s something like that for iPhone though. We don’t have android devices :frowning:

I don’t think there’s anything quite like Tasker on iOS, since Apple can be stingy about what kinds of permissions apps can be given.

Apple’s Shortcuts app might be one solution to look into though.

There's no time like the present! :sunglasses: