Git Product home page Git Product logo

blebox-virtual-devices's Introduction

Virtual BleBox devices

11 dockerized BleBox device emulators - designed to help integration developers and maintainers (who may not own actual BleBox devices).

Based on actual BleBox home automation products.

(Only minimal features are implemented - to help quickly and reliably create and test basic integrations).

Based on API docs here: https://technical.blebox.eu

Usage

  1. Create the docker network blebox_sensors:
$ docker network create blebox_sensors
  1. Start the devices:
$ docker-compose up
  1. List the devices:
$ docker network inspect blebox_sensors

or, if you have jq installed:

$ docker network inspect blebox_sensors | jq '.[0]["Containers"] | map(.IPv4Address + " " + .Name)'

Testing

  1. Detect the device type/product:
$ curl -s http://172.20.0.4:80/api/device/state | jq
{
  "device": {
    "deviceName": "My sauna 1",
    "type": "saunaBox",
    "fv": "0.176",
    "hv": "0.6",
    "apiLevel": "20180604",
    "id": "aafe34db94f7",
    "ip": "172.20.0.4"
  }
}
  1. Get the status with the product-specific API:
$ curl -s http://172.20.0.4:80/api/heat/state | jq
{
  "heat": {
    "state": 1,
    "desiredTemp": 7126,
    "sensors": [
      {
        "type": "temperature",
        "id": 0,
        "value": 7126,
        "trend": 0,
        "state": 2,
        "elapsedTimeS": 0
      }
    ]
  }
}
  1. Interact with the product:
$ curl -d '{"heat": { "state": 1, "desiredTemp": 6300 }}' -si "http://172.20.0.4:80/api/heat/set"

Tips

  • when stopping the containers, press Ctrl-C twice for faster shutdown

  • use the find_box script to return the current IP addresses with matching names:

    $ find_box "sauna" # prints e.g. 172.20.0.5

    or, use a command that always works:

    $ curl -d '{"heat": { "state": 1, "desiredTemp": 6300 }}' -si "http://$(./find_box 'sauna'):80/api/heat/set"

Limitations

  • error codes may not be the same (not an issue in practice)
  • doesn't implement specific hardware/firmare versions (but BleBox maintains backward compatibility and upgrading firmware is recommended always)
  • default functionality is emulated (actual BleBox devices are highly configurable and rich with features - but those are better set using the BleBox Android/iOS apps)
  • lots of features are missing (the current ones should be sufficient - if not, let me know or create a PR)
  • no integration tests (yet)

Contributing

The usual. Open an issue, submit a PR, etc.

Please let me know if there are any differences from the way real BleBox devices behave.

blebox-virtual-devices's People

Contributors

gadgetmobile 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.