flow3r-openhab/README.md

42 lines
1.8 KiB
Markdown
Raw Normal View History

2023-09-10 07:14:18 +02:00
# flow3r-openhab
2023-09-10 07:10:47 +02:00
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. Copy `flow3r_openhab/config.example.json` to `flow3r_openhab/config.json` and enter your configuration details.
2023-09-10 07:10:47 +02:00
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-<macaddress>/event`.
Each event is a JSON string that looks like this:
2023-09-10 07:13:28 +02:00
```json
{"petal":"2","event":"touch_tip","dx":8083,"dy":6960,"duration":150}
```
2023-09-10 07:10:47 +02:00
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). |
2023-09-10 07:16:11 +02:00
| `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. |
2023-09-10 07:10:47 +02:00
| `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