RFLink - Light (MiLight)

So I’m not sure if I am jumping the gun on HASS/RFLink/MiLight support as I have read mixed reports of this working and or not being supported, yet.

I thought I’d post as I couldn’t find any real configuration for MiLight and RFLink for HASS. I have tested the RFLink in Domoticz and it does work for the Milight bulbs, however in HASS is another beast entirely. Obviously due to countless hours of configuration in HASS I do not want to switch to Domoticz for lighting.

So I have ripped out the MiLight IDs from the HASS Debug log and added them to my configuration, I have run script check to confirm everything is working and booted up HASS.

The Light entities are detected by HASS and they load up into my configuration on the front end, however when I flip the switch on and off nothing happens and the lights do not illuminate. The same goes for i the light is on, and I switch it off in HASS nothing happens. I can see the action happening in the logs but this is not reflected in the bulbs.

Anyone got any ideas?

@Whiskey @aequitas
configuration.yaml

rflink:
  port: /dev/serial/by-id/usb-Arduino__www.arduino.cc__0042_85632313039351911102-if00
# ls -l /dev/serial/by-id/
light:
  platform: rflink
  automatic_add: true
  device_defaults:
    fire_event: true
    signal_repetitions: 2
  devices:
    milightv1_c888_01:
      name: Bedroom Light
    milightv1_c888_02:
      name: Kitchen Light

Debug Log

2017-05-21 10:24:21 DEBUG (MainThread) [rflink.protocol] received data: 20;AB;PONG;
2017-05-21 10:24:21 DEBUG (MainThread) [rflink.protocol] got packet: 20;AB;PONG;
2017-05-21 10:24:21 DEBUG (MainThread) [rflink.protocol] decoded packet: {'node': 'gateway', 'ping': 'pong', 'protocol': 'unknown'}
2017-05-21 10:24:36 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=homeassistant, service_data=entity_id=light.bedroom_light, service=turn_on, service_call_id=1977907344-1>
2017-05-21 10:24:36 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service_data=entity_id=['light.bedroom_light'], service=turn_on, service_call_id=1977907344-2>
2017-05-21 10:24:36 DEBUG (MainThread) [homeassistant.components.rflink] Sending command: on to Rflink device: milightv1_c888_01
2017-05-21 10:24:36 DEBUG (MainThread) [rflink.protocol] sending command: {'id': 'c888', 'protocol': 'milightv1', 'command': 'on', 'switch': '01'}
2017-05-21 10:24:36 DEBUG (MainThread) [rflink.protocol] writing data: '10;milightv1;c888;01;on;\r\n'
2017-05-21 10:24:36 DEBUG (MainThread) [rflink.protocol] waiting for acknowledgement
2017-05-21 10:24:37 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=homeassistant, service_data=entity_id=light.kitchen_light, service=turn_on, service_call_id=1977907344-3>
2017-05-21 10:24:37 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service_data=entity_id=['light.kitchen_light'], service=turn_on, service_call_id=1977907344-4>
2017-05-21 10:24:37 DEBUG (MainThread) [homeassistant.components.rflink] Sending command: on to Rflink device: milightv1_c888_02
2017-05-21 10:24:41 WARNING (MainThread) [rflink.protocol] acknowledge timeout
2017-05-21 10:24:41 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state light.bedroom_light=off; friendly_name=Bedroom Light, assumed_state=True @ 2017-05-21T10:23:05.522200+01:00>, new_state=<state light.bedroom_light=on; max_mireds=500, min_mireds=154, friendly_name=Bedroom Light @ 2017-05-21T10:24:41.860231+01:00>, entity_id=light.bedroom_light>
2017-05-21 10:24:41 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1977907344-2>
2017-05-21 10:24:41 DEBUG (MainThread) [rflink.protocol] sending command: {'id': 'c888', 'protocol': 'milightv1', 'command': 'on', 'switch': '02'}
2017-05-21 10:24:41 DEBUG (MainThread) [rflink.protocol] writing data: '10;milightv1;c888;02;on;\r\n'
2017-05-21 10:24:41 DEBUG (MainThread) [rflink.protocol] waiting for acknowledgement
2017-05-21 10:24:41 DEBUG (MainThread) [homeassistant.components.rflink] Sending command: on to Rflink device: milightv1_c888_01
2017-05-21 10:24:41 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state group.rflink_lights=off; order=0, hidden=True, assumed_state=True, friendly_name=Lighting, view=True, entity_id=('light.bedroom_light', 'light.kitchen_light') @ 2017-05-21T10:23:05.530327+01:00>, new_state=<state group.rflink_lights=on; order=0, hidden=True, assumed_state=True, friendly_name=Lighting, view=True, entity_id=('light.bedroom_light', 'light.kitchen_light') @ 2017-05-21T10:24:41.885107+01:00>, entity_id=group.rflink_lights>
2017-05-21 10:24:41 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state group.all_lights=off; order=1, hidden=True, assumed_state=True, friendly_name=all lights, auto=True, entity_id=('light.bedroom_light', 'light.kitchen_light') @ 2017-05-21T10:23:05.535130+01:00>, new_state=<state group.all_lights=on; order=1, hidden=True, assumed_state=True, friendly_name=all lights, auto=True, entity_id=('light.bedroom_light', 'light.kitchen_light') @ 2017-05-21T10:24:41.892469+01:00>, entity_id=group.all_lights>
2017-05-21 10:24:41 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1977907344-1>
2017-05-21 10:24:46 WARNING (MainThread) [rflink.protocol] acknowledge timeout
2017-05-21 10:24:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state light.kitchen_light=off; friendly_name=Kitchen Light, assumed_state=True @ 2017-05-21T10:23:05.525620+01:00>, new_state=<state light.kitchen_light=on; max_mireds=500, min_mireds=154, friendly_name=Kitchen Light @ 2017-05-21T10:24:46.879231+01:00>, entity_id=light.kitchen_light>
2017-05-21 10:24:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1977907344-4>
2017-05-21 10:24:46 DEBUG (MainThread) [rflink.protocol] sending command: {'id': 'c888', 'protocol': 'milightv1', 'command': 'on', 'switch': '01'}
2017-05-21 10:24:46 DEBUG (MainThread) [rflink.protocol] writing data: '10;milightv1;c888;01;on;\r\n'
2017-05-21 10:24:46 DEBUG (MainThread) [rflink.protocol] waiting for acknowledgement
2017-05-21 10:24:46 DEBUG (MainThread) [homeassistant.components.rflink] Sending command: on to Rflink device: milightv1_c888_02
2017-05-21 10:24:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state group.rflink_lights=on; order=0, hidden=True, assumed_state=True, friendly_name=Lighting, view=True, entity_id=('light.bedroom_light', 'light.kitchen_light') @ 2017-05-21T10:24:41.885107+01:00>, new_state=<state group.rflink_lights=on; order=0, view=True, friendly_name=Lighting, hidden=True, entity_id=('light.bedroom_light', 'light.kitchen_light') @ 2017-05-21T10:24:41.885107+01:00>, entity_id=group.rflink_lights>
2017-05-21 10:24:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state group.all_lights=on; order=1, hidden=True, assumed_state=True, friendly_name=all lights, auto=True, entity_id=('light.bedroom_light', 'light.kitchen_light') @ 2017-05-21T10:24:41.892469+01:00>, new_state=<state group.all_lights=on; order=1, friendly_name=all lights, auto=True, hidden=True, entity_id=('light.bedroom_light', 'light.kitchen_light') @ 2017-05-21T10:24:41.892469+01:00>, entity_id=group.all_lights>
2017-05-21 10:24:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1977907344-3>
1 Like

Not a direct answer, but don’t you need a NRF24L01 for this to work ?
How will HA detect the NRF24L01 ?
I have several rflink’s but don’t have a milight (yet)

highly interested if you get this to work :slight_smile:

– Passie

@passie Yes, I already have the NRF24L01, I purpose built the RFLink for controlling MiLights only. I have confirmed the RFLink is working in Domoticz and I am am able to use Domoticz to control all of my MiLights. However moving to Domoticz is not an option given the countless hours of configuration in HASS.

1 Like

Can you add logging for received milight events? This way it is possible to deduct the values used for switching on and off. From some other topics I got the impression milight doesn’t use ‘on’ and ‘off’ so the default rflink config will not work there.

@aequitas Please can you advise on how to do that as I have posted the debug logs for the rflink, is there another logging level I need to add to my configuration.yaml?

Edit: Here is the full boot sequence of events for RFLink :slight_smile:

Do this:
http://blog.christophermullins.com/2017/02/11/milight-wifi-gateway-emulator-on-an-esp8266/

…and use MQTT instead of UDP, plus set it to reboot every now and then.
Solved all problems for me.

I found the logging i’m looking for in the boot sequence, eg:

2017-05-25 19:36:55 DEBUG (MainThread) [rflink.protocol] received data: ;MiLightv1;ID=C888;SWITCH=01;RGBW=1ee8;CMD=ON;
1 Like

Perfect, looking forward to a fix on this :slight_smile:

Any news on getting MiLight (LimitlessLED) work with NRF24L01 on Home Assistant?

1 Like

Would you mind listing this hardware please?
I am using the hardware from http://blog.christophermullins.com/2017/02/11/milight-wifi-gateway-emulator-on-an-esp8266/ but I am finding range problems and not all lights are turning on every time. The antenna you have looks like it would solve these problems.

Thanks

Looking forward to this too, i have wall mounted touch switches that operates directly with the milight bulb, i can see it working through HA, and it records new light, but that light switch doesnt do anything :confused: What a shame. Im not ready to do another controller with esp and mqtt, since rflink and nrf24L01 allready exists.

I have milight gateway now in use, they do work from HA but when operating from wall switch, in HA status is not updated :confused:

Can you post your lights config?

MiLight emulator should fully update light state in HA regardless of method used for control.

light:
  - platform: rflink
    automatic_add: false
    device_defaults:
      fire_event: true
      signal_repetitions: 2
    devices:
      milightv1_20131b_03:
        name: Bedroom Light

With this configuration i have a switch with status changes if i change from android app, but HA switch itself isnt doing anything ?
This is log reponse from the switch :

2019-01-13 16:33:26 DEBUG (MainThread) [homeassistant.components.rflink] Sending command: on to Rflink device: milightv1_20131b_03
2019-01-13 16:33:26 DEBUG (MainThread) [rflink.protocol] sending command: {'protocol': 'milightv1', 'id': '20131b', 'switch': '03', 'command': 'on'}
2019-01-13 16:33:26 DEBUG (MainThread) [rflink.protocol] writing data: '10;milightv1;20131b;03;on;\r\n'
2019-01-13 16:33:26 DEBUG (MainThread) [rflink.protocol] waiting for acknowledgement
2019-01-13 16:33:26 DEBUG (MainThread) [rflink.protocol] received data: 20;34;CMD UNKNOWN;
2019-01-13 16:33:26 DEBUG (MainThread) [rflink.protocol] got packet: 20;34;CMD UNKNOWN;
2019-01-13 16:33:26 DEBUG (MainThread) [rflink.protocol] decoded packet: {'node': 'gateway', 'protocol': 'unknown', 'response': 'command_unknown', 'ok': False}
2019-01-13 16:33:26 DEBUG (MainThread) [rflink.protocol] command response: {'node': 'gateway', 'protocol': 'unknown', 'response': 'command_unknown', 'ok': False}
2019-01-13 16:33:26 DEBUG (MainThread) [rflink.protocol] packet acknowledged

This config has working switches, but no status updates :

  - platform: limitlessled # Milight E27 bulbs
    bridges:
      - host: 192.168.8.119
        groups:
        - number: 2
          type: rgbww
          name: Roni
        - number: 3
          type: rgbww
          name: Henna
        - number: 4
          type: bridge-led
          name: Bridge light

Also, none of these are not responding to wall remote … (obviously, wall remote isnt going through gateway)

My bad. I’ve seen you mentioned ESP, MQTT and NRF24L01 and I assumed you are already using MiLight emulator https://github.com/sidoh/esp8266_milight_hub

If you already have NRF24L01 and ESP8266 you might want to give it a try.

I’ve checked both RFLink (doesn’t have support for newer bulbs and remotes; a lot of incorrect recognized packets) and native MiLight gateway (limited to 4 groups per gateway; doesn’t update light state in HA if physical remote, either handheld or wall mounted, is used; uses UDP instead of the more lightweight MQTT; it seems that almost each HA version update breaks the Limitless component) and they don’t even compare to the project mentioned above in terms of functionality and reliability.

I still use RFLink, however only for polling 433 Mhz weather stations sensors into HA.

MiLight emulator takes care of both i) sending on/off/color/brightness/saturation commands to bulbs from HA and ii) updating state of the light in HA based on the MiLight packet received from remotes so they’re all in sync.

Yeah, too bad its not working :confused: Worked very well in domoticz … Maybe i should build esp for this. Are you saying that this esp solution is updated from the bulb (meaning that it really doesnt matter where i switch it on) ?

That’s right, with the emulator it doesn’t matter if you use physical remotes (handheld - FUT092/FUT088/FUT089; wall mount - B0/B4/B8/P4/P8) or virtual ones (HA/MiLight webpage/MQTT); the state of the light in HA will be in sync with the physical state.

And you can also use a virtual device ID (such as 0x0001/0xAAAA/etc) to pair with the lights so you would have both physical and virtual device IDs paired with a high degree of granularity as each light bulb/ledstrip controller can be paired with up to 4 remotes (either physical or virtual). Upper level remotes that would control groups of lights can be defined. For instance:

  • rooms are bedroom with physical remotes (remote ID 0x000A), living (0x000B), kitchen (0x000C), bathroom (0x000D);
  • virtual remote 0x0001 is associated with living and kitchen lights; other groups can be set from bedroom and living with remote ID 0x0002, etc.
  • virtual remote 0x0010 is associated with all rooms;

Each individual remote works by controlling the light in a single room, however, in order to turn ALL lights on/off/change color/etc. in HA you would send command to individual lights A, B, C, D and that would take 4-7 seconds to complete; however, if sending commands to device ID 0x0010, all four lights would change in the same time, without any delay.

Most of the cheap “smart” lights can be improved significantly by HA in terms of features and responsiveness (well, not to the level of Philips Hue, but close enough to make for a good deal).

sold. im ordering parts :slight_smile: