Bluetooth-Devices / bthome-ble

Parser for BTHome BLE devices
https://bthome.io/
MIT License
64 stars 11 forks source link

Implementing BTHome for the Flic Twist #106

Closed GraceGRD closed 1 month ago

GraceGRD commented 5 months ago

Hi,

I'm working on creating custom firmware for the Flic Twist which uses bthome-v2 for communication.

For those who don't know about this device, it is a smart button with a rotary encoder and 12 LEDs.

Looking at the documented format I'm not sure which events I should support. E.g. implement combined button and dimmer events to do automations like push and twist.

I'm thinking about holding the button and rotate to select channel 1 to 12 (this would be an internal state of the flic). Then send rotate events for these channels when you rotate the device.

I would like some advice from you, what is the way forward to implement this using existing events or would creating new event-types make sense?

Ernst79 commented 5 months ago

We currently have two type of events, button presses and rotation of a dimmer, with the number of steps it has rotated.

It's all up to you what you want/need. you could make something like a button press event, and combine that with a "counter", which gives an actual state (1 to 12). A dimmer is more like, "rotate left with 3 steps from the current position". If you start at 9, and you rotate it 3 steps, a counter sensor would give a state of 9+3 = 12, while a dimmer event would only report rotate left, 3 steps. You could also use button + dimmer + counter, to have the actual direction + the state, if you need to distinguish between left and right rotation and also need the channel.

We can add a "channel" sensor, if that is helpful.

GraceGRD commented 5 months ago

Thank you for your quick response.

For now I don't think it is logical to add a "channel" sensor. First I'll have to get the rotary encoder peripheral functional before I'm attempting to hook everything up to BTHome. After this I'll do some testing using the available events (button/dimmer) including a counter and check if this works nicely with Home Assistant automations.

Ernst79 commented 5 months ago

ok, let me know if you need new sensors and/or events.

Ernst79 commented 1 month ago

I'm closing this issue for now. Please open a new one if you need further assistance