ifttt_使用IFTTT将LIFX灯泡连接到IoT

ifttt

Have you ever wished your lights would turn off on their own when you went to sleep? Or that they’d change color when your favorite sporting team scored? With LIFX smart light bulbs and IFTTT, we’re pretty close to that ideal and magical connected light bulb reality.

您是否曾经想过睡觉时灯会自动熄灭? 还是当您最喜欢的运动队得分时它们会改变颜色? 借助LIFX智能灯泡和IFTTT,我们已经非常接近理想和神奇的互联灯泡现实。

LIFX smart light bulbs are energy efficient LED bulbs that can change color and be controlled via smartphones and smartwatches. They are quite entertaining and rather easy to set up on your home Wi-Fi network.

LIFX智能灯泡是节能LED灯泡,可以改变颜色并可以通过智能手机和智能手表进行控制。 它们非常有趣,并且很容易在您的家庭Wi-Fi网络上进行设置。

To give our lights some autonomy, we’ll be using a service called IFTTT (short for “If This Then That”) which allows you to set rules based upon different internet connected devices and/or services. These rules can then trigger responses like your smart light bulbs changing color.

为了使灯光具有一定的自治性,我们将使用一项称为IFTTT的服务(“ If This Then That”的缩写),该服务可让您根据不同的Internet连接的设备和/或服务来设置规则。 然后,这些规则可以触发响应,例如您的智能灯泡改变颜色。

In this article, we’ll explore how to set up a LIFX smart bulb and then we’ll explore connecting it to IFTTT. Within IFTTT, we will set our lights to turn off when our Jawbone UP24 is in sleep mode. Afterwards we will look at how to set the bulb to change color if our favourite sporting team is playing.

在本文中,我们将探讨如何设置LIFX智能灯泡,然后将其连接至IFTTT。 在IFTTT中,当Jawbone UP24处于睡眠模式时,我们将关闭灯光。 然后,如果我们最喜欢的运动队在比赛,我们将研究如何设置灯泡以改变颜色。

设置我们的LIFX灯泡 (Setting Up Our LIFX light bulbs)

To get started, you’ll need to ensure your light bulbs are connected to your home network. You’ll need to run the iOS or Android LIFX app to set this up.

首先,您需要确保灯泡已连接到家庭网络。 您需要运行iOSAndroid LIFX应用进行设置。

I’m on Android, so I’ve installed the LIFX Android app:

我使用的是Android,因此我已经安装了LIFX And​​roid应用:

LIFX Android App

Open the app and click “Add Bulbs” to set up your LIFX light bulb. Make sure your LIFX light bulb is turned on otherwise it may not appear!

打开应用程序,然后单击“添加灯泡”以设置您的LIFX灯泡。 确保您的LIFX灯泡已打开,否则它可能不会出现!

Adding a LIFX bulb

Choose your bulb and your home Wi-Fi connection, then you’ll be greeted with this wonderful screen allowing you to name the location of your LIFX light bulb, assign it to a group and give it a name:

选择您的灯泡和家庭Wi-Fi连接,然后您会看到一个漂亮的屏幕,该屏幕允许您命名LIFX灯泡的位置,将其分配给一个组并为其命名:

LIFX bulb settings

Once it assigns all of those settings, you’ll see your new location and group in the LIFX menu with your bulb inside it. If you press the power button next to the location, group or individual LIFX light bulb, the light will turn off. If it turns off successfully, then you are ready to go!

分配了所有这些设置后,您将在LIFX菜单中看到新位置和组,并且灯泡就在其中。 如果按位置,组或单个LIFX灯泡旁边的电源按钮,则指示灯将熄灭。 如果成功关闭,则您准备好了!

LIFX bulb ready

You can click on the bulb name in the menu to open up the controls for your bulb. Here you can change the color of the light (either different shades of white or completely new colors like purple from the “Colors” button on the bottom left). You can also set up effects like a strobe light via the “Effects” button.

您可以单击菜单中的灯泡名称,以打开灯泡的控件。 在这里,您可以更改灯光的颜色(通过左下角的“颜色”按钮,可以选择不同的白色阴影或全新的颜色,例如紫色)。 您还可以通过“效果”按钮设置诸如频闪灯的效果。

LIFX light settings

Now you’ve had a bit of fun with those settings, let’s look into how to connect up the LIFX light bulb to other web triggers via IFTTT.

现在您对这些设置有了一些乐趣,让我们研究如何通过IFTTT将LIFX灯泡连接到其他Web触发器。

将我们的LIFX灯泡连接到IFTTT (Connecting Our LIFX Light Bulb To IFTTT)

To create a new recipe, create an account on IFTTT and log in. Then, click your username in the top right and choose “Create”. This takes you to your New IFTTT Recipe Page.

要创建新食谱,请在IFTTT上创建一个帐户并登录。然后,单击右上角的用户名,然后选择“创建”。 这将带您进入新的IFTTT食谱页面

Create recipe

We are then taken to a screen saying “ifthisthenthat”, click the “this” link to begin our process:

然后,我们转到屏幕上说“ ifthisthenthat”,单击“ this”链接开始我们的过程:

If this then that

In the “Choose Trigger Channel” section, type in “UP” and choose the UP icon that appears.

在“选择触发通道”部分中,键入“ UP”,然后选择出现的UP图标。

IFTTT UP Trigger Channel

If you are new to IFTTT and haven’t previously connected your UP to the service (likely!), there’ll be a screen that shows a button saying “Connect”. Click that button and follow the prompts to give IFTTT permission to access your UP data.

如果您是IFTTT的新手,并且以前没有将UP连接到该服务(可能!),将出现一个屏幕,显示一个显示“连接”按钮。 单击该按钮,然后按照提示授予IFTTT权限以访问您的UP数据。

Once you are set up, choose “Sleep mode enabled” in the trigger options that appear.

设置完成后,在出现的触发选项中选择“启用睡眠模式”。

IFTTT Choose UP Trigger

Finish it by clicking “Create Trigger”.

单击“创建触发器”完成它。

Now we’ll have “if UP Sleep mode enabled then that” awaiting us. Click “that” to set up our LIFX smart bulb.

现在,我们将等待“如果启用了UP睡眠模式”。 单击“ that”以设置我们的LIFX智能灯泡。

IFTTT choose action

Type in “lifx” into the “Choose Action Channel” filter and click the LIFX icon. You are likely to need to connect up LIFX too, click the “Connect” button and go through the prompts to give IFTTT access to your LIFX account.

在“选择操作通道”过滤器中输入“ lifx”,然后单击LIFX图标。 您可能还需要连接LIFX,请单击“连接”按钮并按照提示进行操作,以使IFTTT可以访问您的LIFX帐户。

IFTTT Choose UP Action Channel

We’ll arrive at the “Choose an Action” section, here we select “Turn lights off”. This will set our light to be off when sleep mode is enabled.

我们将到达“选择操作”部分,在这里我们选择“关闭灯”。 启用睡眠模式后,这会将我们的灯关闭。

Choose LIFX action in IFTTT

Before IFTTT can turn off our light, it needs to know which lights we’d like to turn off. You can choose individual light bulbs, or whole locations or groups. I chose the individual bulb.

在IFTTT关闭灯之前,它需要知道我们想关闭哪些灯。 您可以选择单个灯泡,也可以选择整个位置或组。 我选择了单个灯泡。

Choosing our LIFX bulb in IFTTT

Next, we can set how long we’d like our lights to gently fade to the off state. I’d personally like to get straight to sleep in the wonderous glow of darkness, so I’ve selected “Instant”.

接下来,我们可以设置希望灯光逐渐淡入关闭状态的时间。 我个人想直接进入奇妙的黑暗中入睡,所以我选择了“即时”。

IFTTT choosing instant LIFX action

Then click “Create Action” to finish setting up this action.

然后单击“创建动作”以完成此动作的设置。

Now you can give your IFTTT recipe a name and set whether you want your phone to notify you each time it runs. I’d recommend not setting your phone to notify you here as this is something we’d like to happen silently so we can rest! Once you are happy with the name and notification settings, click “Create Recipe”.

现在,您可以为IFTTT配方命名,并设置是否希望手机在每次运行时都通知您。 我建议您不要将手机设置为在此处通知您,因为这是我们希望悄悄发生的事情,以便我们休息! 对名称和通知设置满意后,单击“创建配方”。

The final confirmation screen for our LIFX recipe

Once it has created your recipe, it will direct you back to your My Recipes page where you’ll see your new recipe ready and waiting to be tried out!

创建食谱后,它将引导您返回“ 我的食谱”页面,在该页面中,您会看到新食谱已准备就绪,正等待尝试!

Recipe list with LIFX and UP recipe available

测试我们连接的灯泡 (Testing Out Our Connected Light Bulb)

Now for the fun part. Get our your Jawbone UP24 and set it to Sleep Mode. Your smart light bulb should automatically switch off!

现在是有趣的部分。 获取我们的Jawbone UP24并将其设置为“睡眠模式”。 您的智能灯泡应自动关闭!

If you wanted to set the light to turn on again when you wake up, you could set another recipe to do the opposite. For me though, it’s usually daylight outside when I wake up so I’d rather not turn my light on each morning unnecessarily.

如果您想将光设置为在唤醒时再次打开,则可以设置另一种方法进行相反的操作。 不过对我来说,起床通常是外面的日光,所以我不想每天早上都不必要地打开灯。

将我们的灯泡连接到ESPN (Connecting Up Our Light Bulb To ESPN)

We can also use IFTTT to change the color of our light bulb depending on different triggers. Let’s explore triggering our light bulb color to change whenever our favourite sporting team is playing!

我们还可以根据不同的触发条件,使用IFTTT更改灯泡的颜色。 让我们探索一下每当我们最喜欢的运动队在比赛时触发我们的灯泡颜色发生变化!

Go through and create a new recipe as we did before, however this time for the “Choose Trigger Channel” section, find and select ESPN:

像以前一样完成并创建一个新配方,但是这次在“选择触发通道”部分中,找到并选择ESPN:

Choosing the ESPN trigger channel

On the next screen, choose “New Game Start”:

在下一个屏幕上,选择“新游戏开始”:

Choosing our Game Start ESPN trigger

Then choose the sport and team you’d like to trigger the action. I chose my favourite NBA team – the Phoenix Suns.

然后选择您要触发动作的运动和团队。 我选择了我最喜欢的NBA球队-凤凰城太阳队。

Completing ESPN trigger fields

After that, choose LIFX again as the Action Channel, however rather than turning off our lights, choose “Change color of lights”.

之后,再次选择LIFX作为“动作通道”,但是不要关闭灯光,而是选择“更改灯光的颜色”。

Choose LIFX action in IFTTT

Our options for this one are a lot more plentiful than the turning off light option! Here you can choose what color you’d like the light to change to, choose how bright you’d like it to be (or leave it at the brightness it already is), say whether you’d like this action to turn on the light if it isn’t already switched on (I chose “No” as Phoenix might be playing whilst I’m not home and I’d rather not cause a huge energy bill from an eager Phoenix Suns smart light bulb!) and then finally how long the transition should be (I chose “Instant” once again because I want it to happen straight away). Once you are happy with all those settings, click “Create Action”.

我们提供的这一选项比关闭灯光选项要丰富得多! 在这里,您可以选择要将灯光更改为哪种颜色,选择想要的亮度(或保持其已经存在的亮度),并说出是否要打开此功能。如果尚未打开,请点亮(我选择“否”,因为凤凰城可能在我不在家时正在播放,我宁愿不要从急切的凤凰城智能灯泡中产生巨额的电费!),然后最后过渡应该持续多长时间(我再次选择“即时”是因为我希望它立即发生)。 对所有这些设置满意后,请单击“创建操作”。

Setting LIFX color action fields

Finish it by clicking “Create Recipe” and surprise your friends when they come over to watch the next sporting match with you!

通过单击“创建食谱”来完成它,并让您的朋友来与您一起观看下一场体育比赛时为您带来惊喜!

Creating our IFTTT ESPN recipe

结论 (Conclusion)

Not every bit of IoT enabled functionality necessarily needs a truck load of coding! Thanks to services like IFTTT and devices like the LIFX smart light bulb, setting up delightful interactions with internet enabled devices can be simple and easy for even non-coders to complete! Have you got a favourite IoT based IFTTT recipe? Did you come up with a good alternative trigger for your own LIFX smart light bulbs? Leave a note in the comments or get in touch with me on Twitter (@thatpatrickguy), I’d love to hear about it.

并非所有支持IoT的功能都需要大量的编码! 借助IFTTT之类的服务以及LIFX智能灯泡之类的设备,即使是非编码人员,也可以轻松轻松地与支持Internet的设备建立令人愉快的交互! 您有最喜欢的基于IoT的IFTTT食谱吗? 您是否为自己的LIFX智能灯泡提出了一个很好的替代触发器? 在评论中留下笔记或在Twitter( @thatpatrickguy )上与我联系,我很乐意听到有关它的信息。

翻译自: https://www.sitepoint.com/connecting-lifx-light-bulbs-iot-using-ifttt/

ifttt

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值