I wrote an article here I made an IFTTT button that unlocks the entrance 2 lock sesame with 1 button (via AWS Lambda). However, it is an article that seems to be able to do such a thing by applying the Lambda function created at that time.
Candy hosue, the publisher of Sesame, published an article in 2018, and I also tried hands-on this once. (The AWS IoT button was bought at that time). However, with the method in this article, only one sesame can be unlocked, so I wanted to unlock two sesame with the touch of a button, so I created the method in this article.
This guyis. It is a button that can stimulate IoT 1-Click and Lambda on AWS with the push of a button.
―― 2. Set up the AWS lot 1 click app
All you have to do is follow the steps in.
Obtain the API key and sesame ID as described in 1.
in the following article.
-I made an IFTTT button that unlocks the entrance 2 lock sesame with one button (via AWS Lambda)
pysesame2
uploadLaunch the function from AWS Lambda and upgrade the external module pysesame2
as described in 2-1.
and 2-2.
in the following article.
-I made an IFTTT button that unlocks the entrance 2 lock sesame with one button (via AWS Lambda)
Write the following code. It's a Python version, but I wonder if 3.8 is fine.
lambda_function.py
from uuid import UUID
from pysesame2 import Sesame
import os
device_id_1 = UUID(os.environ['DEVICE_ID_1'])
device_id_2 = UUID(os.environ['DEVICE_ID_2'])
APIKey = os.environ['APIKEY']
sesame_1 = Sesame(device_id_1, APIKey)
sesame_2 = Sesame(device_id_2, APIKey)
def lambda_handler(event, context):
sesame_1.async_unlock()
sesame_2.async_unlock()
After writing the code, write the API key obtained in step 1.
and the two sesame IDs one by one in the" environment variable "below it and save it.
After completing the above, execute the function test from "Test" on the upper right of the screen. The JSON to be poured can be hello world or anything. Success if two sesame are unlocked.
―― 4. Create a project on AWS ―― 5. Link the AWS IoT button
Follow the steps in to associate the IoT button with the Lambda function. Success if you press the button and unlock the two sesame! !! !! : grin:
Recommended Posts