Neverending Package Mountain

    ikettle

    0.1.0 • Public • Published

    Node iKettle

    BuildStatus GitHub version Dependency Status devDependency Status


    This library enables easy access to an iKettle. Much of the knowledge for interacting with the iKettle was from Mark Cox's blog article, "Hacking a Wifi Kettle".

    var iKettle = require("ikettle");

    Currently the functionality is read-only, ie. iKettle state can be read and is updated as the kettle state changes. If it on roadmap to provide write access to kettle state.

    Please see the scripts in the examples directory for ways in which this library can be used.

    Connecting to your iKettle

    iKettle.connect(port, host, function(err, state) {
      if (err) {
        return;
      }
      // Use state model here
    });

    The default port for the iKettle is 2000.

    Calling connect will confirm that the host is an iKettle and will retrieve the current state which is used to populate the model.

    The callback function follows the nodejs convention, If an error has occurred, the first parameter err will be an Error object and model will be undefined. If an error has not occurred, err will be null and state will be a Backbone model.

    iKettle state

    This state model is held in a Backbone model. It is provided as a parameter to the connect callback, or via iKettle.state.

    In depth information on using Backbone models can be found in the Backbone documentation, but basic usecase for using the model:

    Checking if the kettle is on

    var is_kettle_on = state.get("on");

    Monitoring kettle state changes

    state.on("change", function(details) {
      var what_changed = details.changes;
    });

    Closing the connection

    iKettle.destroy();

    This will close the connection to the iKettle and destroy the state model.

    Upcoming

    1. Sync changes to state model back to the iKettle
    2. Have periodic sync with iKettle to confirm state model holds correct state

    Contact

    Twitter @alistairjcbrown

    Code signed using keybase as alistairjcbrown. Verify with keybase dir verify

    Keywords

    none

    Install

    npm i ikettle

    DownloadsWeekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • alistairjcbrown