Home - torrottum/ikea-ansluta-esphome GitHub Wiki
Work in progress!
Installation
-
Download the latest release
-
If you don't have it already, create a
custom_componentsdirectory and copyikea_anslutainto itNote: This is ESPHome's custom_components directory, not Home Assistant's.
-
Set up the Ikea Ansluta Component and Light component
Modes of operation
There are two different ways of using ikea-ansluta-esphome. You can either pair directly with the light fixture or using the remote control's address.
Pairing directly with the light (recommended)
To pair directly you need to create a 16 bit hex address that is different from your remote control and use it in the light configuration (random.org can be helpful for generating the two bytes). To pair with the light you have two options:
- You can set pairing_enabled to on/true in your light configuration, pair with your light(s) and then disable it again.
- You can use the
ikea_ansluta.enable_pairing_modeandikea_ansluta.disable_pairing_modeactions.
If you want to use the remote to control the lights, you can use the the Ikea Ansluta Component's on_remote_click trigger
Using the remote control's address
It's also possible to use the remote control's adress for the light component. Just use your remote's address for the light.
This has one problem though. The remote uses this sequence when you click it: ON 50%, ON 100%, ON 50%, OFF. If you change the light using HA the remote will still continue where it left off. This means you might need to click the remote a few more times to get the desired result.
Plus that during testing I've found that pairing directly with the light to be more stable than using the remote. I think this is due to the remote sending the command 50 times while ikea-ansluta-esphome sends the command 75 times (by default, the times to send is configurable).
Finding your remote address
To find your remote address (if you want to filter in the on_click_trigger or use the remote address ), you can it using the Ikea Ansluta Component's on_remote_click trigger
on_remote_click:
then:
- logger.log:
format: "Remote with address %#04x sent command %#02x"
args: ['address', 'command']
Component documentation
Exposing your remote to HA
Personally, I just fire an event using the homeassistant.event action in the on_remote_click trigger and use that in my HA. But you can also use a sensor, etc. Here's an example using an event:
on_remote_click:
then:
- homeassistant.event:
event: esphome.ansluta_remote_clicked
data:
address: !lambda 'char buffer [4]; return itoa(address, buffer, 16);'
command: !lambda 'char buffer [2]; return itoa(command, buffer, 16);'
You can then use the event to create an automation in HA:
- alias: "Remote: Ansluta remote toggles kitchen lights"
id: ae8d0976-b08d-46fc-87d1-0a4bfcf1b182
trigger:
- platform: event
event_type: esphome.ansluta_remote_clicked
event_data:
address: beef
action:
- service: light.toggle
target:
entity_id: light.my_light
mode: restart