How to connect your AL-KO Robolinho robotic lawn mower with Home Assistant via IFTTT

Connecting your AL-KO Robolinho robotic lawn mower to Home Assistant would be great, wouldn’t it? Up until now, it is not possible to easily access the AL-KO API as a hobby maker, that is why the following custom integration of AL-KO devices into Home Assistant which was developed by the GitHub user jonkristian currently unfortunately does not work:

https://github.com/jonkristian/alko

As of this, in this story, I want to explain to you how you can indirectly still connect your AL-KO Robolinho to Home Assistant by leveraging the capability of AL-KO robots to interact with the cloud service IFTTT.

Prerequisite: To make this functional, you need to have enabled the paid Home Assistant cloud integration. You might think “I don’t want to pay for yet another cloud service” but the fee is low and by paying it, you also support the ongoing Home Assistant development. Also, it allows you to access your Home Assistant instance from anywhere in the world and allows you to integrate all of your devices with Amazon Alexa and Google Home. So I personally think it is really worth it.

What is IFTTT and what are webhooks?

IFTTT is a plattform that connects hundreds of different service providers and device manufacturers with each other (see ifttt.com). IFTTT basically allows services to provide so called “triggers” and “actions”. AL-KO has also provided an integration with IFTTT and provides triggers such as “Robolinho has arrived at the base station” and actions such as “Start Robolinho”. With this, it is possible to track the status of Robolinho to a certain extent. Also, we can send commands to the device. But how to get this to / from Home Assistant?

This is where the webhooks come in. IFTTT allows to use webhooks as triggers and also as actions. With this, we can call a Home Assistant webhook when one of the triggers “Robolinho has started” or “Robolinho has arrived at the base station” has been fired in order to set the status of a sensor in Home Assistant. And the other way round, we can call an IFTTT webhook from Home Assistant when we want to start Robolinho or send the device homing. There we go! In the following step by step guide, I will explain in detail how to set this up.

Step 1: Prepare template switch for Robolinho device in Home Assistant

First of all we need to define an entity in Home Assistant which will hold the state of the Robolinho device and which provides the possibility to send commands to Robolinho. For the sake of simplicity, I decided to go with just a standard template switch. An alternative would be to go with the template vacuum cleaner but then the mowing state would be called “cleaning” which is also suboptimal. There is already a feature request for adding a device template for a lawn mower to Home Assistant or to convert the template vacuum cleaner to a more generic “template robot” but as of now this has not yet been implemented (https://community.home-assistant.io/t/template-mower/194293).

To prepare the template switch, you have to open the configuration.yaml file of your Home Assistant installation (if you don’t know how to do this, you can for example use the Home Assistant Add-On “File editor”). Then, add the following lines at the end of the configuration.yaml file:

How to prepare the template switch in Home Assistant

Step 2: Get Robolinho state from IFTTT and set device state of template switch in Home Assistant

Now that we have prepared the template switch, we need to tell the template switch how to get the states of Robolinho, in this case whether Robolinho is in the base station (= “off”) or mowing (= “on”).

First we define a new automation in Home Assistant which listens to the webhook trigger. After that, we will use the generated webhook URL and use IFTTT to send state updates of Robolinho to that webhook URL.

Let’s start with creating our new automation in Home Assistant to store the state of Robolinho in a variable. In your Home Assistant UI, open “Settings” > “Devices & Services” and open the tab “Helpers”. Create a new Helper by clicking on the button “Create Helper”. Now select “Switch” as the type of the helper, then give your helper a name e.g. “Robolinho is working”, select any kind of icon you want (does not really matter) and click “Create”. We have now created a variable which will store the state of Robolinho. Next, we have to create on automation each for the two state changes “Robolinho starts working” and “Robolinho arrived back at the base station”. Open “Settings” > “Automations & scenes” and add a new automation. Start with an empty automation. Give your new automation a name, e.g. “Robolinho starts”. Then, select “Webhook” as the trigger for the automation. Select “Service” as the action and select the service “input_boolean.turn_on”. Then, select your helper “Robolinho is working” as the target of the operation. Now save your automation. We now have to create a second automation, named for example “Robolinho finished working”. Here, we also select webhook as a trigger and the service “input_boolean.turn_off” as the action, again with our helper “Robolinho is working” as the target of the operation.

That’s it — we have created two automations which listen to webhooks and set the state of our Robolinho in Home Assistant respectively. We can now go to “Settings” > “Home Assistant Cloud” and scroll down to the webhooks section. Here you should find two new URLs now — one for each webhook trigger. We will need these URLs later on.

Next step is to wire the webhooks with IFTTT. For this, first you need to open ifttt.com. If you do not yet have an account, just create one first and then login. Second step is to create a new so called “applet”. An applet in the very basic form is just a combination of a trigger and an action and that’s what we are going to use. We will use the triggers “Robolinho started mowing” and “Robolinho has arrived at the base station” which are provided by the AL-KO service on IFTTT. To create a new applet, click on the button “create”:

Button to create a new applet on ifttt.com

After pressing this button, you should see the following screen:

Screen for creating a new applet on ifttt.com

Now click on the box “If This”. This will open a dialog which allows to select a service which shall provide the trigger for the applet. We will search for the service “AL-KO Smart Garden” and then select the trigger “Robolinho has arrived at the base station” (if you have not yet connected IFTTT to the AL-KO service, you have to first authenticate IFTTT to be able to access the AL-KO devices by typing in your AL-KO username and password before you can select the trigger). After having selected the trigger, you also need to select which of your AL-KO devices you want to use (if you have multiple). After finalizing the trigger, it should look like this:

IFTTT trigger after successful configuration

Next we need to specify the IFTTT action. Here we search for the “webhooks” service and then select the “Make a web request” action. In the field “URL” we now enter the URL of the corresponding Home Assistant webhook trigger, see above. As the “method” we need to set “POST” and as the body, please enter “{}”. Then we can save our new applet. The whole applet should now look like this:

Final applet for sending Robolinho state to Home Assistant

We can save the applet to finish. Now we create a second applet in the same manner for the trigger “Robolinho has started mowing”.

Now you need to extend your template switch in the configuration.yaml file as shown in the below screenshot:

Extend template switch to retrieve value from the input boolean variable

Make sure to use the correct variable name of your input boolean helper — special characters in your friendly name for the input boolean will be automatically removed and spaces are automatically converted to underscores. Also, the variable name is always lowercase. So the friendly name I gave my helper was “Robolinho is working” which is being converted to the variable name “robolinho_is_working”.

Step 3: Trigger Robolinho actions from Home Assistant

Now that we have successfully sent the state of our Robolinho device to Home Assistant, we also need to be able to trigger Robolinho actions like “start Robolinho” and “send Robolinho homing” from Home Assistant.

This is quite straight forward. We will again leverage the webhooks service in IFTTT. First, you need to create an applet in your IFTTT account. Click on “Create” again, then click on “If this” and select the webhooks service. Then select the trigger “Receive a web request”. You now have the choice of selecting an event name. I propose to use a human readable event name like “start_robolinho”.

Trigger for receiving a web request within IFTTT

Now click on “Create trigger”. Next step is to define an action which shall be triggered. We select the service “AL-KO” and choose the action “Start Robolinho”. Your finished applet should look like in the following screenshot.

Applet to start Robolinho based upon web request sent by Home Assistant

Click on “Create” to save the applet. We can now do exactly the same thing for the action “Send Robolinho home to base station (stop mowing)”. I chose the event name “stop_robolinho” for the IFTTT trigger “Receive a web request” respectively.

Now we just need to allow Home Assistant to send the web requests to IFTTT for the events “start_robolinho” and “stop_robolinho”. For this, I would recommend installing the Integration “IFTTT” in Home Assistant (https://my.home-assistant.io/redirect/config_flow_start?domain=ifttt). Once the integration is installed, you need to tell the integration which IFTTT API key to use. To find your IFTTT webhooks API key, you need to click on your user icon in the upper right corner on ifttt.com, click on “My applets” and search for the webhooks service. Once you click on the webhooks service, you should be directly prompted with the API key “Your key is: YOUR_API_KEY”. Just copy this key and add the following lines in your Home Assistant configuration.yaml:

Example entry in configuration.yaml

After adding those lines to the configuration.yaml, you need to restart Home Assistant (e.g. by going to “Settings” > “System” > “Restart”) before you can use the IFTTT integration.

Now we are nearly finished. The last step is to add the calls to the IFTTT webhooks to our template switch device created earlier.

I created scripts for this. Go to “Settings” > “Automations & scenes” in Home Assistant, open the tab “Scripts” and add a new script. Give the script a name (e.g. “IFTTT: Start Robolinho”), set as mode “Single (default)” and chose “Call service” in the sequence section. Choose “IFTTT trigger” as the service and type in the corresponding webhook event name, in my case “start_robolinho”.

Example sequence for calling the IFTTT webhooks service with the event name “start_robolinho”

Save the script and create a similar script for the event “stop_robolinho”. Now finally just extend your template switch entry in configuration.yaml as follows (make sure to use the correct names of your scripts created earlier — the name will be lowercase, special characters removed and spaces converted to underscores; in my example the script name was for example “IFTTT: Start Robolinho” and got converted to “ifttt_start_robolinho”):

Extend Robolinho template switch to add actions “start” and “stop”

The last thing I did to make the template switch look better in the frontend was to configure which icon to show depending on the state of Robolinho but this is an optional step, not necessary for the component to work:

Show different icon based upon device state (optional)

Save your configuration.yaml, check it for syntax correctness (go to “Developer tools” > “Check configuration”) and reload your template entities via the Home Assistant frontend (go to “Developer tools” > “Reload YAML configuration” > “Template entities”).

Step 4: Use AL-KO Robolinho device in Home Assistant

Now you should be able to add the newly created template switch for Robolinho to your dashboard and it should allow sending Robolinho mowing or homing and should also indicate Robolinho’s current state:

Robolinho template switch in dashboard

Just one further note: IFTTT has reduced the real time ability for non-paid user accounts. That means if you do not have an IFTTT pro subscription, IFTTT triggers might be triggered with some small delay. This should just be understood when debugging as you can not expect the integration to react in real time to state changes of Robolinho.

By the way: If you have activated the Apple Home Kit bridge in Home Assistant, you should now also be able to control your Robolinho via the Apple Home ecosystem. If you have furthermore enabled the (paid) cloud integration for Home Assistant, you can also integrate Robolinho with Google Home via this. Both Apple Home Kit and Google Home are currently not yet supported by AL-KO natively.
Enjoy!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store