From 4e56fcf9391f96f1980cf460560c316ebd2e5156 Mon Sep 17 00:00:00 2001 From: s3lph Date: Sun, 10 Sep 2023 07:10:47 +0200 Subject: [PATCH] feat: add readme --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..a46120a --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# flow3r-mqtt + +An app for the CCCamp 2023 [flow3r][flow3r] badge that submits detected touch gestures to an MQTT broker. + +I wrote this so that the flow3r can be used as a remote control for +OpenHAB (which subscribes to the MQTT broker), but it should be usable +with other subscribers as well. + +## Installation + +1. Edit `flow3r_openhab/__init__.py` and set the variables `WIFI_SSID`, `WIFI_PSK` and `MQTT_BROKER_IP`. +1. Copy the `flow3r_openhab` directory to `/sys/apps/flow3r_openhab` on the flow3r's flash filesystem. +1. Reboot the flow3r and start the `OpenHAB` app + +## Events + +The touch events detected by the flow3r are published to the topic `flow3r-/event`. + +Each event is a JSON string that looks like this: + + {"petal":"2","event":"touch_tip","dx":8083,"dy":6960,"duration":150} + +The keys and their values are defined as follows: + +| Key | Value | +|:---|:---| +| `petal` | The petal the event was detected on. Uses the numbers printed on the PCB (1-10), rather than the `captouch` indexes (0-9). | +| `event` | The type of gesture that was detected. One of `touch_tip`, `touch_base`, `swipe_up`, `swipe_right`, `swipe_down`, swipe_left`, whereas `swipe_up` always means a swipe towards the tip of the petal, and `swipe_down towards its base. | +| `dx` | The distance between start and end of the touch event in `x` (base-to-tip) direction. Unitless number, as returned by [captouch's `position()` function][captouch]. | +| `dy` | The distance between start and end of the touch event in `y` (side-to-side) direction. | +| `duration` | The duration between start and end of the touch event in `ms`. | + + +## License + +MIT License + +[flow3r]: https://flow3r.garden/ +[captouch]: https://docs.flow3r.garden/api/captouch.html#captouch.CaptouchPetalState.position