A simple python script to control a fan from Home Assistant.
- Installing dependencies on a stock Raspbian install:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python3-pip python3-dev python3-gpiozero
| #pragma once | |
| #include "esphome.h" | |
| using namespace esphome; | |
| enum TuyaCmd : uint8_t { | |
| HEARTBEAT = 0x00, | |
| QUERY_PRODUCT = 0x01, | |
| MCU_CONF = 0x02, | |
| WIFI_STATE = 0x03, |
| #GPIO0 Long Press MCU | |
| #GPIO14 Green LED | |
| #GPIO1 UART TX | |
| #GPIO3 UART RX | |
| esphome: | |
| board_flash_mode: dout | |
| includes: | |
| - custom/tuyadimmer_lightoutput.h |
| #!/bin/bash | |
| # Run this script on a running Raspbian OS that you want to be put into an image file. | |
| # Ensure that the system you run this on is less than 10GB in size if you wish to | |
| # deploy the image file to AWS EC2. | |
| # Note: This is based on Michael Fairchild's instance-to-ebs-ami.sh script. | |
| # -https://gist.github.com/249915 | |
| imageFile=${1:-"awsImage-$(date +%m%d%y-%H%M).img"} | |
| imageMountPoint=${2:-'/mnt/mounthdd'} | |
| extraFilesArchive=${3:-'awsInstanceFiles.tar.gz'} |