How to connect eWeLink and Sonoff devices

How to connect eWeLink and Sonoff devices

Following the positive reception of the Tuya Smart Life integration last month, I’m please to announce you can now also control your eWeLink or Sonoff devices directly from sequences. Read on to learn how to link your account.

Login to your account and navigate to the linked services page. Here’ll you find a number of services which are available to link to your account. Click Link account next to eWeLink / Sonoff to begin.

Click ‘link account’ to begin

You’ll be taken to a page where you should enter your eWeLink credentials. Either your email address or phone number is required, depending on what you used when creating your eWeLink account, along with your eWeLink password. Once you’ve entered your credentials, click Authorise to link your account.

Enter your eWeLink credentials then click ‘authorise’ to link your account

You will be redirected back to the linked services page, and it will show that your eWeLink account has been refreshed. If at any time you no longer wish to have your eWeLink account linked to SEQUEmatic, simply click unlink account to break the connection.

You can remove the connection at any time by clicking ‘unlink account’

Using eWeLink in your sequences

Controlling eWeLink devices from your sequences is simple. Just select smart device from the list of step types and a list of available devices will appear. For a single channel switch, there will be only one property which is switch, however others may have more than one channel which you can select.

In general, the only action available is to turn the device on or off. Click save once you’re done and you’re ready to go!

Use your eWeLink devices by choosing the ‘smart device’ step type

As always, if you have any questions post in the Q&A forum, leave a message in the comments below or contact me directly.

View custom webhook trigger payload

Many users are creating very powerful sequences using the custom webhook trigger. This feature allows you to trigger a sequence from another service via a webhook request, and you can even pass through JSON data. People are using this to trigger sequences from events on their Emby media server or based on weather updates.

In the past month there have been two important updates to this feature.

Viewing content of payload

To help debug sequences, it’s now possible to view the content of the payload which was sent to SEQUEmatic in the webhook call. Head to your sequence log and click the magnifying glass to view the detailed log of that sequence run.

Next to the trigger step you’ll see a link to ‘view the payload’ which will display the JSON which SEQUEmatic received. Note that this is only available for custom webhook requests which pass a JSON payload.

Access parameters from all levels of the JSON in your sequence

The key benefit of using the custom webhook trigger is the ability to pass additional data into SEQUEmatic. In the case of the Emby media server this could be the playback event or film title. In the case of a weather service it could be the current temperature or upcoming forecast.

SEQUEmatic allows you to access this data in your sequence using sequence parameters. Take a look at the JSON below:

Sample JSON for a Hogwarts student

Perhaps this payload is sent to SEQUEmatic every time a student walks through the door at Hogwarts. It provides information including their name and house. When this comes through into SEQUEmatic, you can access the data by enclosing the variable names in curly brackets, for example {House} to get the value Gryffindor.

Now, you can also get the value of second (and third, fourth, fifth, etc) level variables by connecting their names with a hyphen, such as {Student-FirstName} to get the value Harry.

This can be used in most steps which take text inputs, for example in checking a variable value, in the content of an email alert or stored in a variable for use in another sequence, as in the example below.

The webhook data {Student-FirstName} is stored in the SEQUEmatic variable student_name

You can read more about this in the docs.

So, what are you waiting for? Go ahead and see what you can create with the custom webhook trigger. I’d love to hear how you’re using this in the comments below, and as always if you have any questions just ask in the Q&A Forum or contact me directly.

June 2020 updates

June has been a big month for SEQUEmatic, with the biggest change being the introduction of Tuya Smart Life integration. With the announcement in May that Tuya would no longer support IFTTT, direct integration was introduced in SEQUEmatic to bridge the gap and many people have now started using this new feature.

Initially it looked like this would only support simple on/off commands, but it’s now possible to control just about any Tuya device, and run all sorts of commands including opening and closing blind shutters, changing the colour and brightness of lights and opening and closing garage doors.

Given the positive response, I’m now exploring other direct integrations to introduce into SEQUEmatic. If you have any preferences, please let me know.

In addition to this, there have been a number of smaller enhancements as well, including:

  • Improvements to the user settings page allowing you to set your location via a map
  • UI enhancements to a number of steps and additional informative text to explain how to set up steps
  • Ability to view input data from custom webhook triggers via the sequence log
  • Forced HTTPS for webhook calls, and email reminders if HTTPS is not used

I’m also collecting feedback via a survey to help improve SEQUEmatic. You should have received an email with a survey link, and if you have already responded then thank you very much! If you haven’t, I’d appreciate if you can spare a few minutes to provide your feedback to help improve the site.

As always, if you have any feedback please comment below, post in the Q&A forum or contact me here. And if you’d like to see an article about something in particular, just let me know.

Tuya Smart Life integration

Tuya Smart Life integration

As many people are aware, the integration between Tuya Smart Life and IFTTT has now ceased. This has left a lot of people unable to run the handy automations they previously had set up between the Tuya Smart Life devices and other smart devices supported by IFTTT.

Following user feedback, I’m please to announce that SEQUEmatic now supports direct integration with Tuya Smart Life!

EDIT: It is now possible to control any property of any Tuya smart device direct from SEQUEmatic. Not all Tuya Smart Life devices are created equally, so if you run into any problems either post in the Q&A Forums or send me an email.

So how do you set up your sequences with Tuya Smart Life? Read on for the step-by-step process.

Connecting your SEQUEmatic account to Tuya

First, you need to link your SEQUEmatic account to Tuya. Navigate to your settings page and click the Linked Services button.

Next, click Link account next to the description of the Tuya Smart Life service.

You will be redirected to the secure Tuya Smart Life login page, where you should login with your Tuya credentials.

Tuya will explain what it means to link your account, then you will need to click Confirm authorization to complete linking.

Once linking is complete, you will be redirected back to the Linked services page. You’ll notice the link which previous read Link account now reads Unlink account, confirming your account was successfully linked.

If you ever wish to disconnect your Tuya account from SEQUEmatic, you should return to this page and click the Unlink account link.

Using Tuya Smart Life in sequences

Once your account is linked, using Tuya Smart Life in sequences is simple.

Either create a new sequence, or edit an existing sequence and click the Add step button. From the Step type dropdown select Tuya Smart Life. The form will update, displaying available devices by default.

Select the device name, the action to perform or property to modify, and the new value to set.

In addition to devices, you can also control device groups. Simply change the Type to Device Group and a list of available groups will display. Finally, you can also trigger Scenes which have been set up within your Tuya Smart Life home. Using scenes you can create some very complex and powerful automations to trigger from your sequences.

You can learn more about the Tuya Smart Life integration here in the docs. And if you need help getting set up, head to the Q&A Forum, post your questions in the comments below or contact me here.

If you do start using the Tuya Smart Life integration, I’d love to hear how you’re putting it to use in the comments below!

May 2020 updates

I’m pleased to let you know of a number of enhancements which were made to SEQUEmatic this month. These include:

  • Improved performance on the sequences page, reducing the page load time from several seconds to under one second
  • New features on the sequence log page allowing you to view all sequence log entries, as well as filter and sort
  • Updates to the toggle variable webhook to also recognise yes/no and on/off
  • Enhancements to the custom webhook trigger allowing you to access variables at any level of the JSON structure
  • Improved UI on the edit sequence page, collapsing the action buttons under a mini menu

More to come!

And there are further enhancements planned throughout the month of June including additional log details for custom webhook triggers and a number of UI enhancements to make it even easier to create and edit your sequences.

As always, if you have any feedback please comment below, post in the Q&A forum or contact me here.

Shared sequences

Have you created an amazingly useful sequence that you want to share with others? Well now you can!

Simply navigate to the edit sequence page and scroll down to the share sequence button at the bottom of the page.

Shared sequences are then available to others in the shared sequences page.

If you want to import a sequence into your account, browse the shared sequences and once you’ve found one you like click the import sequence button at the bottom of the page to copy it into your account.

Do you need help creating a particular sequence? Post in the comments below or in the Q&A Forum and I’ll create a shared sequence to help get you started.

Custom webhook trigger

Based on user feedback, we recently introduced a new trigger – the custom webhook trigger.

The request

The initial question we were asked was whether it is possible to use SEQUEmatic to control lights based on playback status of the Emby media server. When a video is started or stopped on the Emby media server there is an option to trigger a webhook call. Unfortunately the existing IFTTT webhook trigger couldn’t support the data coming from Emby, and so we embarked on creating a new custom webhook trigger.

How does it work?

The new custom webhook trigger currently supports 3 schemas, or data structures. The first is the same as the existing IFTTT webhook trigger and can receive up to 4 parameters in the URL.

The second handles a data passed in a JSON POST request. This means you could send data such as the following:

{
  "Name":"Harry",
  "School":"Hogwarts",
  "House":"Gryffindor"
}

As with the existing webhook trigger, you can access the value of these parameters in your sequence by enclosing the parameter name in curly brackets. For example, using {School} in a change variable step would return the value Hogwarts.

The third schema is similar to this, however it expects the JSON payload to be passed as a field named data in an HTTP POST request. It is this format which is specific to Emby.

How can my media server control my lights?

To achieve this, you need to use custom webhook Schema 3, and add the URL of the custom webhook trigger in your Emby media server set up.

When the playback status of the media server changes, for example is stopped, it triggers a call to the webhook and passes data in the following format:

{
  "Event":"playback.stop",
  .....
  .....
}

There is additional data in the request, however it is the Event which is useful here. You can simply add a condition to check if {Event} = playback.stop and then within that condition add any other steps you require, such as an IFTTT webhook call to control your lights.

Eric, who requested the feature, has posted a more detailed write up here on the Emby forums.

If you have any question, just post here in the comments or in the Q&A forums. And if you have set up something similar yourself, let me know how you’re using it in the comments below!

Update to display of If…Else…End if

Based on your feedback, I’ve recently updated the way conditions are presented in the UI. Gone are the days of trying to work out which IF that ELSE belonged to!

Condition blocks are now shaded and colour coded so you can easily identify where each condition ends. In the example below you can see the ppl_at_home > 0 condition is shaded in light purple. It’s quite easy to see that the last end of condition belongs with this condition.

The IF statement relating to ppl_at_home = 0 is a darker shade of purple so it’s clear the darker purple else and end of condition belong with it.

For those of you who are building more complex sequences, hopefully this makes it easier to follow through the logic.

As always, if you have any other feedback or suggestions for improvements just leave a comment here, post in the Q&A forum or contact me here.

The SEQUEmatic bot is still new and learning. If you don't get the answer you need, just ask to speak with Derek and your chat will be transferred.