Skip to content

ka-vaNu/blebox-virtual-devices

 
 

Repository files navigation

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.

About

Docker containers with virtual dummy devices emulating BleBox home automation products

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 98.6%
  • Shell 1.4%