dgreif / homebridge-petsafe-smart-feed Goto Github PK
View Code? Open in Web Editor NEWA homebridge plugin for PetSafe Smart Feed
License: MIT License
A homebridge plugin for PetSafe Smart Feed
License: MIT License
When using the SmartFeedApi
directly, the call to setTimeout
in RestClient.updateIdToken
introduced in be3397f causes nodejs to wait forever preventing scripts from cleanly exiting.
To Reproduce:
const token = "ABC123";
const PetSafe = require('homebridge-petsafe-smart-feed/lib/api');
let sf = new PetSafe.SmartFeedApi({ token });
sf.getFeeders().then((feeders) => {
return feeders[0].getLastFeedingMessage();
}).then((lastFeedingMessage) => {
console.log("Will wait forever and never exit");
});
Possible solutions:
Does this still work for you? I have code I based on yours and recently all I get back is 429 errors when I try to login or query for feeders. I noticed they published a new ios/android app which seems to use a completely different API.
Hello,
I am seeing the following error message in my HB log, and I can no longer trigger the feeder from the Home app.
[27/03/2021, 19:27:44] [PetSafeSmartFeed] Failed to reach PetSafe server at https://api.ps-smartfeed.cloud.petsafe.net/api/v2/feeders. urlToHttpOptions is not a function. Trying again in 5 seconds...
My environment:
Homebridge v1.3.4
Node.js v14.15.3
homebridge-petsafe-smart-feed v1.2.6
Any thoughts on how to resolve?
Clear installation of this plugin (v1.3.1) under Homebridge v1.3.4. After I enter my email address, I receive the token over email and it fails to link the account with error 422, as below. Logging via the Smart Feed app (iOS) works just fine - although the token email comes from a different host in their domain, "directory.cloud.petsafe.net" instead of "cloud.petsafe.net".
Tried to downgrade to plugin v1.3.0, to no avail.
[7/13/2021, 7:48:43 AM] [Homebridge UI] [homebridge-petsafe-smart-feed] Incoming Request: /token
Getting token for [email protected] with code 946303
[7/13/2021, 7:48:43 AM] [Homebridge UI] [homebridge-petsafe-smart-feed] Failed to generate token
[7/13/2021, 7:48:43 AM] [Homebridge UI] [homebridge-petsafe-smart-feed] HTTPError: Response code 422 (Unprocessable Entity)
at Request.<anonymous> (/homebridge/node_modules/homebridge-petsafe-smart-feed/node_modules/got/dist/source/as-promise/index.js:117:42)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
code: undefined,
timings: {
start: 1626176923579,
socket: 1626176923580,
lookup: undefined,
connect: undefined,
secureConnect: undefined,
upload: 1626176923580,
response: 1626176923601,
end: 1626176923603,
error: undefined,
abort: undefined,
phases: {
wait: 1,
dns: undefined,
tcp: undefined,
tls: undefined,
request: NaN,
firstByte: 21,
download: 2,
total: 24
}
}
}
[7/13/2021, 7:48:47 AM] [Homebridge UI] [homebridge-petsafe-smart-feed] Terminating child process...
[7/13/2021, 7:48:47 AM] [Homebridge UI] [homebridge-petsafe-smart-feed] Child process ended
However, via CLI I am able to obtain a token properly:
/homebridge # npx -p homebridge-petsafe-smart-feed petsafe-auth-cli
npx: installed 34 in 4.986s
This CLI will provide you with a token which you can use to configure homebridge-petsafe-smart-feed. Please enter your email address to start the process.
Email: [email protected]
You should now receive an email from PetSafe. Please enter the code from that email below.
Code: 247242
Successfully logged in to PetSafe. Please use the following line in your homebridge config:
"token": "eyJhbGc(...)Fzuv8"
I was wondering if something like that could be done with the CatFlap?
https://www.surepetcare.com/en-gb/pet-doors/microchip-cat-flap-connect
I guess, as they run the same hub, shouldn’t be much different?
pls add parental control, feed amount, slow_feed and food status
I have a service dog in this will be a great addition to my (Small and starting out ) HomeKit! What features/actions will I be able to do with the home app after I install your plug-in?
Also could you please tell me about the feeder itself? Specifically the stainless steel bowl. Is that bowl removal war in 10 I use my own (when one bowl is in the dishwasher)?
Also are there any other smart devices that can receive HomeKit capability besides cameras?
@dgreif Just curious if your feeders actually return info for 'serial' or 'product_name', as mine just returns null for both.
I was considering making a pull request to hard code 'Smart Feed' for the model and switch serial number to use the ID, but I wanted to ensure my unit isn't strange first.
For reference, here is the 'state' object of my feeder after launch:
{
"id": 32420,
"serial": null,
"thing_name": "m-D0C5D3BCDFDE",
"battery_voltage": "46",
"region": "",
"connection_status": 2,
"is_food_low": 0,
"is_adapter_installed": true,
"is_batteries_installed": false,
"firmware_version": "V1.1.0.4",
"product_name": null,
"revision_desired": 7,
"revision_reported": 7,
"food_sensor_current": 0,
"food_sensor_reference": 0,
"network_rssi": -52,
"network_snr": 37,
"connection_status_timestamp": "2020-07-06 04:49:59",
"created_at": "2020-05-05 21:40:26",
"deleted_at": null,
"settings": {
"friendly_name": "Cat Feeder",
"paused": true,
"slow_feed": false,
"child_lock": false,
"notify_on_feed": true,
"notify_on_connection_state_change": true,
"notify_on_low_food": true,
"notify_on_empty_food": true,
"notify_on_error": true,
"notify_on_community_message": true,
"timezone": "America/New_York",
"ssid": null,
"pet_type": "cat",
"updated_at": "2020-07-07 23:44:51"
},
"schedules": [{
"time": "9:00",
"amount": 4,
"id": 342590,
"updated_at": "2020-05-05 21:44:52"
}, {
"time": "17:00",
"amount": 4,
"id": 342591,
"updated_at": "2020-05-05 21:41:09"
}]
}
Does this work with the gen2 pet safe feeder (the one with Alexa and dash support?)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.