I just found the component that makes a ESP32 S2/S3 work as a HID.
Now I want to set a number in the ESP and this button should then be pressed “on the keyboard”.
number:
- platform: template
name: "Digit"
id: digit
min_value: 0
max_value: 9
step: 1
icon: 'mdi:cog'
restore_value: true
initial_value: 1.0
optimistic: true
button:
- platform: template
name: "Template test"
on_press:
then:
- keyboard.down:
id: kbd
keys:
- "Digit{{ digit}}"
- delay: 10ms
- keyboard.up:
id: kbd
keys:
- "Digit{{ digit}}"
I assume I could do some type of lambda where if( digit == 0)
and so on but the above would be nice.
Or what other options do I have?