Coder Social home page Coder Social logo

homebridge-petsafe-smart-feed's People

Contributors

dependabot[bot] avatar dgreif avatar sunoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dcmeglio

homebridge-petsafe-smart-feed's Issues

SetTimeout in rest client prevents nodejs from exiting.

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:

  • provide a configuration option to disable the hourly token renewal and instead renew after receiving a 401
  • provide a method to cancel the timeout
  • renew the token as needed right before making a request

Still working for you?

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.

Error message in HB log

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?

Incorrect Low Battery Warning

After a several day long power outage, the Homebridge plugin reports 0% battery, but the official app has it at about 2/3. I’ll try to do more troubleshooting tomorrow after work. I’m also not quite sure why it shows that it is charging in this plugin.

16F307DC-019D-4691-9FE0-6D57FED527F1
D7DDE120-B976-43C8-B8BE-BC82B8E7A743

Failed to generate token

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"

Features

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?

Model and Serial Number Missing

@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"
    }]
}

Works with gen2?

Does this work with the gen2 pet safe feeder (the one with Alexa and dash support?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.