Syncing state of 433MHz wall switches with state of bulbs

Hi Guy’s,

I’m new to Home Assistant, after using Domoticz for the past 5 years. Wow, what an awesome platform Home Assistant is…!

I have a question about syncing wall switches states to bulb states, and couldn’t find a good answer online.


  • Light bulbs: MiLight, integrated using esp8266 milight emulator hub.
  • Wall Switches: KaKu (klikaan klikuit) 433MHz, integrated using RFlink.
  • Node red Flow that listens for events with state changed for the 433MHz KaKu switches. If switch state is changed to On or Off, MiLight bulb goes On or Off. Also see picture below for the flow.

When using home assistant to switch MiLight Bulbs, switch state of 433MHz KaKu switc doesn’t reflect the state of the Bulb. This results in the fact that a bulb can only switched off
by the 433MHz kaku switch after first pressing ‘On’, on the KaKu Switch. Otherwise, home assistant will not sent a state changed event, because 433MHz switch in HASS was already off.

(Temporary) Fix:
For now, I temporarily fixed it by making an extra flow in Node Red, that listens for state changed events of the bulbs, and sync it that way to the 433MHz switches. This results in
2 state changed events when turning a bulb On or Off in HASS. See picture below!

I have the feeling that this could be more easily done without two state changed events.

Anybody with an opinion about this?:slight_smile:

Nobody who have a good / better solution ? :slight_smile:

Let me see if I got this right.
You have a Milight bulb that you are controlling with an ESP8266.
And on the other hand you have a KaKu switch that acts as an emitter, RFLink receives the signal and HA acts on the bulb (through ESP8266).
It is right?

And your problem must be the representation of the KaKu switch in HA, since being in a wrong state it does not react correctly to state changes.

The RFLink integration don’t expose any service to change the device’s status (without triggering an action).
One option is for RFLink to ‘listen’ for events from a device alias, but being different integrations I don’t think this is possible.
Another option could be to define the KaKu switch as a light of type toogle and use a template to represent the switch. That way I guess you could modify the state of the template and no events would be fired from RFLink part.

So as you can see, no, I don’t see a simple alternative to the solution you already have implemented.


Hi Javicalle,

Thanks so much! Yes you are absolutely understand it correct!

Kaku wall switch --> rflink --> HAS <–> ESP8266 with milight emulator software —> milight bulb

Thanks for your suggestions on some other methods to implement a correct switch state for the dumb kaku wall switches, templating way sounds interesting and I’ll have a look at it :slight_smile:

So, for everyone out there who faces the same issue someday…I managed to make it work like I wanted to. I hope it can be helpfull for you.

This setup assumes that represententation of 433MHz kaku switches state in Home Assistant is not important; Kaku wall switches acts like “button press” devices. In fact I just don’t look at the states of the switches in HASS at all. This automation works way quicker than my Node-Red method as in my first post.

  1. Set up you rflink to always fire an ‘button_pressed’ event:

This will always sent a ‘button_pressed’ event in HASS, regardless of the state of the switch within HASS.

E.g. if switch in HASS state is 'On, and you press the KAKU switch ‘On’, a button_pressed event will be sent.


  - platform: rflink
    automatic_add: false
      fire_event: true
        name: Hallway - sw_kaku1
  1. Go to Developer tools --> events
    Under the heading Listen to events fill in:

event to subscribe to: button_pressed

Click start listening.

  1. Output will look something like:
    "event_type": "button_pressed",
    "data": {
        "entity_id": "switch.Hallway - sw_kaku1",
        "state": "off"
    "origin": "LOCAL",
    "time_fired": "2020-12-17T13:16:15.597903+00:00",
    "context": {
        "id": "a8e5d171a90191ebec56525bd1103f72",
        "parent_id": null,
        "user_id": null

Make an automation with the event ‘button_pressed’ as trigger and your desired action. E.g. I toggle lights connected to the switches. I don’t care about an ‘On’ or ‘Off’ command from the switch, but you can incorporate it too off course.


- id: '1608210670712'
  alias: SW gang_sw_kaku1 - Hallway Light
  description: ''
  - platform: event
    event_type: button_pressed
      entity_id: switch.gang_sw_kaku1
  condition: []
  - type: toggle
    device_id: d3d12c287b557463bf63e891b3b18f72
    entity_id: light.gang
    domain: light
  mode: single

You can use the automation editor to add this kind of simple automations.

1 Like