MiLight Google Assistant - Voice Control for all lighting

First post… Yay!

Hello I’m new, however I have been reading many posts and I wanted to share some knowledge and learning to assist others undergoing this task of setting up voice control. I have seen other discussions regarding voice activated lights and I have read several posts about people getting this working and I wanted to share my experiences with HomeAssistant, MiLight, Google Assistant and IFTTT.

The following part of this post assumes you have a brief knowledge of Limitless bulbs

I have MilLight (Limitless) bulbs through out my flat, 20 in total, these include ceiling lights, lamps and LED strips. Each room is separated into multiple groups and assigned a group number on one of 3 MiLight wireless bridges. The light bulbs consist of RGBWW GU10 6W Spotlights and RGBWW E27 4W bulbs and RGBWW 5050 300 LED Strips and I have Home Assistant (0.34.0) configured on a Raspberry Pi 3 with IFTTT configured in configuration.yaml

Before you begin you will have to configure the following variables in your configuration.yaml

Light:
Scene:
(The scenes section is for color, brightness, groups of lights to turn on/off in a single command, etc.)

I have both Light: and Scene: split out of my configuration as these configurations can become incredibly long. Please see below for code snippets:

Configuration.yaml

#### Includes ####
light: !include light.yaml
scene: !include scene.yaml
# If There Then That
ifttt:
  key: {(API-KEY-GOES-HERE)}

Light.yaml

  platform: limitlessled
  bridges:
    - host: 10.1.6.250
      groups:
      - number: 1
        type: rgbw
        name: Room1
      - number: 2
        type: rgbw
        name: Room2
      - number: 3
        type: rgbw
        name: Room3
      - number: 4
        type: rgbw
        name: Room4

Scene.yaml

#Kitchen Light Scenes 
  - name: Kitchen Lights 100
    entities:
        light.kitchen:
            state: on
            transition: 2
            brightness: 255
            rgb_color: [255,255,255]
  - name: Kitchen Lights 50
    entities:
        light.kitchen:
            state: on
            transition: 2
            brightness: 100
            rgb_color: [255,255,255]
  - name: kitchen Lights 1
    entities:
        light.kitchen:
            state: on
            transition: 2
            brightness: 1
            rgb_color: [255,255,255]
# Bedroom Light Scenes 
 - name: Bedroom Sexy Time
    entities:
        light.bedroom:
            state: on
            transition: 2
            brightness: 1
            rgb_color: [255,100,100]

Once you have the above configured enough to test sign up and register you Google Assistant device with IFTTT. I’m using the Google Pixel in my case as i live in the UK and the Google Home isn’t out yet and my US purchased Google Home has not yet arrived… One week to go :smiley:

Once you have signed up and linked your device with IFTTT, install the IFTTT app on your android device and add your API key to your configuration.yaml as above.

The next step is to configure a command in IFTTT

On the IFTTT website login and Click My Applets and then “New Applet” when the page loads click the + sign and proceed to search for Google Assistant select it and connect it to your account. Once Connected to IFTTT choose the option “Say a simple phrase” and proceed to setup the voice command

What do you want to say?
"Kitchen lights ten percent"

What’s another way to say it? (optional)
"Dim the Kitchen lights"

And another way? (optional)
"Set kitchen lights to minimum"

What do you want the Assistant to say in response?
"OK, Kitchen Lights at ten percent"

Once you have configured your voice command, click “Create Trigger” then click the next + and search for maker. Proceed to connect maker to your IFTTT account and proceed with the configuration of your voice command by choosing “Make a web request”.

Populate the the Make a webrequest with the following info

URL
https://{DNSNAME}:{PORT}/api/services/scene/turn_on?api_password={API-PASSWORD}

Method
Post

Content Type
{“entity_id”:“scene.kitchen_lights_0”}

Once you click save, wait 2 or 3 minutes and test out your voice command on Google Assistant

You can also use the Light API service in the Maker URL in the following format
https://{DNSNAME}:{PORT}/api/services/light/turn_off?api_password={API-PASSWORD}

Once you have the working commands/syntax rinse and repeat and you can setup hundreds of scenes, colors, levels of brightness, party time, sexy time etc, etc. I have more commands now than i can remember in my old mind… :confounded:

If you get any issues please post and I shall do my best to assist. Once the Google Home arrives I can update the post. My next project is to create this in API.AI and work has begun on machine learning :smiley:

Enjoy…

5 Likes

Thanks for sharing.

Once you get the google home you won’t need to depend on the IFTTT integration for lights on/off/dim %, if you are using the emulated hue component or a 3rd party bridge such as Ha-Bridge but I believe there is a limitation on no of devices (80 I think) so IFTTT could be a way to extend that range.

Once you have the google home connected and run the first device discovery all devices it finds will also be available to your phones version of Google Assistant too. It would be nice if you didn’t need the home to do this, but in a way it acts as a central hub - the devices list live updates every 10 seconds or something which would be a little demanding on your phone. Devices hooked into the home can be controlled by Assistant from wherever you are if you have internet access on your phone.

I’m not sure if Limitless lights will communicate with an emulated hue component running on HA-Bridge, I did attempt to get HA-Bridge running but it didn’t go brilliantly and I had to roll back the changes. Do you know if Limitless work with said emulated Hue component?

Edit: I googled it and HA-Bridge does support Limitless…

Should I install HA-Bridge on the same Raspberry Pi or use another one? Previously I went on the same Raspberry Pi and it didn’t end well and I had to revert to backup.

Haven’t been using emulated hue but will be testing it again in the near future once the alexa/home bits can work together.

I currently use Ha-Bridge with both Alexa and Google Home (and Assistant). I had errors with Emulated Hue last time I tried a month or two back.

I have LimitlessLed lights and strips on v4 bridge plus a few LifX, all working fine. The lights themselves do not do the communicating, HASS is the communicator. Ha-Bridge uses almost the exact same setup as you have for IFTTT via the light API, (or script, switch, media player etc…). If you can control it with HASS via the API service you can control it from IFTTT or 3rd party bridges that make use of it. The API.AI looks interesting and I think we should see it working directly with HASS very quickly.

1 Like

You can easily set it up and try it out - you might need to get creative with names if they conflict with IFTTT though.

Don’t use Ha-Bridge to control the lights directly, do it via HASS.

I have it running on the same Pi, which was AIO install method over Jessie Full image. I posted the setup instructions I followed here plus a config example if it helps. It looks like my screen shots are gone so I might have to edit them back in.

1 Like

Thanks so much, just followed the guide, its now working. Went in feet first, didn’t even back up :smiley:

All working, I’ll likely set my commands on HA-Bridge to something sensible as most of the IFTTT commands I have are more proof of concept rather than commands I can use daily. I programmed some comedy responses to wind up the wife… :stuck_out_tongue:. They become tiresome after a while though…

I’ll have to look at the config for HA-Bridge in the morning and continue through your guide.

Just be aware that you wont be able to discover any of the devices until your home arrives. Assistant and even the fake alexa on raspberry pi are not able to discover devices.

Secondly - with work actively being done on direct homeassistant integration for Google Home via emulated hue you might want to go that way. I wouldn’t go too far with configuring until you get your home as it may well be sorted by the time it arrives.

Oh! And thirdly - when you get your Home the setup will want you to place your devices into rooms - once you do that you can’t remove them from a room, only move to another room. This seems obvious in hindsight but at the time I was happily integrating everything it did not occur to me that asking google to turn on the kitchen light at 2am would also turn on everything I had grouped in the kitchen room. Besides the Kitchen lights… Stereo, Squeezebox, Media Players, Coffee Machine, TV and so on all went and turned on at once. If I had called my kitchen light Trevor or something this wouldn’t have happened.

This made me laugh, this would not go down well with the wife :stuck_out_tongue: I’ll be sure to only add lights to begin with until I get to grips with it.

Add anything you like. Just be aware that when you group devices in a room, using the name of that room in a command will turn on everything in that room. Individual devices can still be controlled by their individual name. It will make sense once you get the home and the devices menu gets unlocked on your phone.

You can create a room with only 1 device if you need to pull a device out of a group, or just don’t add anything to rooms at all to start with, unless you definitely want them grouped. Maybe in a future update google will allow removing devices from room groups rather than just moving to another group.

Configured one light on HA-Bridge to confirm working, all good :smile:

@BarryHampants Hi Barry, why don’t you use HA Bridge to also control the lights but use emulated HUE and HA Bridge? I tried Emulated HUE on previous versions but did not work that well as HA Bridge. Maybe it’s much better now and it seems to support Google home (I also use Echo & home together but thinking of going for Home)

Limitlessled lights do not have two way communication - you just send signals to them. This means that if you use something other than HASS to control the lights HASS will not know the correct state. It will think the light is off when it is really on and will not turn on a light it thinks is already on.

I use Ha-Bridge to talk to Hass to turn on and off the lights, rather than Ha-Bridge straight to lights. I don’t use Emulated Hue component at all.

Which reminds me of one of my automations you might find handy if you have these lights. I have a lot of power outages and this means the lights all turn on - this might mean they are on all day or even all week if I am away. So I use this automation to make sure they get switched back off, and are in sync with HASS.

alias: power_outage
trigger:
  platform: event
  event_type: homeassistant_start
action:
  - delay:
     minutes: 1
  - service: light.turn_on
    entity_id: group.all_lights
  - delay:
     seconds: 1
  - service: light.turn_off
    entity_id: group.all_lights

Ah, clear. I thought you ment you don’t use HA bridge to control ANY light, but you mean the Limitless ones in specific due to their specific behavior.

Not quite. You don’t need to have a HASS installation running at all with Ha-Bridge - it is a stand alone hue hub emulator. I prefer to try to push everything through HASS for tracking purposes.

I use it for everything I have voice controlled, - including a few lights that have Orvibo S20 wifi power point switches plugged in to lamps. The exception is a few harmony activities that Alexa uses. I just find it easier and I can change the names of them without rebooting HASS when google or Alexa don’t understand my funny accent.

Ok. I use HA-bridge to control the HASS device, never directly to the device (where that in theory would be possible). I was just wondering if there is any benefit of using Emulated hue in HASS above HA Bridge (beside maybe lower setup time).

p.s. I know see that Google has released the API for Google home. Wondering when the HASS devs will pick this up. Would love to be able to have some more flexibility and ‘talk back’ from my Google home

Just a few notes:

  1. HASS now supports Google Home via the emulated_hue.
  2. LimitlessLED can be easily voice controlled vi emulated_hue (in fact any HASS light, nothing specific about LimitlessLED)

Yes I’m aware of emulated hue now, although I’ve read reports of it being a bit patchy at the moment. I’ve managed to get HABridge setup for dimming and lighting control from Google Home although I can’t see a way of setting the RGB colours. Got any ideas, is it even possible?

I don’t use the colours in my lights at all but depending what it is you want to be able to do you could set up a scene for each state you commonly use and then you would be able to use voice control to turn that on and off and dim brightness.

I am not sure what would happen the next time you wanted to use the normal lighting after using a colour, you would have to try it and see or perhaps create another scene for normal lighting so it doesn’t get stuck on pulsing green or something.

If using HABridge to set a scene going back to white requires another white scene to be created as far as i have tested so far. Although I’ve made the switch to emulated_hue now as suggested by @happyleaves as I am trying to keep all the config within HASS so there is less to go wrong :slight_smile:

Although I am now stuck with the same issue of setting RGB colors using emulated_hue. More searching documentation and forum posts required.

Unfortunately my OCD will force me to create every singe possible color variation and not just the ones I may or may not commonly use :smile:

I know the feeling.

A long shot but perhaps setting up a colour loop in a script might allow you to move on? You get to see all the colours.

  sequence:
    - service: light.turn_on
      data:
        entity_id: light.kitchen
        effect: colorloop
        brightness: 254
        transition: 5

Setting up 256 scenes or however many colours are possible just isn’t feasible.

I think it might be possible to do it with the dim command, but you would still need two devices for each bulb if you wanted to keep brightness available. I’m not sure about emulated hue but with Ha-Bridge some ideas… they should be transferable to emulated hue.

Dim URL
http://192.168.1.1:8123/api/services/light/turn_on

Content Body Dim
{"color_temp":"${intensity.percent}", "entity_id":"light.kitchen"}

You may have to play around with this to get it working as the allowable values are 154 - 500 so perhaps you may be able to use ${intensity.math} to pass a specified number - Hey google, set kitchen light 300 isn’t exactly user friendly.

Colour name should be possible but I don’t know that this is allowable for dim, I think it only works with numbers so you would need to create something similar to scene or script anyway - perhaps if you can live with only primary colours and variable brightness?

You would need to set up each bulb as each colour for this so it’s still a lot of work.

“Hey google turn on Kitchen Red”

http://localhost:8123/api/services/light/turn_on

Content Body On
{"color_name":"red", "entity_id":"light.kitchen"}