GithubHelp home page GithubHelp logo

uberfoo / homebridge-particle-io Goto Github PK

View Code? Open in Web Editor NEW

This project forked from norman-thomas/homebridge-particle-io

0.0 3.0 0.0 109 KB

Homebridge plugin for Particle Devices

JavaScript 100.00%

homebridge-particle-io's Introduction

npm Known Vulnerabilities CodeFactor Build Status Coverage Status

Particle.io device plugin for Homebridge

As you all know in the new version of Homebridge, the plugin architecture is changed. In new Homebridge, plugins are published through NPM with name starts with homebridge-. Users can install the plugin using NPM.

You can install it using NPM like all other modules, using:

npm install -g homebridge-particle-io.

In this version, I have made some changes from the older version. Mainly the plugin is now a Homebridge Platform. Also in this version accessories are defined in config.json file. The plugin loads the accessories from the config.json file and create accessory dynamically. A sample configuration file is like:

  {
    "bridge": {
      "name": "Homebridge",
      "username": "CC:22:3D:E3:CE:39",
      "port": 51826,
      "pin": "031-45-154"
    },

    "description": "This is an example configuration file with one Particle platform and 3 accessories, two lights and a temperature sensor. You should replace the access token and device id placeholder with your access token and device id",

    "platforms": [
      {
        "platform": "ParticleIO",
        "name": "Particle Devices",
        "access_token": "<<access token>>",
        "cloud_url": "https://api.particle.io/v1/devices/",
        "devices": [
          {
            "name": "Bedroom Light",
            "type": "lightbulb",
            "device_id": "<<device id>>",
            "function_name": "onoff",
            "args": "0={STATE}"
          },
          {
            "name": "Kitchen Light",
            "type": "lightbulb",
            "device_id": "<<device id>>",
            "function_name": "onoff",
            "args": "1={STATE}"
          },
          {
            "name": "Kitchen Temperature",
            "type": "temperaturesensor",
            "device_id": "<<device id>>",
            "event_name": "tvalue"
          }
        ]
      }
    ]
  }

As you can see from the above example this config.json file defines 3 accessories. 2 Lights and one Temperature Sensor. The access_token defines the Particle Access Token and cloud_url defines the base Particle API url. If you are using the Particle Cloud, then the value of cloud_url should be https://api.particle.io/v1/devices/. If you are using local cloud, then replace with your sensor address.

The devices array contains all the accessories. You can see the accessory object defines following string objects:

  • name - Display name, this is the name to be displayed on the HomeKit app.
  • type - Type of the accessory. As of now, the plugin supports 3 types: lightbulb, temperaturesensor and humiditysensor.
  • device_id - Device ID of the Particle Device (Core, Photon or Electron). It is defined in accessory so that you can use different Particle Devices for different accessory.
  • event_name - The name of the event to listen for sensor value update. This is only valid if the accessory is a sensor (i.e. currently temperaturesensor or humiditysensor). The plugin listens for events published from a Particle Device (using Particle.publish). The device firmware should publish the sensor values as a raw number.
  • function_name - The name of the function that will be called when an action is triggered via HomeKit. This is only valid if the accessory is an actor (i.e. currently only lightbulb).

homebridge-particle-io's People

Contributors

jakeholland avatar krvarma avatar moors7 avatar norman-thomas avatar

Watchers

 avatar  avatar  avatar

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.