GithubHelp home page GithubHelp logo

cr0ybot / almond-adapter Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 71 KB

Unofficial Securifi Almond adapter plugin for Mozilla IoT Gateway

License: Mozilla Public License 2.0

JavaScript 95.38% Shell 4.62%

almond-adapter's People

Contributors

cr0ybot avatar

Watchers

 avatar  avatar

almond-adapter's Issues

Map Almond DeviceValues to WoT Properties

Using this DeviceList documentation, we should be able to map Almond devices to WoT Capabilities, and Almond device "values" to WoT Properties, more or less.

Unfortunately, this will include only the most generic information about each device; for instance, Philips Hue non-color bulbs show up for me as a MultilevelSwitchOnOff which does not include that the device is a lightbulb. A Z-Wave in-wall dimmer switch shows up as just MultilevelSwitch, but at least in that case it really is just a switch. The Hue bulbs also include a bunch of other "values" that aren't in the documentation for MultilevelSwitchOnOff that are similar to Device ID 48, HueLamp, but not in the same order.

Get device list from Almond

https://wiki.securifi.com/index.php/Websockets_Documentation#Devicelist

DeviceValues seem to mostly map to Properties for the most part. Not included in the sample below are Type values (int) associated with each DeviceValue entry. I haven't been able to find any public documentation of these Type values, though I've determined that "SWITCH BINARY" is always type 1.

Sample response:

Response
{  
  "MobileInternalIndex":"<random key>",
  "CommandType":"DeviceList",
  "Action":"addAll",
  "Devices":{  
     "1":{  
       "Data":{ 
               "ID":"1",
               "Name":"ContactSwitch #1",
               "AssociationTimestamp":"1462172879",
               "Type":"12",
               "Location":"Default",
               "LastActiveEpoch":"1462172879", 
                "Manufacturer":"Sercomm Co",
               "Version":"16",
               "Model":"Unknown"
       },
        "DeviceValues":{  
           "1":{  
              "Name":"STATE",
              "Value":"true"
           },
           "2":{  
              "Name":"LOW BATTERY",
              "Value":"0"
           },
           "3":{  
              "Name":"TAMPER",
              "Value":"true"
           }
        }
     },
     "2":{ 
       "Data":{  
                "ID":"2",
                "Name":"BinarySwitch #2",
                "FriendlyDeviceType":"BinarySwitch",
                "Type":"1",
                "ID":"2",
                "Location":"Default"
        },
        "DeviceValues":{  
           "1":{  
              "Name":"SWITCH BINARY",
              "Value":"true"
           }
        }
     }
  }
}

Utility for generating MobileInternalIndex

A MobileInternalIndex (or mii for short) is used in each request to the Websocket API in order to match a response. Since the Websocket will receive events and other data periodically, we'll need to know how to check if data received is for a specific response sent.

A mii is a string of random numbers (all example requests use numbers only) up to 32 character long.

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.