Setting up HASS, IFTTT, Google Home and Xiaomi Mi Home.

Hi,

I just installed home assistant and I'm a bit confused on how I should proceed with setting it up.

The things I'd like to end up with is

  • Being able to control everything via Google Home
  • Being able to view things like cameras through the Mi Home app
  • Having IFTTT integration

Is this at all possible? If so, can anyone point me in the right direction on how to get it set up? I realise there is the xiaomi_aqara component but I'm not exactly sure how to install it and whether or not I'll be able to preserve usage of the Mi Home app.

For what it's worth, I write code for a living so I'm not really out of my depth playing with HASS, all I'm after is a bit of hand holding to get started!

Comments

  • +2

    I can provide a bit more help tomorrow but start off watching Bruh and diyautomates videos on YT

  • +1

    Okay so firstly, think of Hassio as the central coordination hub. It takes all these disparate standards, companies and protocols and brings them all together.

    Hassio already has Google Home and IFTTT integration. Head to Home-assistant.io and to the components page on how to integrate. IFTTT is clearly there but for Google Home you need to integrate using Google Assistant.

    The Xiaomi camera apparently needs a bit more handy work to integrate properly. Did a quick google and it needs some massaging but sounds like it’s the video encoding.

    If you code for a living you’ll find it all straightforward. I’m an elec eng and I hit a few missteps due to some router/ISP issues but after that it’s simple.

    Does that help a bit?

    • I realised that the xiaomi_aqara module is baked in out of the box and I just need to enable it in the yaml, that resolves 95% of my issues hah.

      Cheers!

  • +2

    Hi @ausmechkeyboards,
    I have Hassbian installed on a Pi3, Xiaomi hub, 5 door sensors, 5 motion sensors, 4 temp sensors (it's a big house), Google Home + Google Mini.

    I don't have a camera yet - but I'm going to Shenzhen just after Xmas - so I'll grab a couple!

    I don't have any IFTTT set up - but I may do that before Xmas.

    I can confirm that the Mi Home app is unfazed about the HA being connected. That's a non issue. You can view all components in both UI's.

    Let's chat!

    • Awesome - I'll definitely message you if I get stuck!

      Thanks!

    • nice, do you also have any yeelights linked?

      curious what automations you have in place.

    • Any chance you can send me some examples of the automation you have used?

      I'm thinking about doing things like;
      * Arming the alarm when both mine and my partners mobiles are out of range of the router.
      * Turning fans (always) and lights on (if dark) using an RM3 mini when one of our phones is in range
      * "Go to bed" setup where upstairs lights / fans / aircon are turned on, and then 5 minutes later everything downstairs gets turned off.
      * Using a switch near the door to check that all 5 exits from the house are properly shut.
      * IFTTT to turn off AC to a room after 5 minutes when my wife leaves the door open.

      Any other suggestions for it greatly welcomed.

      I have (either already bought, or waiting for delivery)
      * 4 Xiaofang cameras
      * 6-7 door sensors (mainly aqara)
      * Gateway (obviously)
      * 2 aqara body sensors
      * 4 zigbee switches
      * 2 wifi switches
      * 2 aqara humidity sensors
      * RM3 mini
      * Google home mini
      * Raspberry Pi 1 with hass.io installed

      Also planning on getting a couple of lamps for bedrooms , and yeelights. Unfortunately can't do the whole house right now as most of it is strip lighting.

      • guessing you already have the components added to your hass.io setup?

        • I'm still waiting on door sensors, and the RM3 mini, but everything else seemed to add automagically - including my NVIDIA AndroidTV

        • @linnaen: even your gateway?

        • @impoze:
          Oh no - now that I think about it, I had to add that to the config yaml. Easy enough to do once I got my laptop to connect to the Workgroup properly, so that it could connect to the Samba share.
          This is about as easy as it gets: https://home-assistant.io/components/xiaomi_aqara/

        • @linnaen: yeah, you will just need to do the same for the rm3

          getting the codes from my fan remote was quite simple too

          https://home-assistant.io/components/switch.broadlink/

          I've yet to figure out how to do custom google home commands to trigger my RM to turn on my fan. Yeelights work though since it's using the app integration in google home.

  • +1

    Has your HASSIO found your xiaomi gateway?

    I recall mine finding it automatically and then you can set the automations in the .yaml files

    I can use my google home to turn on/off my yeelight and also use my xiaomi buttons

  • Get a Pi, get openhab2, install all you devices, get a seperate tablet and run action tiles. Everything in one place.

  • Follow up: spent tonight figuring it all out. Just finished setting up Sonoff + IFTTT webhooks + Xiaomi button actions (long press, single, double) and a whole bunch of other stuff related to my Yeelights.

    Going great so far.

    Need to look into if I can activate certain apps on my Mi Box. Would be awesome to say "Hey Google, let's watch a movie" and have the lights dim and Netflix turn on!

    • Cool, what is the process to get custom google home commands? Do i need to use IFTTT webhooks?

      Added my broadlink rm to hassio today but not sure where to go from there for google assistant integration

      Also.. what have you set youe buttons to do? I have them toggling on/off lights but havent figured out how to loop through brightness levels or dim in a loop

      Thanks

      • +1

        I believe Hass.io has native Google Assistant integration now so you don't need to use Webhooks.

        My buttons are set up as follows:

        1. One click - toggle
        2. Double click - alternate brightness (from very dimmed to full brightness)
        3. Long press - if the lights are off, turn on the lights and turn on my Sonoff switch. If the lights are on, turn them off and turn off the Sonoff switch as well.

        You can set the staggered brightness settings by putting it into a Jinja/Django template loop format.

        i.e https://dpaste.de/fBgo

        The better way is to probably spin off the logic into its own script and call it as its own service. I'll do that at some point when I start to approach complexity that will need it.

        • thanks!

          do you know how I could make this trigger run by any switch in a group?

          I currently have the same automation for each switch entity

        • @impoze:

          I'm not sure I understand, but if you change line 6 to the entity_id of your switch group it might work. Give it a go.

        • @ausmechkeyboards: yeah I tried that but doesn't seem to work

          I have a group of two switches which I want both to do the same task (toggle light on/off)

          currently I've got an automation for them both individually but if I could do it as a group it would be much easier

          it works for light group i'm toggling but not the switch group

        • @impoze: I suppose you can loop over the connected devices in a group and just list it like that. It's not the preferred solution but might save you the extra hassle.

          Something like this https://dpaste.de/pL59#L3,8,10

          If you can find within the group where the switch id's are listed, you can definitely do it. It might just be group.(switch_group_name).

        • @ausmechkeyboards: Thanks for sharing your automations. I was trying to figure out how to get my yeelight to work with the button. Any chance you can share your full automations.yaml? (minus any private stuff ofc)

        • +1

          @No: I don't have much there yet, I'm waiting to receive my cameras, buttons and temperature sensors etc to do something fancy, so I only have the stuff from the first night I worked on it.

          https://dpaste.de/a6Py

          I really recommend you use the states(), is_state() and is_state_attr() methods instead of trying to directly query the state though. It's a bit safer if there is no state at all and will probably have better long term support against API changes. The file would also look a lot cleaner.

          Lines 62 and 64 are IFTTT Webhook event names that I listen out for to do certain things, in this case I have an extension cord with a Sonoff switch that which has lights connected to it, and I turn it on or off depending on the case.

        • @ausmechkeyboards: Thanks! Please keep me (us) updated as to what cool stuff you work out how to do. I have learnt a few things from your automations.yaml, appreciate it.

  • Hi All,

    How can you set an automation rule to occur If a door is left open for X number of minutes using the Mihome App.
    1 Minute door left open option is there.

    Thanks for the help

    Regards

    Niroshan

    • Did you ever find a solution to this? I want to make it something like 10 mins but I don’t think you can!

Login or Join to leave a comment