Using Homehabit App to control color temperature of lights with old android tablet

As a quick disclaimer: I am completely new to Home Assistant and creating automations. So in case you have any suggestions or rants about my way of doing stuff feel free to let me know.

A quick word on my setup: I decided to use my old off-brand android tablet running android 5.1 as a dashboard for Home Assistant.

Why use Homehabit?

The obvious choice would be to just download the Home Assistant app and create a dashboard. That is easier said than done on such an old device. The problem here is that the android webview app on my tablet is too old and gets stuck before the login screen of Home Assistant. Long story short, after going through the rabbit hole for roughly two days trying to first update the webview app, I just gave up when I found out that you can use the Homehabit app that uses chrome instead of webview. (Sidenote: I could also have used the web interface but I really wanted to have an app that just shows my dashboard as the homescreen)

The problem with Homehabit
The problem with Homehabit is that it is a pain to setup anything that is not already implemented by the devs. I have yeelight color light bulbs and normally I can both control their color and the white color temperature (You can get white light in color mode but then it looks uglier and is not as bright since it does not use the dedicated white leds in the bulb).
However, for some reason Homehabit did really not want to control the white leds, i.e. color temperature. The presets only allow controlling the rgb color and if you want to create a custom widget the app only allows you to control very specific entities from Home Assistant (and the config file has very different names for the attributes for some reason).

My solution
In the end I managed to get things working by creating an input_number in my Home Assistant config which creates a slider which in turn triggers an automation that sets the color temperature according to the desired slider value. The Homehabit app can control the input_number value with the dimmer widget.
I really wanted to have the input_number trigger a script that basically does the same as the automation for the simple reason that I feel like this sort of thing doesn’t belong to my “automations” but is rather a underlying mechanism which would be better placed in scripts. But I did not find the right syntax to formulate it as a script.

I am only posting this because I searched way too long through the internet for a post with a solution just like this but was unsuccessful… So I hope people who are having the same niche problem as me find this and don’t have to go through the pain I had to go through.

My config
input_number:
  groove_ct:
    name: Color Temperature
    initial: 4200
    min: 2800
    max: 6800
    step: 100
    unit_of_measurement: "K"

automation:
  alias: Groove Lights - Adjust Color Temp
  triggers:
  - trigger: state
    entity_id: input_number.groove_ct
  actions:
  - action: light.turn_on
    target:
      entity_id: light.groove_lights
    data:
      color_temp_kelvin: '{{ trigger.to_state.state | int }}'