This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# fork from https://github.com/Nilhcem/esp32-cloud-iot-core-k8s/blob/master/04-generate-jwt/main.py | |
from optparse import OptionParser | |
import datetime | |
import jwt | |
import sys | |
def create_jwt(project_id, private_key_file, algorithm): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import binascii | |
from bluepy.btle import Peripheral | |
class SwitchBot: | |
def __init__(self, mac_address): | |
self.p = Peripheral(mac_address, "random") | |
hand_service = self.p.getServiceByUUID("cba20d00-224d-11e6-9fb8-0002a5d5c51b") | |
self.hand = hand_service.getCharacteristics("cba20002-224d-11e6-9fb8-0002a5d5c51b")[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2019 Kohei "Max" MATSUSHITA | |
* Released under the MIT license | |
* https://opensource.org/licenses/mit-license.php | |
*/ | |
#include <M5Stack.h> | |
#define TINY_GSM_MODEM_UBLOX | |
#include <TinyGsmClient.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2019 Kohei "Max" MATSUSHITA | |
* Released under the MIT license | |
* https://opensource.org/licenses/mit-license.php | |
*/ | |
#include <M5Stack.h> | |
#define CONSOLE Serial | |
#define MODEM Serial2 /* Serial2 is Modem of 3G Module */ | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2019 Kohei "Max" MATSUSHITA | |
* Released under the MIT license | |
* https://opensource.org/licenses/mit-license.php | |
*/ | |
#include <M5Stack.h> | |
#define CONSOLE Serial | |
#define MODEM Serial2 /* Serial2 is Modem of 3G Module */ | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import VL53L0X | |
# Create a VL53L0X object | |
tof = VL53L0X.VL53L0X(i2c_bus=1, i2c_address=0x29) | |
# I2C Address can change before tof.open() | |
# tof.change_address(0x32) | |
tof.open() | |
# Start ranging | |
tof.start_ranging(VL53L0X.Vl53l0xAccuracyMode.BETTER) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
[Unit] | |
Description=SwitchBot worker using MQTT with SORACOM Beam | |
After=network-online.target | |
[Service] | |
Type=simple | |
WorkingDirectory=/home/pi/switchbot | |
ExecStart=/home/pi/switchbot/bin/python3 -B switchbot_worker_with_soracom_beam.py | |
ExecStop=/bin/kill -INT ${MAINPID} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
[Unit] | |
Description=Garage reporter using HTTP with SORACOM Unified Endpoint | |
After=network-online.target | |
[Service] | |
Type=simple | |
WorkingDirectory=/home/pi/switchbot | |
ExecStart=/home/pi/switchbot/bin/python3 -B garage_reporter_with_soracom_unified.py | |
ExecStop=/bin/kill -INT ${MAINPID} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "$0" | |
read LINE | |
if [ "$LINE" = "shooting!" ]; then | |
echo "Taking a Photo!" | |
fswebcam -q --device /dev/video0 - \ | |
| curl -X POST -H 'Content-Type: image/jpeg' --data-binary '@-' --connect-timeout 15 harvest-files.soracom.io | |
fi | |
echo "$0 END" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description = Shooting camera server (implementation) | |
[Service] | |
ExecStart = /bin/bash /home/pi/camera_shooting.bash | |
StandardInput = socket | |
StandardOutput = journal | |
StandardError = journal | |
[Install] |