flow3r-openhab/README.md

1.8 KiB

flow3r-openhab

An app for the CCCamp 2023 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.
  2. Copy the flow3r_openhab directory to /sys/apps/flow3r_openhab on the flow3r's flash filesystem.
  3. 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:

{"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.
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