Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to get a dog's current state? #35

Open
sharpopotamus opened this issue Jul 15, 2021 · 7 comments · Fixed by #54
Open

Any way to get a dog's current state? #35

sharpopotamus opened this issue Jul 15, 2021 · 7 comments · Fixed by #54

Comments

@sharpopotamus
Copy link

sharpopotamus commented Jul 15, 2021

The Fi app gives state info like "Dog is on a walk" or "Dog is with [Person]". Is there any way to extract that info via this integration?

@sharpopotamus sharpopotamus changed the title Any way to get a dog Any way to get a dog's current state? Jul 15, 2021
@sbabcock23
Copy link
Owner

It's possible however there are two different concepts here. One is if the dog is connected to someone or the home base. The other is the dogs activity state. Both are possible but are treated as independent attributes.

@ross-lanes
Copy link

ross-lanes commented Aug 25, 2022

I get what your saying @sbabcock23 but my dog is an escape artist and if I could have some of that info I could make Alexa announce that he has escaped. He made it almost a mile last time before I saw the alert :(.

Is there a reason you didn't include the pet's currPlaceAddress, currPlaceName, or activityType? I don't know if you could add them as dedicated entities, not sure what type you would use, but couldn't they be added as attributes on the device tracker entity?

I'm not an expert HA dev, just starting to look through the dev docs, but I'd be happy to work on this and contribute it back, if you think it would be appropriate.

@sbabcock23 sbabcock23 linked a pull request Aug 25, 2022 that will close this issue
@sbabcock23
Copy link
Owner

@Bestadd - I've added the attributes in the latest release. Please take a look.

@ross-lanes
Copy link

well good news bad news...

so it does work, just not as I had expected/hoped (not your fault I blame Fi, they really should have an official API).

Good news, currPlaceName will show the Safe Zone the pup is currently in regardless of type, I tested with a GPS, Wifi, and Base Station Safe Zone (hence the delay). If the pup isn't in a Safe Zone the value of currPlaceName is UNKNOWN.

Bad news, currPlaceAddress is only set if the pup is in a Safe Zone it is UNKNOWN otherwise.

activityType is either ongoingWalk or ongoingRest. The bad news there is if the pup escapes from a safe zone or runs off while on a walk this doesn't update :(

So to pull off what I want to I think I need to tiger the announcement when
someone in group.human_family is home AND pup.currPlaceName == UNKNOWN AND pup.distanceToOwner >= .01

I am working on adding distanceToOwner using a templated sensor using the built in distance function

I'm unsure if you want to add any of this info to the docs, may be helpful for others. However, looking at the SDK you wrote I don't see any other properties you could add to help with this, I haven't looked at the raw GraphQL responses so there might be something out there, but having the currPlaceName will help a lot!!!

if you ever setup a patron or a buy me a coffee link let me know, of all the community add-ons I use this one is by far the most important to me and I'd love to support you.

@sbabcock23 sbabcock23 reopened this Aug 26, 2022
@sbabcock23
Copy link
Owner

Hi @Bestadd,

If I setup an account I'll let you know.

I just released a connectedTo attribute which may help you in what you are trying to achieve. The options that I have noticed for connectedTo for the pet are the following:

  • ConnectedToUser
  • ConnectedToBase
  • UnknownConnectivity

This may help you in what you are trying to achieve. Since you are using HA you could probably setup an automation something along the lines of "if pet is NOT home and the ConnectedTo status is NOT (ConnectedToBase OR ConnectedToUser) then perform some action". I chose is NOT connectedToBase OR connectedToUser only because these are the statuses I observed. I am not sure if there are other statuses.

I noticed that when I turned off the base and my phone, that the currentPlaceName was set to UNKNOWN (just a FYI).

@ross-lanes
Copy link

seriously I owe you a coffee!!! now, I just can't forget my phone when I take him on a walk :D

it makes since that currentPlaceName was set to UNKNOWN when you turned the base and phone off. Since the "Home" location is a "base" SafeZone and not a GPS SafeZone when the base goes off line Fi thinks the pet isn't in the safe zone anymore. This wasn't a permutation I had ever considered...

Just out of curiosity when you turned off your phone and base did does the app show that they "left home" in the app? I wonder if the app has even more logic to detect base power outages. You can set a fence like you can with GPS Safe Zones for the Base Zone. I'll test that out myself latter tonight.

I do wish they would allow us to have a SafeZone that was a combo base+wifi+gps :(

@ross-lanes
Copy link

There is also ConnectedToWifi and ConnectedToCellular, I haven't seen UnknownConnectivity yet.

This is working very well with the logic you suggested!!! Let me do some more testing and I'll post the automation so others can use it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants