├── .github └── workflows │ └── main.yml ├── .gitignore ├── 20210727_125823000_iOS.heic ├── ArduinoPortExpander ├── .gitignore ├── .travis.yml ├── include │ └── README ├── lib │ └── README ├── platformio.ini ├── src │ └── main.cpp └── test │ └── README ├── GH_PR_Issues ├── .gitignore ├── Roboto-Regular.ttf ├── ble_package.yaml ├── logo.png ├── secrets.yaml ├── test.issue_1090.yaml ├── test.issue_1105.yaml ├── test.issue_1111.yaml ├── test.issue_1116.yaml ├── test.issue_1149.yaml ├── test.issue_1151.yaml ├── test.issue_1164.yaml ├── test.issue_1248.yaml ├── test.issue_1251.yaml ├── test.issue_1287.yaml ├── test.issue_1325.yaml ├── test.issue_1406.yaml ├── test.issue_1434.yaml ├── test.issue_1474.yaml ├── test.issue_1521.yaml ├── test.issue_1605.yaml ├── test.issue_1628.yaml ├── test.issue_1632.yaml ├── test.issue_1689.yaml ├── test.issue_1850.yaml ├── test.issue_1851.yaml ├── test.issue_2208.yaml ├── test.issue_855.yaml ├── test.issue_877.yaml ├── test.issue_917.yaml ├── test.issue_esp8266.yaml ├── test.pr_1028.yaml ├── test.pr_1050.yaml ├── test.pr_1051.yaml ├── test.pr_1053.yaml ├── test.pr_1055.yaml ├── test.pr_1057.yaml ├── test.pr_1063.yaml ├── test.pr_1080.yaml ├── test.pr_1090.yaml ├── test.pr_1168.yaml ├── test.pr_1171_esp32.yaml ├── test.pr_1233.yaml ├── test.pr_1410.yaml ├── test.pr_1418.yaml ├── test.pr_1421.yaml ├── test.pr_1522.yaml ├── test.pr_1542.yaml ├── test.pr_1559_esp32.yaml ├── test.pr_1559_esp8266.yaml ├── test.pr_1658.yaml ├── test.pr_2792.yaml ├── test.pr_968.yaml ├── test.pr_988.yaml └── test1.yaml ├── README.md ├── Roboto-Regular.ttf ├── aczc.h ├── common ├── secrets.yaml └── wifi.yaml ├── custom.h ├── experiments ├── .gitignore ├── arduino_port_expander.h ├── eh-rfid-test.yaml ├── ina219.yaml ├── pesp_base.package.yaml ├── pesp_button.yaml ├── pesp_dm.yaml ├── pesp_omotor.yaml ├── pesp_os32c.yaml ├── rc522_i2c.yaml ├── rc522_spi.yaml ├── rgb_receiver.package.yaml ├── sample.gif ├── secrets.yaml ├── slimmelezer-c3.yaml ├── test-ac-dimmer.yaml ├── test-ape-fail-sensor.yaml ├── test-ape.yaml ├── test-completions.yaml ├── test-dsmr-esp32.yaml ├── test-dsmr-esp8266.yaml ├── test-esp32-c3.yaml ├── test-esp32c3-dsmr.yaml ├── test-gps.yaml ├── test-prometheus.yaml ├── test-uda1380.yaml ├── test.4relays.yaml ├── test.ac.wifi.yaml ├── test.aczc.yaml ├── test.ape.yaml ├── test.api_just_connected.yaml ├── test.binary_sensor.yaml ├── test.bmp280.yaml ├── test.captive.yaml ├── test.climate.mitsubishi.yaml ├── test.climate.whirlpool.yaml ├── test.coolix_receive.yaml ├── test.coolix_sender.yaml ├── test.dallas.yaml ├── test.dfplayer.yaml ├── test.dht.yaml ├── test.dimmer.yaml ├── test.dsmr.yaml ├── test.esp32.ble_scanner.yaml ├── test.esp32.dallas.yaml ├── test.esp32.ethernet.yaml ├── test.esp32.mcp_idf.yaml ├── test.esp32.omotor.yaml ├── test.esp32.rf-rx.yaml ├── test.esp32.stepper.yaml ├── test.esp32.stepper_cover.yaml ├── test.esp32.touch.yaml ├── test.esp32.wifi_info.yaml ├── test.esp32.yaml ├── test.esp8266.rf-rx.yaml ├── test.esp8266.thermostat.yaml ├── test.gpio0.yaml ├── test.mcp23017.yaml ├── test.rcswitch.rx.yaml ├── test.rcswitch.tx.yaml ├── test.remote.yaml ├── test.rp2040.yaml ├── test.ssd1306_display.yaml ├── test.time_based_cover.yaml ├── test.veggies.yaml ├── test.vl53l0x.yaml ├── test.water.sensor.yaml ├── test.web_server_spa.yaml ├── test.ws2812b.yaml ├── test.yaml ├── test_base.yaml ├── test_nec.yaml ├── test_packages_main.yaml ├── test_pca8574.yaml ├── test_servo.yaml ├── test_sim800.yaml ├── test_tcl112.yaml ├── test_tm1637.yaml ├── test_waveshare.yaml ├── tmc_stepper_setup.h ├── web-spa-react │ ├── .gitignore │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── robots.txt │ ├── src │ │ ├── App.css │ │ ├── App.test.tsx │ │ ├── App.tsx │ │ ├── esphome │ │ │ └── esphome-client.ts │ │ ├── index.css │ │ ├── index.tsx │ │ ├── logo.svg │ │ ├── react-app-env.d.ts │ │ └── setupTests.ts │ └── tsconfig.json └── wifi_info.yaml ├── logo.png ├── package.wifi.yaml ├── pixelmix.ttf ├── secrets.yaml ├── smile.bmp ├── smile.png └── test.txt /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | # Controls when the action will run. Triggers the workflow on push or pull request 6 | # events but only for the master branch 7 | on: 8 | push: 9 | branches: [ master ] 10 | pull_request: 11 | branches: [ master ] 12 | 13 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 14 | jobs: 15 | # This workflow contains a single job called "build" 16 | build: 17 | # The type of runner that the job will run on 18 | runs-on: ubuntu-latest 19 | 20 | # Steps represent a sequence of tasks that will be executed as part of the job 21 | steps: 22 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 23 | - uses: actions/checkout@v2 24 | 25 | - name: Set up Python 26 | uses: actions/setup-python@v2 27 | with: 28 | python-version: 3.6 29 | - name: Cache pip 30 | uses: actions/cache@v2.0.0 31 | with: 32 | path: ~/.cache/pip 33 | # Look to see if there is a cache hit for the corresponding requirements file 34 | key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} 35 | restore-keys: | 36 | ${{ runner.os }}-pip- 37 | ${{ runner.os }}- 38 | - name: Install dependencies 39 | run: | 40 | python -m pip install --upgrade pip 41 | pip install esphome 42 | 43 | # Runs a single command using the runners shell 44 | - name: Test my_home only 45 | run: | 46 | esphome my_home/EHComedor.yaml compile 47 | echo Add other actions to build, 48 | echo test, and deploy your project. 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | secrets.yaml 2 | **/secrets.yaml 3 | -------------------------------------------------------------------------------- /20210727_125823000_iOS.heic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/20210727_125823000_iOS.heic -------------------------------------------------------------------------------- /ArduinoPortExpander/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .pioenvs 3 | .piolibdeps 4 | .vscode/ -------------------------------------------------------------------------------- /ArduinoPortExpander/.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < https://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < https://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < https://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choose one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # - platformio update 39 | # 40 | # script: 41 | # - platformio run 42 | 43 | 44 | # 45 | # Template #2: The project is intended to be used as a library with examples. 46 | # 47 | 48 | # language: python 49 | # python: 50 | # - "2.7" 51 | # 52 | # sudo: false 53 | # cache: 54 | # directories: 55 | # - "~/.platformio" 56 | # 57 | # env: 58 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 59 | # - PLATFORMIO_CI_SRC=examples/file.ino 60 | # - PLATFORMIO_CI_SRC=path/to/test/directory 61 | # 62 | # install: 63 | # - pip install -U platformio 64 | # - platformio update 65 | # 66 | # script: 67 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 68 | -------------------------------------------------------------------------------- /ArduinoPortExpander/include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /ArduinoPortExpander/lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /ArduinoPortExpander/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [env:pro16MHzatmega328] 12 | platform = atmelavr 13 | board = pro16MHzatmega328 14 | framework = arduino 15 | upload_port = COM8 16 | 17 | ; [env:pro8MHzatmega328] 18 | ; platform = atmelavr 19 | ; board = pro8MHzatmega328 20 | ; framework = arduino 21 | 22 | 23 | 24 | ; upload_port = COM7 -------------------------------------------------------------------------------- /ArduinoPortExpander/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Ports: 3 | 0 0 .. 13 13 4 | A0: 14, A1: 15, A2: 16, A3: 17: A4: 18: A5: 19: A6: 20, A7: 21 5 | port bits: 5 ... 0..32 6 | 0: 0: 00000 7 | 1: 1: 00001 8 | A7: 21: 10101 9 | 10 | 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | #define DEBUG // remove debug so pin 0 and 1 can be used for IO 17 | 18 | #define I2C_ADDRESS 8 19 | 20 | void onRequest(); 21 | void onReceive(int); 22 | 23 | void setup() 24 | { 25 | #ifdef DEBUG 26 | Serial.begin(115200); 27 | Serial.println(F("Init ")); 28 | #endif 29 | 30 | analogReference(INTERNAL); 31 | 32 | Wire.begin(I2C_ADDRESS); 33 | Wire.onRequest(onRequest); 34 | Wire.onReceive(onReceive); 35 | 36 | #ifdef DEBUG 37 | Serial.println(F("Wire ok")); 38 | #endif 39 | } 40 | 41 | void loop() 42 | { 43 | // int temp = analogRead(A1); 44 | // Serial.println(temp); 45 | } 46 | 47 | volatile byte buffer[3]; 48 | volatile byte len = 1; 49 | 50 | #define DIGITAL_READ(b, pin, mask) \ 51 | if (digitalRead(pin)) \ 52 | buffer[b] |= mask; 53 | 54 | void readDigital() 55 | { 56 | len = 3; 57 | buffer[0] = 0; 58 | DIGITAL_READ(0, 0, 1); 59 | DIGITAL_READ(0, 1, 2); 60 | DIGITAL_READ(0, 2, 4); 61 | DIGITAL_READ(0, 3, 8); 62 | DIGITAL_READ(0, 4, 16); 63 | DIGITAL_READ(0, 5, 32); 64 | DIGITAL_READ(0, 6, 64); 65 | DIGITAL_READ(0, 7, 128); 66 | 67 | buffer[1] = 0; 68 | DIGITAL_READ(1, 8, 1); 69 | DIGITAL_READ(1, 9, 2); 70 | DIGITAL_READ(1, 10, 4); 71 | DIGITAL_READ(1, 11, 8); 72 | DIGITAL_READ(1, 12, 16); 73 | DIGITAL_READ(1, 13, 32); 74 | DIGITAL_READ(1, A0, 64); 75 | DIGITAL_READ(1, A1, 128); 76 | 77 | buffer[2] = 0; 78 | DIGITAL_READ(2, A2, 1); 79 | DIGITAL_READ(2, A3, 2); 80 | 81 | // I2C 82 | // DIGITAL_READ(2, A4, 4); 83 | // DIGITAL_READ(2, A5, 8); 84 | 85 | // DIGITAL READ not supports on A3 .. A7 86 | #ifdef DEBUG_READ 87 | Serial.print(F("Read 3 bytes: ")); 88 | Serial.print(buffer[0]); 89 | Serial.print(' '); 90 | Serial.print(buffer[1]); 91 | Serial.print(' '); 92 | Serial.println(buffer[2]); 93 | 94 | #endif 95 | } 96 | void readAnalog(int pin) 97 | { 98 | int val = analogRead(A0 + pin); 99 | len = 2; 100 | buffer[0] = val & 0xFF; 101 | buffer[1] = (val >> 8) & 0b11; 102 | #ifdef DEBUG_READ 103 | Serial.print(F("Read analog pin ")); 104 | Serial.println(pin); 105 | #endif 106 | } 107 | 108 | void onRequest() 109 | { 110 | Wire.write(const_cast(buffer), len); 111 | } 112 | 113 | #define CMD_DIGITAL_READ 0x0 114 | 115 | #define CMD_WRITE_ANALOG 0x2 116 | #define CMD_WRITE_DIGITAL_HIGH 0x3 117 | #define CMD_WRITE_DIGITAL_LOW 0x4 118 | 119 | #define CMD_SETUP_PIN_OUTPUT 0x5 120 | #define CMD_SETUP_PIN_INPUT_PULLUP 0x6 121 | #define CMD_SETUP_PIN_INPUT 0x7 122 | 123 | // 8 analog registers.. A0 to A7 124 | // A4 and A5 not supported due to I2C 125 | #define CMD_ANALOG_READ_A0 0b1000 // 0x8 126 | // .... 127 | #define CMD_ANALOG_READ_A7 0b1111 // 0xF 128 | 129 | #define CMD_SETUP_ANALOG_INTERNAL 0x10 130 | #define CMD_SETUP_ANALOG_DEFAULT 0x11 131 | 132 | void onReceive(int numBytes) 133 | { 134 | #ifdef DEBUG_READ 135 | Serial.print("Received bytes: "); 136 | Serial.println(numBytes); 137 | #endif 138 | int cmd = Wire.read(); 139 | 140 | switch (cmd) 141 | { 142 | case CMD_DIGITAL_READ: 143 | readDigital(); 144 | break; 145 | } 146 | 147 | if (cmd >= CMD_ANALOG_READ_A0 && cmd <= CMD_ANALOG_READ_A7) 148 | { 149 | readAnalog(cmd & 0b111); 150 | return; 151 | } 152 | 153 | int pin = Wire.read(); 154 | 155 | switch (cmd) 156 | { 157 | case CMD_WRITE_DIGITAL_HIGH: 158 | case CMD_WRITE_DIGITAL_LOW: 159 | { 160 | bool output = cmd == CMD_WRITE_DIGITAL_HIGH; 161 | digitalWrite(pin, output); 162 | #ifdef DEBUG 163 | Serial.print(F("Pin ")); 164 | Serial.print(pin); 165 | Serial.println(output ? F(" HIGH") : F(" LOW")); 166 | #endif 167 | break; 168 | } 169 | case CMD_WRITE_ANALOG: 170 | { 171 | int val = Wire.read() & (Wire.read() << 8); 172 | analogWrite(pin, val); 173 | #ifdef DEBUG 174 | Serial.print(F("Pin ")); 175 | Serial.print(pin); 176 | Serial.print(F(" Analog write ")); 177 | Serial.println(val); 178 | #endif 179 | break; 180 | } 181 | case CMD_SETUP_PIN_OUTPUT: 182 | pinMode(pin, OUTPUT); 183 | #ifdef DEBUG 184 | Serial.print(F("Pin ")); 185 | Serial.print(pin); 186 | Serial.println(F(" OUTPUT")); 187 | #endif 188 | break; 189 | case CMD_SETUP_PIN_INPUT: 190 | pinMode(pin, INPUT); 191 | #ifdef DEBUG 192 | Serial.print(F("Pin ")); 193 | Serial.print(pin); 194 | Serial.println(F("INPUT")); 195 | #endif 196 | break; 197 | case CMD_SETUP_PIN_INPUT_PULLUP: 198 | pinMode(pin, INPUT_PULLUP); 199 | #ifdef DEBUG 200 | Serial.print(F("Pin ")); 201 | Serial.print(pin); 202 | Serial.println(F("INPUT PULLUP")); 203 | #endif 204 | break; 205 | case CMD_SETUP_ANALOG_INTERNAL: 206 | analogReference(INTERNAL); 207 | #ifdef DEBUG 208 | Serial.println(F("Analog reference INTERNAL")); 209 | #endif 210 | break; 211 | case CMD_SETUP_ANALOG_DEFAULT: 212 | analogReference(DEFAULT); 213 | #ifdef DEBUG 214 | Serial.println(F("Analog reference DEFAULT")); 215 | #endif 216 | break; 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /ArduinoPortExpander/test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PIO Unit Testing and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PIO Unit Testing: 11 | - https://docs.platformio.org/page/plus/unit-testing.html 12 | -------------------------------------------------------------------------------- /GH_PR_Issues/.gitignore: -------------------------------------------------------------------------------- 1 | # Gitignore settings for ESPHome 2 | # This is an example and may include too much for your use-case. 3 | # You can modify this file to suit your needs. 4 | /.esphome/ 5 | **/.pioenvs/ 6 | **/.piolibdeps/ 7 | **/lib/ 8 | **/src/ 9 | **/platformio.ini 10 | 11 | -------------------------------------------------------------------------------- /GH_PR_Issues/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/GH_PR_Issues/Roboto-Regular.ttf -------------------------------------------------------------------------------- /GH_PR_Issues/ble_package.yaml: -------------------------------------------------------------------------------- 1 | logger: 2 | logs: 3 | esp32_ble_tracker: INFO 4 | 5 | esp32_ble_tracker: 6 | -------------------------------------------------------------------------------- /GH_PR_Issues/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/GH_PR_Issues/logo.png -------------------------------------------------------------------------------- /GH_PR_Issues/secrets.yaml: -------------------------------------------------------------------------------- 1 | !include ../secrets.yaml -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1090.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | 6 | wifi: 7 | ssid: !secret wifi_ssid 8 | password: !secret wifi_pass 9 | 10 | logger: 11 | level: DEBUG 12 | 13 | api: 14 | 15 | binary_sensor: 16 | - platform: gpio 17 | id: io14 18 | pin: GPIO14 19 | filters: 20 | - delayed_on_off: 10s 21 | 22 | interval: 23 | interval: 2s 24 | then: 25 | - logger.log: "interval timer" 26 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1105.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcuv2 5 | 6 | wifi: 7 | ssid: !secret wifi_ssid 8 | password: !secret wifi_pass 9 | fast_connect: true 10 | 11 | logger: 12 | level: VERBOSE 13 | baud_rate: 0 14 | 15 | ota: 16 | 17 | api: 18 | 19 | output: 20 | - platform: gpio 21 | id: motor_close 22 | pin: D0 23 | - platform: gpio 24 | id: motor_open 25 | pin: D1 26 | 27 | script: 28 | - id: monitor_current 29 | then: 30 | - while: 31 | condition: 32 | lambda: 'return true;' 33 | then: 34 | - component.update: motor_current 35 | - delay: 50ms 36 | 37 | sensor: 38 | - name: "Lock motor current" 39 | id: motor_current 40 | update_interval: never 41 | internal: true 42 | platform: adc 43 | pin: A0 44 | 45 | on_value_range: 46 | above: 0.5 47 | then: 48 | - cover.stop: door_lock 49 | 50 | cover: 51 | - id: door_lock 52 | name: "Door lock" 53 | device_class: door 54 | platform: time_based 55 | open_duration: 4s 56 | open_action: 57 | #- script.stop: close_later 58 | - output.turn_off: motor_close 59 | - output.turn_on: motor_open 60 | - script.execute: monitor_current 61 | #- script.execute: close_later 62 | close_duration: 6s 63 | close_action: 64 | #- script.stop: close_later 65 | - output.turn_off: motor_open 66 | - output.turn_on: motor_close 67 | - script.execute: monitor_current 68 | stop_action: 69 | - output.turn_off: motor_open 70 | - output.turn_off: motor_close 71 | - script.stop: monitor_current 72 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1111.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcuv2 5 | 6 | wifi: 7 | ssid: !secret wifi_ssid 8 | password: !secret wifi_pass 9 | fast_connect: true 10 | 11 | logger: 12 | level: VERBOSE 13 | baud_rate: 0 14 | 15 | ota: 16 | 17 | api: 18 | 19 | substitutions: 20 | node_id: switch_tuya2_1 21 | blinking_interval: 500ms 22 | interlock_time: 200ms 23 | 24 | cover: 25 | - platform: time_based 26 | name: "Volet salon" 27 | id: ${node_id}_cover 28 | device_class: shade 29 | open_action: 30 | - switch.turn_off: go_close 31 | - delay: ${interlock_time} 32 | - switch.turn_on: go_open 33 | open_duration: 27s 34 | close_action: 35 | - switch.turn_off: go_open 36 | - delay: ${interlock_time} 37 | - switch.turn_on: go_close 38 | close_duration: 25s 39 | stop_action: 40 | - switch.turn_off: go_close 41 | - switch.turn_off: go_open 42 | 43 | binary_sensor: 44 | - platform: gpio 45 | id: btnL 46 | internal: yes 47 | pin: 48 | number: 3 49 | inverted: yes 50 | on_release: 51 | then: 52 | - if: 53 | condition: 54 | lambda: 'return id(switch_tuya2_1_cover).current_operation == COVER_OPERATION_IDLE;' 55 | then: 56 | - cover.open: ${node_id}_cover 57 | else: 58 | - cover.stop: ${node_id}_cover 59 | 60 | - platform: gpio 61 | id: btnR 62 | internal: yes 63 | pin: 64 | number: 5 65 | inverted: yes 66 | on_release: 67 | then: 68 | - if: 69 | condition: 70 | lambda: 'return id(switch_tuya2_1_cover).current_operation == COVER_OPERATION_IDLE;' 71 | then: 72 | - cover.close: ${node_id}_cover 73 | else: 74 | - cover.stop: ${node_id}_cover 75 | 76 | switch: 77 | - platform: template 78 | id: go_close 79 | turn_on_action: 80 | - switch.turn_on: relayL1 81 | - while: 82 | condition: 83 | lambda: 'return true;' 84 | then: 85 | - switch.turn_on: ledR 86 | - delay: ${blinking_interval} 87 | - switch.turn_off: ledR 88 | - delay: ${blinking_interval} 89 | turn_off_action: 90 | - switch.turn_off: relayL1 91 | - switch.turn_off: ledR 92 | - platform: template 93 | id: go_open 94 | internal: yes 95 | turn_on_action: 96 | - switch.turn_on: relayL2 97 | - while: 98 | condition: 99 | lambda: 'return true;' 100 | then: 101 | - switch.turn_on: ledL 102 | - delay: ${blinking_interval} 103 | - switch.turn_off: ledL 104 | - delay: ${blinking_interval} 105 | turn_off_action: 106 | - switch.turn_off: relayL2 107 | - switch.turn_off: ledL 108 | 109 | - platform: gpio 110 | id: relayL1 111 | internal: yes 112 | pin: 13 113 | interlock: relayL2 114 | interlock_wait_time: ${interlock_time} 115 | - platform: gpio 116 | id: relayL2 117 | internal: yes 118 | pin: 4 119 | interlock: relayL1 120 | interlock_wait_time: ${interlock_time} 121 | - platform: gpio 122 | id: ledL 123 | internal: yes 124 | pin: 125 | number: 14 126 | inverted: yes 127 | - platform: gpio 128 | id: ledR 129 | internal: yes 130 | pin: 131 | number: 1 132 | inverted: yes 133 | 134 | status_led: 135 | pin: 136 | number: 0 137 | inverted: yes 138 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1116.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | 6 | wifi: 7 | ssid: !secret wifi_ssid 8 | password: !secret wifi_pass 9 | 10 | # Enable logging 11 | logger: 12 | 13 | # Enable Home Assistant API 14 | api: 15 | 16 | ota: 17 | 18 | globals: 19 | - id: ch1s 20 | type: float 21 | restore_value: false 22 | initial_value: "5.6" 23 | 24 | sensor: 25 | - platform: template 26 | name: x 27 | id: x 28 | lambda: |- 29 | return id(ch1s); 30 | update_interval: 60s -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1149.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | 6 | wifi: 7 | ssid: !secret wifi_ssid 8 | password: !secret wifi_pass 9 | fast_connect: true 10 | 11 | logger: 12 | level: VERY_VERBOSE 13 | 14 | ota: 15 | 16 | api: 17 | 18 | switch: 19 | - platform: template 20 | id: open_cover_switch 21 | - platform: template 22 | id: close_cover_switch 23 | 24 | cover: 25 | - platform: time_based 26 | name: "Time-Based Cover" 27 | 28 | open_action: 29 | - switch.turn_on: open_cover_switch 30 | open_duration: 2.1min 31 | 32 | close_action: 33 | - switch.turn_on: close_cover_switch 34 | close_duration: 2min 35 | 36 | stop_action: 37 | - switch.turn_off: open_cover_switch 38 | - switch.turn_off: close_cover_switch -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1151.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | logger: 13 | 14 | api: 15 | 16 | ota: 17 | 18 | esp32_touch: 19 | setup_mode: True 20 | iir_filter: 10ms 21 | 22 | binary_sensor: 23 | - platform: esp32_touch 24 | name: "ESP32 Touch Pad GPIO4" 25 | pin: GPIO4 26 | threshold: 1000 27 | # - platform: esp32_touch 28 | # name: "ESP32 Touch Pad GPIO2" 29 | # pin: GPIO2 30 | # threshold: 1000 31 | - platform: esp32_touch 32 | name: "ESP32 Touch Pad GPIO15" 33 | pin: GPIO15 34 | threshold: 1000 35 | # - platform: esp32_touch 36 | # name: "ESP32 Touch Pad GPIO13" 37 | # pin: GPIO13 38 | # threshold: 1000 39 | # - platform: esp32_touch 40 | # name: "ESP32 Touch Pad GPIO12" 41 | # pin: GPIO12 42 | # threshold: 1000 43 | # - platform: esp32_touch 44 | # name: "ESP32 Touch Pad GPIO14" 45 | # pin: GPIO14 46 | # threshold: 1000 47 | # - platform: esp32_touch 48 | # name: "ESP32 Touch Pad GPI27" 49 | # pin: GPIO27 50 | # threshold: 1000 51 | # - platform: esp32_touch 52 | # name: "ESP32 Touch Pad GPIO33" 53 | # pin: GPIO33 54 | # threshold: 1000 55 | # - platform: esp32_touch 56 | # name: "ESP32 Touch Pad GPIO32" 57 | # pin: GPIO32 58 | # threshold: 1000 -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1164.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | logger: 9 | level: DEBUG 10 | 11 | wifi: 12 | ssid: !secret wifi_ssid 13 | password: !secret wifi_pass 14 | 15 | api: 16 | 17 | ota: 18 | 19 | remote_transmitter: 20 | pin: D7 21 | # RF uses a 100% carrier signal 22 | carrier_duty_percent: 50% 23 | 24 | switch: 25 | - platform: template 26 | name: Vizio TV Power 27 | id: vizio_tv_power 28 | optimistic: true 29 | restore_state: true 30 | turn_on_action: 31 | - remote_transmitter.transmit_nec: 32 | address: 0x20DF 33 | command: 0x10EF 34 | turn_off_action: 35 | - remote_transmitter.transmit_raw: 36 | code: [4088, -1542, 1019, -510, 513, -1019, 510, -509, 511, -510, 1020, 37 | -1020, 1022, -1019, 510, -509, 511, -510, 511, -509, 511, -510, 38 | 1020, -1019, 510, -511, 1020, -510, 512, -508, 510, -1020, 1022] 39 | carrier_frequency: 38kHz 40 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1248.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | captive_portal: 13 | 14 | # Enable logging 15 | logger: 16 | 17 | # Enable Home Assistant API 18 | api: 19 | 20 | ota: 21 | 22 | # Example configuration entry 23 | dallas: 24 | - pin: GPIO4 -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1251.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | substitutions: 9 | float_value: GPIO13 10 | 11 | wifi: 12 | ssid: !secret wifi_ssid 13 | password: !secret wifi_pass 14 | 15 | captive_portal: 16 | 17 | # Enable logging 18 | logger: 19 | 20 | # Enable Home Assistant API 21 | api: 22 | # services: 23 | # - service: control_servo 24 | # variables: 25 | # level: float 26 | # then: 27 | # - servo.write: 28 | # id: my_servo 29 | # level: !lambda 'return level / 100.0;' 30 | 31 | ota: 32 | 33 | 34 | sensor: 35 | - platform: pulse_counter 36 | name: 'Solar Power' 37 | id: solar_power 38 | update_interval: 5s 39 | pin: 40 | number: GPIO13 41 | mode: INPUT_PULLDOWN 42 | count_mode: 43 | rising_edge: DISABLE 44 | falling_edge: INCREMENT 45 | filters: 46 | - multiply: 0.06 47 | 48 | # binary_sensor: 49 | # - platform: gpio 50 | # name: pulse 51 | # id: pulse 52 | # pin: 53 | # number: GPIO13 54 | # mode: INPUT_PULLDOWN 55 | # on_press: 56 | # - lambda: |- 57 | # static int num_executions = 0; 58 | # ESP_LOGD("main", "I am at execution number %d", num_executions); 59 | # num_executions += 1; -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1287.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | captive_portal: 13 | 14 | # Enable logging 15 | logger: 16 | 17 | # Enable Home Assistant API 18 | api: 19 | # services: 20 | # - service: control_servo 21 | # variables: 22 | # level: float 23 | # then: 24 | # - servo.write: 25 | # id: my_servo 26 | # level: !lambda 'return level / 100.0;' 27 | 28 | ota: 29 | output: 30 | - platform: ledc 31 | id: pwm_output 32 | pin: GPIO12 33 | frequency: 100 Hz 34 | 35 | - platform: gpio 36 | id: servo_power 37 | pin: GPIO12 38 | 39 | 40 | light: 41 | - platform: monochromatic 42 | id: l1 43 | output: pwm_output 44 | 45 | interval: 46 | - interval: 5s 47 | then: 48 | - light.turn_on: l1 49 | - delay: 2s 50 | - light.turn_off: l1 -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1325.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | 13 | logger: 14 | baud_rate: 0 15 | level: DEBUG 16 | 17 | 18 | ota: 19 | 20 | 21 | uart: 22 | rx_pin: RX 23 | tx_pin: TX 24 | baud_rate: 9600 25 | id: pms 26 | 27 | 28 | dfplayer: 29 | id: my_df_player 30 | on_finished_playback: 31 | then: 32 | logger.log: 'Somebody press play!' 33 | 34 | binary_sensor: 35 | - platform: template 36 | name: "dfplayer_is_playing" 37 | lambda: 'return id(my_df_player).is_playing();' 38 | 39 | 40 | api: 41 | services: 42 | - service: dfplayer_next 43 | then: 44 | - dfplayer.play_next: 45 | - service: dfplayer_previous 46 | then: 47 | - dfplayer.play_previous: 48 | - service: dfplayer_play 49 | variables: 50 | file: int 51 | then: 52 | - dfplayer.play: !lambda 'return file;' 53 | - service: dfplayer_play_loop 54 | variables: 55 | file: int 56 | loop_: bool 57 | then: 58 | - dfplayer.play: 59 | file: !lambda 'return file;' 60 | loop: !lambda 'return loop_;' 61 | - service: dfplayer_play_folder 62 | variables: 63 | folder: int 64 | file: int 65 | then: 66 | - dfplayer.play_folder: 67 | folder: !lambda 'return folder;' 68 | file: !lambda 'return file;' 69 | 70 | - service: dfplayer_play_loo_folder 71 | variables: 72 | folder: int 73 | then: 74 | - dfplayer.play_folder: 75 | folder: !lambda 'return folder;' 76 | loop: True 77 | 78 | - service: dfplayer_set_device 79 | variables: 80 | device: int 81 | then: 82 | - dfplayer.set_device: 83 | device: TF_CARD 84 | # - service: dfplayer_set_device_str 85 | # variables: 86 | # device: string 87 | # then: 88 | # - dfplayer.set_device: 89 | # device: !lambda 'return (device == "USB")? dfplayer::USB : dfplayer::TF_CARD;' 90 | 91 | - service: dfplayer_set_volume 92 | variables: 93 | volume: int 94 | then: 95 | - dfplayer.set_volume: !lambda 'return volume;' 96 | - service: dfplayer_set_eq 97 | variables: 98 | preset: int 99 | then: 100 | - dfplayer.set_eq: !lambda 'return static_cast(preset);' 101 | 102 | - service: dfplayer_sleep 103 | then: 104 | - dfplayer.sleep 105 | 106 | - service: dfplayer_reset 107 | then: 108 | - dfplayer.reset 109 | 110 | - service: dfplayer_start 111 | then: 112 | - dfplayer.start 113 | 114 | - service: dfplayer_pause 115 | then: 116 | - dfplayer.pause 117 | 118 | - service: dfplayer_stop 119 | then: 120 | - dfplayer.stop 121 | 122 | - service: dfplayer_random 123 | then: 124 | - dfplayer.random -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1406.yaml: -------------------------------------------------------------------------------- 1 | # single test esp12f led (GPIO2) and some boards (GPIO16 led) 2 | # leds are toggled with GPIO0 (usually built in flash button) 3 | 4 | esphome: 5 | name: test_esp8266 6 | platform: ESP8266 7 | board: nodemcuv2 8 | platformio_options: 9 | upload_speed: 921600 10 | 11 | logger: 12 | level: VERY_VERBOSE 13 | logs: 14 | api.service: DEBUG 15 | 16 | packages: 17 | wifi: !include package.wifi.yaml 18 | 19 | api: 20 | 21 | sensor: 22 | - platform: adc 23 | id: weld_duration 24 | name: "Duration" 25 | pin: A0 26 | unit_of_measurement: "ms" 27 | accuracy_decimals: 4 28 | update_interval: 1s 29 | 30 | globals: 31 | - id: start_stopwatch 32 | type: float 33 | initial_value: "0.7f" 34 | restore_value: no 35 | 36 | binary_sensor: 37 | - platform: gpio 38 | pin: GPIO0 39 | id: lala 40 | on_press: 41 | - globals.set: 42 | id: start_stopwatch 43 | value: '0.6f' 44 | 45 | switch: 46 | - id: relay0 47 | platform: template 48 | 49 | interval: 50 | - interval: 1s 51 | then: 52 | - logger.log: 53 | format: "weld_duration %.4d start_stopwatch %.4d" 54 | args: [ 'id(weld_duration).state', 'id(start_stopwatch)' ] 55 | - if: 56 | condition: 57 | - lambda: 'return id(weld_duration).state <= id(start_stopwatch);' 58 | then: 59 | - switch.turn_off: relay0 60 | - lambda: |- 61 | id(start_stopwatch) = 0; 62 | 63 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1434.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | arduino_version: 2.7.0 6 | 7 | wifi: 8 | ssid: !secret wifi_ssid 9 | password: !secret wifi_pass 10 | fast_connect: true 11 | 12 | logger: 13 | level: VERY_VERBOSE 14 | 15 | ota: 16 | 17 | api: 18 | 19 | time: 20 | - platform: sntp 21 | id: sntp_time 22 | timezone: 'America/Argentina/Buenos_Aires' # -3 23 | 24 | display: 25 | platform: tm1637 26 | id: tm1637_display 27 | dio_pin: D7 28 | clk_pin: D6 29 | lambda: |- 30 | auto time = id(sntp_time).now(); 31 | it.strftime("%H.%M", time); 32 | 33 | # interval: 34 | # - interval: 10s 35 | # then: 36 | # - logger.log: 37 | # format: "The temperature sensor reports value %.1f and humidity %.1f" 38 | # args: [ 'id(temperature_sensor).state', 'id(humidity_sensor).state' ] 39 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1474.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: esp-wrover-kit 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | # Enable fallback hotspot (captive portal) in case wifi connection fails 13 | ap: 14 | ssid: "Closet Fallback Hotspot" 15 | password: "password" 16 | 17 | captive_portal: 18 | 19 | # Enable logging 20 | logger: 21 | 22 | # Enable Home Assistant API 23 | api: 24 | 25 | ota: 26 | 27 | esp32_ble_tracker: 28 | 29 | binary_sensor: 30 | - platform: ble_presence 31 | mac_address: "a2:32:32:32:32:32" 32 | device_class: presence 33 | name: "Name's Harness" 34 | - platform: ble_presence 35 | mac_address: "a2:32:32:32:32:32" 36 | device_class: presence 37 | name: "Name" 38 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1521.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | 6 | wifi: 7 | ssid: !secret wifi_ssid 8 | password: !secret wifi_pass 9 | 10 | logger: 11 | level: DEBUG 12 | 13 | api: 14 | 15 | output: 16 | - platform: esp8266_pwm 17 | pin: D5 18 | frequency: 200 Hz 19 | inverted: false 20 | id: brightness_middle 21 | - platform: gpio 22 | pin: 23 | number: GPIO2 24 | inverted: yes 25 | id: led_d2 26 | 27 | light: 28 | - platform: monochromatic 29 | output: brightness_middle 30 | default_transition_length: 5s 31 | name: "Brightness Middle" 32 | on_turn_on: 33 | then: 34 | - logger.log: "mono on event" 35 | on_turn_off: 36 | then: 37 | - logger.log: "mono off event" 38 | 39 | - platform: binary 40 | output: led_d2 41 | name: "binary light" 42 | on_turn_on: 43 | then: 44 | - logger.log: "binary on event" 45 | on_turn_off: 46 | then: 47 | - logger.log: "binary off event" 48 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1628.yaml: -------------------------------------------------------------------------------- 1 | #https://github.com/esphome/issues/issues/1628 2 | 3 | esphome: 4 | name: test_esp8266 5 | platform: ESP8266 6 | board: nodemcuv2 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | # Enable logging 14 | logger: 15 | 16 | i2c: 17 | sda: 4 18 | scl: 5 19 | scan: True 20 | 21 | font: 22 | - file: "../Roboto-Regular.ttf" 23 | id: arial 24 | size: 12 25 | 26 | display: 27 | - platform: ssd1306_i2c 28 | model: "SSD1306 128x32" 29 | address: 0x3C 30 | id: display_1 31 | update_interval: 10s 32 | pages: 33 | - id: page1 34 | lambda: |- 35 | it.print(0, 0, id(arial), "test1"); 36 | 37 | - id: page2 38 | lambda: |- 39 | it.print(0, 0, id(arial), "test2"); 40 | 41 | # interval: 42 | # - interval: 5s 43 | # then: 44 | # - display.page.show_next: display_1 45 | # - component.update: display_1 -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1632.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | level: VERBOSE 15 | 16 | api: 17 | 18 | ota: 19 | 20 | output: 21 | - platform: ac_dimmer 22 | id: dimmer1 23 | gate_pin: 26 24 | min_power: 20% 25 | zero_cross_pin: 26 | number: 25 27 | mode: INPUT_PULLUP 28 | inverted: yes 29 | light: 30 | - platform: monochromatic 31 | output: dimmer1 32 | name: Dimmer test 33 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1689.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | packages: 9 | wifi: !include ../package.wifi.yaml 10 | 11 | logger: 12 | level: DEBUG 13 | 14 | ota: 15 | 16 | api: 17 | 18 | output: 19 | - platform: ac_dimmer 20 | id: dimmer1 21 | gate_pin: D6 22 | method: leading 23 | zero_cross_pin: 24 | number: D7 25 | mode: INPUT_PULLUP 26 | inverted: yes 27 | 28 | light: 29 | - platform: monochromatic 30 | output: dimmer1 31 | name: Dimmer 32 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1850.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: deurbel 3 | platform: ESP8266 4 | board: d1_mini 5 | 6 | wifi: 7 | ssid: !secret wifi_ssid 8 | password: !secret wifi_pass 9 | fast_connect: true 10 | 11 | logger: 12 | #level: VERY_VERBOSE 13 | 14 | api: 15 | 16 | ota: 17 | 18 | switch: 19 | - platform: template 20 | name: Test_SW1 21 | optimistic: true 22 | - platform: template 23 | name: Test_SW2 24 | optimistic: true 25 | - platform: template 26 | name: Test_SW3 27 | optimistic: true 28 | - platform: template 29 | name: Test_SW4 30 | optimistic: true 31 | - platform: template 32 | name: Test_SW5 33 | optimistic: true 34 | - platform: template 35 | name: Test_SW6 36 | optimistic: true 37 | - platform: template 38 | name: Test_SW7 39 | optimistic: true 40 | - platform: template 41 | name: Test_SW8 42 | optimistic: true 43 | 44 | - platform: template 45 | name: Test_SW9 46 | optimistic: true 47 | 48 | - platform: template 49 | name: Test_SW10 50 | optimistic: true 51 | 52 | - platform: template 53 | name: Test_SW11 54 | optimistic: true 55 | 56 | - platform: template 57 | name: Test_SW12 58 | optimistic: true 59 | 60 | - platform: template 61 | name: Test_SW13 62 | optimistic: true 63 | 64 | - platform: template 65 | name: Test_SW14 66 | optimistic: true 67 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_1851.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | # If buzzer is enabled, notify on api connection success 9 | on_boot: 10 | priority: -10 11 | then: 12 | - wait_until: 13 | api.connected: 14 | - logger.log: API is connected! 15 | 16 | wifi: 17 | ssid: !secret wifi_ssid 18 | password: !secret wifi_pass 19 | 20 | logger: 21 | level: DEBUG 22 | 23 | debug: 24 | 25 | ota: 26 | 27 | api: 28 | services: 29 | - service: test 30 | variables: 31 | a_int: int 32 | a_string: string 33 | a_float: float 34 | a_bool: bool 35 | a_int_array: int[] 36 | a_string_array: string[] 37 | a_float_array: float[] 38 | a_bool_array: bool[] 39 | then: 40 | logger.log: service called 41 | - service: control_servo 42 | variables: 43 | level: float 44 | then: 45 | - servo.write: 46 | id: my_servo 47 | level: !lambda "return level / 100.0;" 48 | - service: control_servo2 49 | variables: 50 | level: float 51 | then: 52 | - servo.write: 53 | id: my_servo2 54 | level: !lambda "return level / 100.0;" 55 | 56 | - service: control_servo2_detach 57 | variables: 58 | level: float 59 | then: 60 | - servo.detach: my_servo2 61 | 62 | # Example configuration entry 63 | servo: 64 | - id: my_servo 65 | output: pwm_output 66 | - id: my_servo2 67 | output: pwm_output2 68 | 69 | # Example output platform 70 | # On ESP32, use ledc output 71 | output: 72 | - platform: esp8266_pwm 73 | id: pwm_output 74 | pin: D2 75 | frequency: 50 Hz 76 | - platform: esp8266_pwm 77 | id: pwm_output2 78 | pin: D1 79 | frequency: 50 Hz 80 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_2208.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | # If buzzer is enabled, notify on api connection success 9 | on_boot: 10 | priority: -10 11 | then: 12 | - wait_until: 13 | api.connected: 14 | - logger.log: API is connected! 15 | 16 | wifi: 17 | ssid: !secret wifi_ssid 18 | password: !secret wifi_pass 19 | 20 | logger: 21 | level: DEBUG 22 | 23 | debug: 24 | 25 | ota: 26 | 27 | api: 28 | 29 | sensor: 30 | - platform: dht 31 | pin: GPIO2 32 | temperature: 33 | name: lele_sensor 34 | model: dht22 35 | 36 | external_components: 37 | - source: 38 | type: git 39 | url: https://github.com:/gb53smith/esphome 40 | ref: main 41 | components: [dht] 42 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_877.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | #level: VERY_VERBOSE 15 | 16 | api: 17 | 18 | ota: 19 | 20 | switch: 21 | - platform: template 22 | name: Test_SW1 23 | optimistic: true 24 | - platform: template 25 | name: Test_SW2 26 | optimistic: true 27 | - platform: template 28 | name: Test_SW3 29 | optimistic: true 30 | - platform: template 31 | name: Test_SW4 32 | optimistic: true 33 | - platform: template 34 | name: Test_SW5 35 | optimistic: true 36 | - platform: template 37 | name: Test_SW6 38 | optimistic: true 39 | - platform: template 40 | name: Test_SW7 41 | optimistic: true 42 | - platform: template 43 | name: Test_SW8 44 | optimistic: true 45 | 46 | - platform: template 47 | name: Test_SW9 48 | optimistic: true 49 | 50 | - platform: template 51 | name: Test_SW10 52 | optimistic: true 53 | 54 | - platform: template 55 | name: Test_SW11 56 | optimistic: true 57 | 58 | - platform: template 59 | name: Test_SW12 60 | optimistic: true 61 | 62 | - platform: template 63 | name: Test_SW13 64 | optimistic: true 65 | 66 | - platform: template 67 | name: Test_SW14 68 | optimistic: true 69 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_917.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | on_boot: 9 | priority: -100 10 | then: 11 | - delay: 5s 12 | - logger.log: "Executing Script" 13 | - script.execute: wait_example 14 | - logger.log: "Waiting for script" 15 | - script.wait: wait_example 16 | - logger.log: "Finished Waiting" 17 | 18 | logger: 19 | level: VERBOSE 20 | 21 | script: 22 | - id: wait_example 23 | then: 24 | - logger.log: "Running script" 25 | - delay: 10s 26 | - logger.log: "Finished Script" 27 | 28 | binary_sensor: 29 | - platform: template 30 | name: "Script Running" 31 | lambda: |- 32 | return id(wait_example).script_is_running(); -------------------------------------------------------------------------------- /GH_PR_Issues/test.issue_esp8266.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | esp8266_restore_from_flash: true 6 | 7 | wifi: 8 | ssid: !secret wifi_ssid 9 | password: !secret wifi_pass 10 | fast_connect: true 11 | 12 | logger: 13 | level: VERY_VERBOSE 14 | 15 | ota: 16 | 17 | api: 18 | 19 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1028.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | api: 13 | 14 | ota: 15 | 16 | # define i2c device 17 | # for an ESP8266 SDA is D2 and goes to Arduino's A4 18 | # SCL is D1 and goes to Arduino's A5 19 | i2c: 20 | id: i2c_component 21 | 22 | logger: 23 | level: DEBUG 24 | 25 | dallas: 26 | pin: D5 27 | auto_setup_sensors: true 28 | sensor_name_template: '%s.Temperature %s' 29 | resolution: 9 30 | 31 | sensor: 32 | - platform: bmp280 33 | temperature: 34 | name: bmp280_1_temperature 35 | oversampling: 16X 36 | pressure: 37 | name: bmp280_1_pressure 38 | address: 0x76 # pull down 10k to set address 0x66 (installed in board) 39 | 40 | - platform: bmp280 41 | temperature: 42 | name: bmp280_2_temperature 43 | oversampling: 16X 44 | pressure: 45 | name: bmp280_2_pressure 46 | address: 0x77 # pull up 3.3k to set address 0x77 47 | 48 | - platform: dht 49 | pin: D0 50 | model: am2302 51 | temperature: 52 | name: dht22_temperature 53 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1050.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | level: VERY_VERBOSE 15 | 16 | ota: 17 | 18 | api: 19 | 20 | colors: 21 | - id: kbx_red 22 | red: 100% 23 | green: 1% 24 | blue: 5% 25 | 26 | spi: 27 | mosi_pin: GPIO4 28 | miso_pin: GPIO5 29 | clk_pin: GPIO4 30 | 31 | font: 32 | - id: helvetica_small 33 | file: pixelmix.ttf 34 | 35 | display: 36 | - platform: st7789v 37 | id: main_lcd 38 | backlight_pin: GPIO4 39 | cs_pin: GPIO5 40 | dc_pin: GPIO16 41 | reset_pin: GPIO4 42 | rotation: 270 43 | pages: 44 | - id: page1 45 | lambda: |- 46 | it.print(235, 5, id(helvetica_small), id(kbx_red), TextAlign::TOP_RIGHT, "Offline"); 47 | // ...or use a predefined color from 'color.h' like this: 48 | it.print(235, 5, id(helvetica_small), esphome::COLOR_GREEN, TextAlign::TOP_RIGHT, "Online"); 49 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1051.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | level: VERY_VERBOSE 15 | 16 | ota: 17 | 18 | api: 19 | 20 | output: 21 | - platform: gpio 22 | id: my_output_1 23 | pin: GPIO4 24 | 25 | - platform: gpio 26 | id: my_output_2 27 | pin: GPIO0 28 | 29 | fan: 30 | - platform: binary 31 | output: my_output_1 32 | name: "Living Room Fan" 33 | direction_output: my_output_2 -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1053.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | 15 | spi: 16 | clk_pin: D0 17 | mosi_pin: D1 18 | 19 | api: 20 | 21 | ota: 22 | 23 | display: 24 | - platform: max7219digit 25 | cs_pin: D2 26 | num_chips: 4 27 | scroll_speed: 100ms 28 | scroll_mode: STOP 29 | intensity: 3 30 | lambda: |- 31 | 32 | it.invert_on_off(true); 33 | // Print Hello at position 0 (left) 34 | it.print(0,0, id(digit_font), "Hello!"); 35 | 36 | it.intensity(5); 37 | 38 | it.turn_on_off(false); 39 | 40 | font: 41 | - file: "../pixelmix.ttf" 42 | id: digit_font 43 | size: 8 44 | 45 | time: 46 | - platform: homeassistant 47 | id: hass_time 48 | 49 | image: 50 | - file: "../smile.png" 51 | id: my_image -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1055.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | 15 | spi: 16 | clk_pin: D0 17 | mosi_pin: D1 18 | 19 | api: 20 | 21 | ota: 22 | 23 | i2c: 24 | 25 | ads1115: 26 | - address: 0x48 27 | continuous_mode: false 28 | 29 | sensor: 30 | - platform: vl53l0x 31 | name: "VL53L0x Distance" 32 | address: 0x29 33 | update_interval: 60s 34 | signal_rate_limit: 0.25 35 | long_range: true 36 | - platform: ads1115 37 | multiplexer: 'A0_GND' 38 | gain: 6.144 39 | name: "ADS1115 Channel A0-GND" 40 | - platform: ina219 41 | address: 0x40 42 | current: 43 | name: "INA219 Current" 44 | power: 45 | name: "INA219 Power" 46 | bus_voltage: 47 | name: "INA219 Bus Voltage" 48 | shunt_voltage: 49 | name: "INA219 Shunt Voltage" 50 | 51 | 52 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1057.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | 15 | spi: 16 | clk_pin: D0 17 | mosi_pin: D1 18 | 19 | api: 20 | 21 | ota: 22 | 23 | # Example configuration entry 24 | mcp3008: 25 | cs_pin: D8 26 | 27 | # Example config of sensors. 28 | # This is a NTCB3950 10K thermocoupler attached to pin 0 29 | # of the MCP3008 with a 10K resistor as a voltage divider. 30 | # See `resistance` and `ntc` platorms for other options 31 | sensor: 32 | - platform: mcp3008 # Attached to pin 0 of the MCP3008. 33 | # The result will be a reading from 0-1023 34 | update_interval: 1s 35 | id: freezer_temp_source 36 | number: 0 # pin number 37 | - platform: resistance 38 | id: freezer_resistance_sensor 39 | sensor: freezer_temp_source 40 | configuration: DOWNSTREAM 41 | resistor: 10kOhm 42 | name: Resistance Sensor 43 | - platform: ntc 44 | id: freezer_temp 45 | sensor: freezer_resistance_sensor 46 | calibration: 47 | b_constant: 3950 48 | reference_temperature: 25°C 49 | reference_resistance: 10kOhm 50 | name: Freezer Temperature -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1063.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | 15 | api: 16 | 17 | ota: 18 | 19 | i2c: 20 | 21 | sensor: 22 | - platform: bh1750 23 | name: lele 24 | 25 | external_components: 26 | - source: github://esphome/esphome@importlib-custom-components 27 | refresh: 1d 28 | components: [bh1750] 29 | 30 | # - source: 31 | # type: local 32 | # path: components 33 | # components: [bh1750] 34 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1080.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | packages: 9 | wifi: !include package.wifi.yaml 10 | 11 | logger: 12 | level: VERBOSE 13 | 14 | api: 15 | 16 | ota: 17 | 18 | web_server: 19 | js_url: "https://deploy-preview-542--esphome.netlify.com/_static/webserver-v1.js" 20 | 21 | 22 | binary_sensor: 23 | - platform: gpio 24 | pin: GPIO0 25 | id: la_x 26 | on_press: 27 | - logger.log: 'this is a log message telling that the gpio0 was pressed' 28 | 29 | switch: 30 | - platform: template 31 | name: Test_SW1 32 | optimistic: true 33 | - platform: template 34 | name: Test_SW2 35 | optimistic: true 36 | - platform: template 37 | name: Test_SW3 38 | optimistic: true 39 | - platform: template 40 | name: Test_SW4 41 | optimistic: true 42 | - platform: template 43 | name: Test_SW5 44 | optimistic: true 45 | - platform: template 46 | name: Test_SW6 47 | optimistic: true 48 | - platform: template 49 | name: Test_SW7 50 | optimistic: true 51 | - platform: template 52 | name: Test_SW8 53 | optimistic: true 54 | 55 | - platform: template 56 | name: Test_SW9 57 | optimistic: true 58 | 59 | - platform: template 60 | name: Test_SW10 61 | optimistic: true 62 | 63 | - platform: template 64 | name: Test_SW11 65 | optimistic: true 66 | 67 | - platform: template 68 | name: Test_SW12 69 | optimistic: true 70 | 71 | - platform: template 72 | name: Test_SW13 73 | optimistic: true 74 | 75 | - platform: template 76 | name: Test_SW14 77 | optimistic: true 78 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1090.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | 15 | 16 | api: 17 | 18 | ota: 19 | 20 | i2c: 21 | sda: GPIO21 22 | scl: GPIO22 23 | 24 | font: 25 | - file: "Roboto-Regular.ttf" 26 | id: my_font 27 | size: 16 28 | 29 | ################################################################################ 30 | 31 | 32 | sensor: 33 | #----------------------------------------------------------------------------- 34 | # Wi-Fi Signal Sensor 35 | - platform: wifi_signal 36 | id: wifi_sgnl 37 | name: "WiFi Signal Sensor" 38 | update_interval: 5s 39 | accuracy_decimals: 0 40 | filters: 41 | - sliding_window_moving_average: 42 | window_size: 60 43 | send_every: 60 44 | send_first_at: 2 45 | 46 | 47 | 48 | display: 49 | - platform: ssd1306_i2c 50 | model: "SSD1306 128x64" 51 | #reset_pin: D0 52 | address: 0x3C 53 | lambda: |- 54 | it.print(0, 0, id(my_font), "Hello World!"); 55 | it.printf(0, 26, id(my_font), "Wi-Fi: %.1f", id(wifi_sgnl).state); 56 | 57 | 58 | 59 | it.line(1, 0, 124, 0); 60 | it.line(1, 63, 124, 63); 61 | it.line(0, 1, 0, 62); 62 | it.line(125, 1, 125, 62); 63 | 64 | it.line(126, 1, 126, 62); // I DO NOT SEE THIS LINE -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1168.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | packages: 9 | wifi: !include package.wifi.yaml 10 | 11 | logger: 12 | level: VERY_VERBOSE 13 | 14 | ota: 15 | 16 | api: 17 | 18 | binary_sensor: 19 | - platform: gpio 20 | id: test_button0 21 | pin: GPIO0 22 | on_press: 23 | then: 24 | - script.execute: s4 25 | 26 | - platform: gpio 27 | id: test_button4 28 | pin: GPIO4 29 | on_press: 30 | then: 31 | - script.execute: s2 32 | 33 | - platform: gpio 34 | id: test_button2 35 | pin: GPIO2 36 | on_press: 37 | then: 38 | - script.execute: s3 39 | 40 | - platform: gpio 41 | id: test_button16 42 | pin: GPIO16 43 | on_press: 44 | then: 45 | - script.execute: s4 46 | 47 | 48 | script: 49 | - id: s1 50 | mode: single #default 51 | then: 52 | - logger.log: s1 single start 53 | - delay: 10s 54 | - logger.log: s1 single stop 55 | 56 | - id: s2 57 | mode: restart 58 | then: 59 | - logger.log: s2 restart start 60 | - delay: 10s 61 | - logger.log: s2 restart stop 62 | 63 | - id: s3 64 | mode: queue 65 | max_runs: 4 66 | 67 | then: 68 | - logger.log: s3 queue start 69 | - delay: 10s 70 | - logger.log: s3 queue stop 71 | 72 | 73 | - id: s4 74 | mode: parallel 75 | then: 76 | - logger.log: s4 parallel start 77 | - delay: 10s 78 | - logger.log: s4 parallel stop 79 | 80 | 81 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1171_esp32.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | ota: 9 | 10 | logger: 11 | 12 | level: VERY_VERBOSE 13 | logs: 14 | api.service: DEBUG 15 | 16 | packages: 17 | wifi: !include package.wifi.yaml 18 | 19 | #substitutions: 20 | 21 | output: 22 | - platform: ledc 23 | pin: GPIO22 24 | id: rtttl_out 25 | 26 | rtttl: 27 | output: rtttl_out 28 | on_finished_playback: 29 | - logger.log: 'termino la cancion' 30 | 31 | api: 32 | services: 33 | - service: play_rtttl 34 | variables: 35 | song_str: string 36 | then: 37 | - rtttl.play: 38 | rtttl: !lambda 'return song_str;' 39 | 40 | binary_sensor: 41 | - platform: gpio 42 | id: flash_btn 43 | pin: GPIO0 44 | on_press: 45 | - if: 46 | condition: 47 | - rtttl.is_playing 48 | then: 49 | - rtttl.stop: 50 | else: 51 | - rtttl.play: 'MissionImp:d=16,o=6,b=95:32d,32d#,32d,32d#,32d,32d#,32d,32d#,32d,32d,32d#,32e,32f,32f#,32g,g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#,p,g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#,p,a#,g,2d,32p,a#,g,2c#,32p,a#,g,2c,a#5,8c,2p,32p,a#5,g5,2f#,32p,a#5,g5,2f,32p,a#5,g5,2e,d#,8d' 52 | - delay: 40s 53 | - rtttl.play: 'StarWars:d=4,o=5,b=45:32p,32f#,32f#,32f#,8b.,8f#.6,32e6,32d#6,32c#6,8b.6,16f#.6,32e6,32d#6,32c#6,8b.6,16f#.6,32e6,32d#6,32e6,8c#.6,32f#,32f#,32f#,8b.,8f#.6,32e6,32d#6,32c#6,8b.6,16f#.6,32e6,32d#6,32c#6,8b.6,16f#.6,32e6,32d#6,32e6,8c#6' 54 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1233.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | 15 | api: 16 | 17 | ota: 18 | 19 | i2c: 20 | sda: GPIO21 21 | scl: GPIO22 22 | 23 | font: 24 | - file: "Roboto-Regular.ttf" 25 | id: my_font 26 | size: 16 27 | 28 | ################################################################################ 29 | 30 | sensor: 31 | #----------------------------------------------------------------------------- 32 | # Wi-Fi Signal Sensor 33 | - platform: wifi_signal 34 | id: wifi_sgnl 35 | name: "WiFi Signal Sensor" 36 | update_interval: 5s 37 | accuracy_decimals: 0 38 | filters: 39 | - sliding_window_moving_average: 40 | window_size: 60 41 | send_every: 60 42 | send_first_at: 2 43 | 44 | spi: 45 | clk_pin: GPIO25 46 | mosi_pin: GPIO26 47 | miso_pin: GPIO32 48 | 49 | image: 50 | - id: esphome_logo 51 | file: logo.png 52 | resize: 240x42 53 | type: binary 54 | 55 | display: 56 | - platform: ili9341 57 | id: display_x 58 | model: TFT_2.4 59 | cs_pin: GPIO14 60 | dc_pin: GPIO27 61 | #led_pin: 32 62 | reset_pin: GPIO33 63 | rotation: 180 64 | pages: 65 | - id: page1 66 | lambda: |- 67 | // Draw a circle in the middle of the display 68 | Color WHITE(1,1,1); 69 | Color BLUE(0,0,1); 70 | Color GREEN(0,1,0); 71 | Color BLACK(0,0,0); 72 | Color RED(1,0,0); 73 | 74 | it.fill(RED); 75 | it.image(0, 0, id(esphome_logo)); 76 | 77 | - id: page2 78 | lambda: |- 79 | // Draw a circle in the middle of the display 80 | Color WHITE(1,1,1); 81 | Color BLUE(0,0,1); 82 | Color GREEN(0,1,0); 83 | Color BLACK(0,0,0); 84 | Color RED(1,0,0); 85 | 86 | it.fill(BLUE); 87 | it.image(0, 0, id(esphome_logo)); 88 | 89 | it.image(0, 50, id(esphome_logo), BLACK, WHITE); 90 | it.image(0, 100, id(esphome_logo), COLOR_OFF, COLOR_ON); 91 | it.image(0, 150, id(esphome_logo), GREEN, BLUE); 92 | it.filled_circle(it.get_width() / 2, 280, 30, RED); 93 | it.rectangle(5,90,235,110,BLUE); 94 | 95 | it.print(10, 100, id(my_font), GREEN,"Hello World!"); 96 | 97 | interval: 98 | - interval: 5s 99 | then: 100 | - display.page.show_next: display_x 101 | - component.update: display_x 102 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1410.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | level: DEBUG 15 | 16 | ota: 17 | 18 | i2c: 19 | 20 | tca9548a: 21 | - address: 0x70 22 | id: multiplex0 23 | scan: True 24 | 25 | # Individual I2C Devices 26 | sensor: 27 | - platform: bmp280 28 | multiplexer: 29 | id: multiplex0 30 | channel: 0 -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1418.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | packages: 9 | wifi: !include ../package.wifi.yaml 10 | 11 | logger: 12 | level: VERBOSE 13 | 14 | api: 15 | 16 | ota: 17 | 18 | i2c: 19 | 20 | output: 21 | - platform: mcp4725 22 | id: dac_output 23 | address: 0x61 24 | 25 | light: 26 | - platform: monochromatic 27 | name: mono_light 28 | output: dac_output 29 | 30 | 31 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1421.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | on_boot: 9 | logger.log: "hello" 10 | 11 | packages: 12 | wifi: !include ../package.wifi.yaml 13 | 14 | logger: 15 | level: VERBOSE 16 | 17 | api: 18 | 19 | ota: 20 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1522.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | api: 13 | 14 | ota: 15 | 16 | logger: 17 | level: VERBOSE 18 | 19 | light: 20 | - platform: rgbww 21 | name: light1 22 | cold_white: output_cw 23 | warm_white: 24 | blue: output_blue 25 | red: output_red 26 | green: output_green 27 | cold_white_color_temperature: 6536 K 28 | warm_white_color_temperature: 2000 K 29 | 30 | output: 31 | - platform: esp8266_pwm 32 | id: output_cw 33 | pin: D7 34 | - platform: esp8266_pwm 35 | id: output_ww 36 | pin: D7 37 | - platform: esp8266_pwm 38 | id: output_blue 39 | pin: D7 40 | - platform: esp8266_pwm 41 | id: output_red 42 | pin: D7 43 | - platform: esp8266_pwm 44 | id: output_green 45 | pin: D7 46 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1542.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | api: 9 | services: 10 | - service: lala 11 | variables: 12 | name: string 13 | then: 14 | logger.log: 15 | format: "lala service called! %s" 16 | args: [name.c_str()] 17 | 18 | wifi: 19 | ssid: !secret wifi_ssid 20 | password: !secret wifi_pass 21 | fast_connect: true 22 | 23 | logger: 24 | level: DEBUG 25 | 26 | ota: 27 | 28 | font: 29 | - file: "Roboto-Regular.ttf" 30 | id: my_font 31 | size: 16 32 | 33 | ################################################################################ 34 | 35 | sensor: 36 | - platform: wifi_signal 37 | id: wifi_sgnl 38 | name: "WiFi Signal Sensor" 39 | update_interval: 5s 40 | accuracy_decimals: 0 41 | filters: 42 | - sliding_window_moving_average: 43 | window_size: 60 44 | send_every: 60 45 | send_first_at: 2 46 | 47 | globals: 48 | - id: touch_x 49 | type: int 50 | - id: touch_y 51 | type: int 52 | 53 | - id: touch_on 54 | type: boolean 55 | 56 | xpt2046: 57 | cs_pin: GPIO12 58 | on_state: 59 | - lambda: |- 60 | id (touch_on) = touched; 61 | id(touch_x) = x; 62 | id(touch_y) = y; 63 | - component.update: display_x 64 | 65 | update_interval: 50ms 66 | report_interval: 500ms 67 | dimension_x: 240 68 | dimension_y: 320 69 | calibration_x_max: 280 70 | calibration_x_min: 3860 71 | calibration_y_max: 340 72 | calibration_y_min: 3860 73 | 74 | spi: 75 | clk_pin: GPIO25 76 | mosi_pin: GPIO26 77 | miso_pin: GPIO32 78 | 79 | image: 80 | - id: esphome_logo 81 | file: logo.png 82 | resize: 240x42 83 | type: binary 84 | 85 | color: 86 | - id: BLACK 87 | - id: WHITE 88 | red: 100% 89 | green: 100% 90 | blue: 100% 91 | - id: RED 92 | red: 100% 93 | 94 | binary_sensor: 95 | - platform: xpt2046 96 | x_max: 240 97 | x_min: 0 98 | y_min: 0 99 | y_max: 42 100 | id: esphome_logo_touch 101 | on_state: 102 | - component.update: display_x 103 | 104 | display: 105 | - platform: ili9341 106 | lambda: |- 107 | it.fill(BLACK); 108 | if (id(esphome_logo_touch).state) 109 | it.image(0, 0, id(esphome_logo)); 110 | else 111 | it.image(0, 0, id(esphome_logo), RED, BLACK); 112 | if (id(touch_on)) 113 | it.filled_circle(id(touch_x) - 5, id(touch_y) - 5, 10, RED); 114 | 115 | id: display_x 116 | model: TFT_2.4 117 | cs_pin: GPIO14 118 | dc_pin: GPIO27 119 | #led_pin: 32 120 | reset_pin: GPIO33 121 | rotation: 0 122 | update_interval: 5s 123 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1559_esp32.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: esp-wrover-kit 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | on_boot: 9 | logger.log: "hello" 10 | 11 | http_request: 12 | useragent: esphome/device 13 | timeout: 10s 14 | 15 | packages: 16 | wifi: !include ../package.wifi.yaml 17 | 18 | logger: 19 | level: VERBOSE 20 | 21 | api: 22 | 23 | ota: 24 | 25 | interval: 26 | - interval: 100s 27 | then: 28 | - http_request.get: 29 | url: https://esphome.io 30 | headers: 31 | Content-Type: application/json 32 | verify_ssl: false 33 | 34 | mqtt: 35 | broker: "192.168.178.84" 36 | port: 1883 37 | username: "debug" 38 | password: "debug" 39 | client_id: someclient 40 | discovery: True 41 | discovery_retain: False 42 | discovery_prefix: discovery 43 | topic_prefix: helloworld 44 | log_topic: 45 | topic: helloworld/hi 46 | level: INFO 47 | birth_message: 48 | will_message: 49 | shutdown_message: 50 | topic: topic/to/send/to 51 | payload: hi 52 | qos: 2 53 | retain: True 54 | keepalive: 60s 55 | reboot_timeout: 60s 56 | on_message: 57 | - topic: my/custom/topic 58 | qos: 0 59 | then: 60 | - lambda: >- 61 | ESP_LOGD("main", "Got message %s", x.c_str()); 62 | on_json_message: 63 | topic: the/topic 64 | then: 65 | - if: 66 | condition: 67 | - wifi.connected: 68 | - mqtt.connected: 69 | then: 70 | - lambda: >- 71 | ESP_LOGD("main", "Got message lala"); 72 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1559_esp8266.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | on_boot: 9 | logger.log: "hello" 10 | 11 | http_request: 12 | useragent: esphome/device 13 | timeout: 10s 14 | 15 | packages: 16 | wifi: !include ../package.wifi.yaml 17 | 18 | logger: 19 | level: VERBOSE 20 | 21 | api: 22 | 23 | ota: 24 | 25 | interval: 26 | - interval: 100s 27 | then: 28 | - http_request.get: 29 | url: https://esphome.io 30 | headers: 31 | Content-Type: application/json 32 | verify_ssl: false 33 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_1658.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | logger: 14 | 15 | api: 16 | 17 | ota: 18 | 19 | remote_transmitter: 20 | pin: GPIO0 21 | carrier_duty_percent: 50% 22 | 23 | switch: 24 | - platform: gpio 25 | id: x 26 | pin: GPIO0 27 | restore_source: none 28 | restore_initial_value: true 29 | 30 | climate: 31 | - platform: coolix 32 | id: cx 33 | restore_source: flash 34 | restore_initial_value: 35 | mode: 'off' 36 | 37 | cover: 38 | - platform: template 39 | id: x_cover 40 | restore_source: none 41 | restore_initial_value: open 42 | 43 | globals: 44 | - id: xx 45 | type: int 46 | restore_initial_value: '234' 47 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_2792.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp8266 3 | 4 | # esp8266: 5 | # board: nodemcuv2 6 | 7 | esp32: 8 | board: esp32doit-devkit-v1 9 | framework: 10 | type: arduino 11 | 12 | wifi: 13 | ssid: !secret wifi_ssid 14 | password: !secret wifi_pass 15 | fast_connect: true 16 | 17 | logger: 18 | level: DEBUG 19 | 20 | sim800l: 21 | id: as 22 | 23 | ota: 24 | 25 | api: 26 | port: 6053 27 | 28 | time: 29 | - platform: homeassistant 30 | id: homeassistant_time 31 | on_time_sync: 32 | - delay: 33 | days: 1 34 | 35 | 36 | # display: 37 | # platform: tm1637 38 | # id: tm1637_display 39 | # clk_pin: D6 40 | # dio_pin: D5 41 | # lambda: |- 42 | # it.print("0123"); 43 | display: 44 | - platform: tm1637 45 | id: dsp1 46 | # clk_pin: D6 47 | # dio_pin: D5 48 | 49 | clk_pin: GPIO23 50 | dio_pin: GPIO22 51 | update_interval: 500ms 52 | lambda: |- 53 | static int i = 0; 54 | i++; 55 | if ((i % 2) == 0) 56 | it.strftime("%H.%M", id(homeassistant_time).now()); 57 | else 58 | it.strftime("%H%M", id(homeassistant_time).now()); 59 | 60 | binary_sensor: 61 | - platform: tm1637 62 | name: key1-00 63 | key: 0 64 | - platform: tm1637 65 | name: key1-01 66 | key: 1 67 | - platform: tm1637 68 | name: key1-02 69 | key: 2 70 | - platform: tm1637 71 | name: key1-03 72 | key: 3 73 | - platform: tm1637 74 | name: key1-04 75 | key: 4 76 | - platform: tm1637 77 | name: key1-05 78 | tm1637_id: dsp1 79 | key: 5 80 | - platform: tm1637 81 | name: key1-06 82 | tm1637_id: dsp1 83 | key: 6 84 | - platform: tm1637 85 | name: key1-07 86 | tm1637_id: dsp1 87 | key: 7 88 | 89 | - platform: tm1637 90 | name: key2-00 91 | tm1637_id: dsp1 92 | key: 8 93 | - platform: tm1637 94 | name: key2-01 95 | tm1637_id: dsp1 96 | key: 9 97 | - platform: tm1637 98 | name: key2-02 99 | tm1637_id: dsp1 100 | key: 10 101 | - platform: tm1637 102 | name: key2-03 103 | tm1637_id: dsp1 104 | key: 11 105 | - platform: tm1637 106 | name: key2-04 107 | tm1637_id: dsp1 108 | key: 12 109 | - platform: tm1637 110 | name: key2-05 111 | tm1637_id: dsp1 112 | key: 13 113 | - platform: tm1637 114 | name: key2-06 115 | tm1637_id: dsp1 116 | key: 14 117 | - platform: tm1637 118 | name: key2-07 119 | tm1637_id: dsp1 120 | key: 15 121 | -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_968.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | api: 13 | 14 | ota: 15 | 16 | logger: 17 | level: VERBOSE 18 | 19 | spi: 20 | id: spi1 21 | clk_pin: D0 22 | mosi_pin: D1 23 | miso_pin: D2 24 | 25 | 26 | canbus: 27 | - platform: mcp2515 28 | cs_pin: D5 29 | can_id: 4 30 | bit_rate: 50kbps 31 | on_frame: 32 | - can_id: 500 33 | then: 34 | - lambda: |- 35 | std::string b(x.begin(), x.end()); 36 | ESP_LOGD("canid 500", "%s", &b[0] ); 37 | - can_id: 23 38 | then: 39 | - if: 40 | condition: 41 | lambda: 'return x[0] == 0x11;' 42 | then: 43 | light.toggle: light1 44 | 45 | binary_sensor: 46 | - platform: gpio 47 | pin: D3 48 | id: x 49 | on_double_click: 50 | - canbus.send: [ 0x11, 0x22, 0x33 ] 51 | on_release: 52 | - canbus.send: 53 | can_id: 23 54 | data: [ 0x10, 0x20, 0x30 ] 55 | on_press: 56 | - canbus.send: 57 | data: [ 0x10, 0x20, 0x30 ] 58 | 59 | light: 60 | - platform: binary 61 | id: light1 62 | output: outputLight 63 | 64 | output: 65 | - platform: gpio 66 | id: outputLight 67 | pin: D7 -------------------------------------------------------------------------------- /GH_PR_Issues/test.pr_988.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | api: 13 | 14 | ota: 15 | 16 | logger: 17 | level: DEBUG 18 | 19 | spi: 20 | clk_pin: D0 21 | mosi_pin: D1 22 | miso_pin: D2 23 | 24 | pn532: 25 | - id: pn532_1 26 | cs_pin: D3 27 | update_interval: 1s 28 | - id: pn532_2 29 | cs_pin: D3 30 | update_interval: 1s 31 | 32 | binary_sensor: 33 | - platform: pn532 34 | pn532_id: pn532_1 35 | uid: 74-10-37-94 36 | name: "PN532 NFC Tag" -------------------------------------------------------------------------------- /GH_PR_Issues/test1.yaml: -------------------------------------------------------------------------------- 1 | substitutions: 2 | devicename: test1 3 | 4 | esphome: 5 | name: test1 6 | platform: ESP32 7 | board: nodemcu-32s 8 | on_boot: 9 | priority: 150.0 10 | then: 11 | - lambda: >- 12 | ESP_LOGD("main", "ON BOOT!"); 13 | on_shutdown: 14 | then: 15 | - lambda: >- 16 | ESP_LOGD("main", "ON SHUTDOWN!"); 17 | on_loop: 18 | then: 19 | - lambda: >- 20 | ESP_LOGV("main", "ON LOOP!"); 21 | 22 | build_path: build/test1 23 | 24 | packages: 25 | wifi: !include test_packages/test_packages_package_wifi.yaml 26 | pkg_test: !include test_packages/test_packages_package1.yaml 27 | 28 | wifi: 29 | networks: 30 | - ssid: "MySSID" 31 | password: "password1" 32 | - ssid: "MySSID2" 33 | password: "" 34 | channel: 14 35 | bssid: "A1:63:95:47:D3:1D" 36 | manual_ip: 37 | static_ip: 192.168.178.230 38 | gateway: 192.168.178.1 39 | subnet: 255.255.255.0 40 | dns1: 1.1.1.1 41 | dns2: 1.2.2.1 42 | domain: .local 43 | reboot_timeout: 120s 44 | power_save_mode: none 45 | 46 | http_request: 47 | useragent: esphome/device 48 | timeout: 10s 49 | 50 | mqtt: 51 | broker: "192.168.178.84" 52 | port: 1883 53 | username: "debug" 54 | password: "debug" 55 | client_id: someclient 56 | discovery: True 57 | discovery_retain: False 58 | discovery_prefix: discovery 59 | topic_prefix: helloworld 60 | log_topic: 61 | topic: helloworld/hi 62 | level: INFO 63 | birth_message: 64 | will_message: 65 | shutdown_message: 66 | topic: topic/to/send/to 67 | payload: hi 68 | qos: 2 69 | retain: True 70 | keepalive: 60s 71 | reboot_timeout: 60s 72 | on_message: 73 | - topic: my/custom/topic 74 | qos: 0 75 | then: 76 | - lambda: >- 77 | ESP_LOGD("main", "Got message %s", x.c_str()); 78 | on_json_message: 79 | topic: the/topic 80 | then: 81 | - if: 82 | condition: 83 | - wifi.connected: 84 | - mqtt.connected: 85 | then: 86 | - http_request.get: 87 | url: https://esphome.io 88 | headers: 89 | Content-Type: application/json 90 | verify_ssl: false 91 | on_response: 92 | 93 | - http_request.post: 94 | url: https://esphome.io 95 | verify_ssl: false 96 | json: 97 | key: !lambda |- 98 | 'return "lala";' 99 | greeting: "Hello World" 100 | - http_request.send: 101 | method: PUT 102 | url: https://esphome.io 103 | headers: 104 | Content-Type: application/json 105 | body: "Some data" 106 | verify_ssl: false 107 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # esphome_devices 2 | 3 | ![CI](https://github.com/glmnet/esphome_devices/workflows/CI/badge.svg) 4 | 5 | This is my house full of ESPHome devices... I really don't know how many are there already, but around 15. 6 | 7 | There are 4 outside, two in the living room, 1 in the kitchen, upstairs there is 1 on the hall and 1 on each room + 1 for every AC unit. 8 | 9 | Many of them are connected to Arduinos via I2C and the Arduino Port Expander (https://esphome.io/cookbook/arduino_port_extender.html) thinghy, those controls relays boards (the common one which comes with 4 relays) 10 | 11 | Everything is DIY hardware too, no sonoff here. 12 | 13 | I do have to admit I have a few H801 RGBWW Led controllers, which uses the ESP8266 inside. 14 | 15 | I not only use ESPHome but I also develop and contribute for ESPHome for more than a year already, helping Otto as much as I can. So you will find here many test yaml programs which I write to test code I write or maintain. 16 | 17 | I've created a few components 18 | * DF Player 19 | * SIM800L Sms Sender 20 | * TM1637 display 21 | * Coolix climate (contributed a bit on the climate stuff) 22 | * AC Dimmer, this one started by Otto but really put some effort there, seems to be working 23 | 24 | I also maintain the VSCode plugin 25 | 26 | Hope this helps! 27 | -------------------------------------------------------------------------------- /Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/Roboto-Regular.ttf -------------------------------------------------------------------------------- /aczc.h: -------------------------------------------------------------------------------- 1 | #include "esphome.h" 2 | 3 | void zero_cross() { 4 | digitalWrite(14, LOW); 5 | } 6 | 7 | class TSADimmer : public Component { 8 | public: 9 | void setup() override { 10 | attachInterrupt(4, &zero_cross, RISING); 11 | pinMode(14, OUTPUT); //nodemcu D5 PWM 12 | //pinMode(4, INPUT); //nodemcu D2 ZC 13 | } 14 | 15 | void loop() override { 16 | digitalWrite(14, HIGH); 17 | delay(1); 18 | } 19 | 20 | }; -------------------------------------------------------------------------------- /common/secrets.yaml: -------------------------------------------------------------------------------- 1 | !include ../secrets.yaml 2 | -------------------------------------------------------------------------------- /common/wifi.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | wifi: 3 | ssid: !secret wifi_ssid 4 | password: !secret wifi_pass 5 | -------------------------------------------------------------------------------- /custom.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "esphome.h" 3 | 4 | class CustomSensor : public Component, public Sensor { 5 | public: 6 | void loop() override { 7 | // Test id() helper 8 | float value = id(my_sensor).state; 9 | id(my_global_string) = "Hello World"; 10 | publish_state(42.0); 11 | } 12 | }; 13 | 14 | class CustomTextSensor : public Component, public TextSensor { 15 | public: 16 | void loop() override { publish_state("Hello World"); } 17 | }; 18 | 19 | class CustomBinarySensor : public Component, public BinarySensor { 20 | public: 21 | void loop() override { publish_state(false); } 22 | }; 23 | 24 | class CustomSwitch : public Switch { 25 | protected: 26 | void write_state(bool state) override { ESP_LOGD("custom_switch", "Setting %s", ONOFF(state)); } 27 | }; 28 | 29 | class CustomComponent : public PollingComponent { 30 | public: 31 | void setup() override { ESP_LOGD("custom_component", "Setup"); } 32 | void update() override { ESP_LOGD("custom_component", "Update"); } 33 | }; 34 | 35 | class CustomBinaryOutput : public BinaryOutput, public Component { 36 | protected: 37 | void write_state(bool state) override { ESP_LOGD("custom_output", "Setting %s", ONOFF(state)); } 38 | }; 39 | 40 | class CustomFloatOutput : public FloatOutput, public Component { 41 | protected: 42 | void write_state(float state) override { ESP_LOGD("custom_output", "Setting %f", state); } 43 | }; 44 | 45 | class CustomNativeAPI : public Component, public CustomAPIDevice { 46 | public: 47 | void setup() override { 48 | register_service(&CustomNativeAPI::on_hello_world, "hello_world"); 49 | register_service(&CustomNativeAPI::on_start_dryer, "start_dryer", {"value"}); 50 | register_service(&CustomNativeAPI::on_many_values, "many_values", {"bool", "int", "float", "str1", "str2"}); 51 | subscribe_homeassistant_state(&CustomNativeAPI::on_light_state, "light.my_light"); 52 | } 53 | 54 | void on_hello_world() { ESP_LOGD("custom_api", "Hello World from native API service!"); } 55 | void on_start_dryer(int value) { ESP_LOGD("custom_api", "Value is %d", value); } 56 | void on_many_values(bool a_bool, int a_int, float a_float, std::string str1, std::string str2) { 57 | ESP_LOGD("custom_api", "Bool: %s", ONOFF(a_bool)); 58 | ESP_LOGD("custom_api", "Int: %d", a_int); 59 | ESP_LOGD("custom_api", "Float: %f", a_float); 60 | ESP_LOGD("custom_api", "String1: %s", str1.c_str()); 61 | ESP_LOGD("custom_api", "String2: %s", str2.c_str()); 62 | ESP_LOGD("custom_api", "Connected: %s", YESNO(is_connected())); 63 | 64 | call_homeassistant_service("light.turn_on", { 65 | {"entity_id", "light.my_light"}, 66 | {"brightness", "127"}, 67 | }); 68 | // no args 69 | call_homeassistant_service("homeassistant.restart"); 70 | } 71 | void on_light_state(std::string state) { ESP_LOGD("custom_api", "Got state %s", state.c_str()); } 72 | }; 73 | -------------------------------------------------------------------------------- /experiments/.gitignore: -------------------------------------------------------------------------------- 1 | # Gitignore settings for ESPHome 2 | # This is an example and may include too much for your use-case. 3 | # You can modify this file to suit your needs. 4 | /.esphome/ 5 | **/.pioenvs/ 6 | **/.piolibdeps/ 7 | **/lib/ 8 | **/src/ 9 | **/platformio.ini 10 | 11 | 12 | !/web-spa-react/ -------------------------------------------------------------------------------- /experiments/eh-rfid-test.yaml: -------------------------------------------------------------------------------- 1 | substitutions: 2 | device_name: eh-rfid-test 3 | friendly_name: RFID Board 4 | 5 | esp32: 6 | board: nodemcu-32s 7 | framework: 8 | type: esp-idf 9 | 10 | esphome: 11 | name: "${device_name}" 12 | platformio_options: 13 | upload_speed: 921600 14 | 15 | binary_sensor: 16 | - platform: status 17 | name: "${friendly_name} Status" 18 | - platform: gpio 19 | pin: GPIO36 20 | name: GPIO36 NCL 21 | - platform: gpio 22 | pin: GPIO39 23 | name: GPIO39 NCM 24 | 25 | ota: 26 | - platform: esphome 27 | 28 | ethernet: 29 | type: LAN8720 30 | mdc_pin: GPIO23 31 | mdio_pin: GPIO18 32 | clk_mode: GPIO0_IN 33 | phy_addr: 1 34 | power_pin: 35 | number: GPIO17 36 | allow_other_uses: true 37 | 38 | #enable_mdns: true 39 | 40 | # Example configuration entry 41 | i2c: 42 | sda: GPIO14 43 | scl: GPIO13 44 | 45 | text_sensor: 46 | - platform: ethernet_info 47 | ip_address: 48 | name: ESP IP Address 49 | address_0: 50 | name: ESP IP Address 0 51 | id: eth_ip 52 | 53 | display: 54 | - platform: ssd1306_i2c 55 | model: "SSD1306 128x64" 56 | #reset_pin: D0 57 | address: 0x3C 58 | rotation: 180 59 | lambda: |- 60 | it.print(0, 0, id(roboto), "Pampa Tech"); 61 | it.print(0, 20, id(roboto), ""); 62 | it.print(0, 40, id(roboto), id(eth_ip).state.c_str()); 63 | font: 64 | - file: "gfonts://Roboto" 65 | id: roboto 66 | size: 20 67 | 68 | - file: 69 | type: gfonts 70 | family: Roboto 71 | weight: 900 72 | id: font2 73 | size: 16 74 | 75 | rtttl: 76 | output: rtttl_out 77 | id: my_rtttl 78 | gain: 60% 79 | 80 | interval: 81 | - interval: 100ms 82 | then: 83 | - lambda: > 84 | static int ip_length; 85 | int new_ip_length = id(eth_ip).state.length(); 86 | if (new_ip_length != ip_length) 87 | id(my_rtttl).play("scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b"); 88 | ip_length = new_ip_length; 89 | 90 | switch: 91 | - platform: gpio 92 | pin: GPIO16 93 | name: GPIO16 Solid State Relay 94 | - platform: gpio 95 | pin: GPIO12 96 | restore_mode: RESTORE_DEFAULT_ON 97 | name: GPIO12 LED 98 | 99 | output: 100 | - platform: ledc 101 | id: rtttl_out 102 | pin: 103 | number: GPIO15 104 | - platform: gpio 105 | id: GIPIO17_output 106 | pin: 107 | number: GPIO17 108 | allow_other_uses: true 109 | 110 | web_server: 111 | version: 3 112 | js_url: https://oi.esphome.io/v3/www.js 113 | 114 | ads1115: 115 | - address: 0x48 116 | sensor: 117 | - platform: ads1115 118 | multiplexer: "A0_GND" 119 | gain: 6.144 120 | name: "ADS1115 Channel A0-GND" 121 | - platform: ads1115 122 | multiplexer: "A1_GND" 123 | gain: 6.144 124 | name: "ADS1115 Channel A1-GND" 125 | - platform: ads1115 126 | multiplexer: "A2_GND" 127 | gain: 6.144 128 | name: "ADS1115 Channel A2-GND" 129 | - platform: ads1115 130 | multiplexer: "A3_GND" 131 | gain: 6.144 132 | name: "ADS1115 Channel A3-GND" 133 | 134 | - platform: ina219 135 | address: 0x40 136 | shunt_resistance: 0.1 ohm 137 | current: 138 | name: "INA219 Current" 139 | power: 140 | name: "INA219 Power" 141 | bus_voltage: 142 | name: "INA219 Bus Voltage" 143 | shunt_voltage: 144 | name: "INA219 Shunt Voltage" 145 | max_voltage: 32.0V 146 | max_current: 3.2A 147 | update_interval: 5s 148 | 149 | - platform: uptime 150 | name: ${friendly_name} uptime 151 | 152 | uart: 153 | - id: uart_1 154 | baud_rate: 9600 155 | rx_pin: GPIO35 156 | tx_pin: GPIO33 157 | debug: 158 | direction: RX 159 | dummy_receiver: true 160 | after: 161 | delimiter: "\r" 162 | sequence: 163 | - lambda: UARTDebug::log_string(direction, bytes); 164 | 165 | button: 166 | - platform: restart 167 | on_press: 168 | then: 169 | - output.turn_off: GIPIO17_output 170 | name: ${friendly_name} restart 171 | 172 | - platform: template 173 | name: "[I] info" 174 | on_press: 175 | then: 176 | uart.write: "[I]" 177 | 178 | - platform: template 179 | name: "[S] single mode" 180 | on_press: 181 | then: 182 | uart.write: "[S]" 183 | 184 | - platform: template 185 | name: "[D] duplicate mode" 186 | on_press: 187 | then: 188 | uart.write: "[D]" 189 | 190 | - platform: template 191 | name: "[W100]" 192 | on_press: 193 | then: 194 | uart.write: "[W100]" 195 | 196 | - platform: template 197 | name: "[W101]" 198 | on_press: 199 | then: 200 | uart.write: "[W101]" 201 | 202 | logger: 203 | logs: 204 | component: ERROR 205 | 206 | api: 207 | -------------------------------------------------------------------------------- /experiments/ina219.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: esp-wrover-kit 5 | build_path: builds 6 | platformio_options: 7 | upload_speed: 921600 8 | 9 | wifi: 10 | ssid: !secret wifi_ssid 11 | password: !secret wifi_pass 12 | fast_connect: true 13 | 14 | logger: 15 | level: DEBUG 16 | 17 | ota: 18 | 19 | api: 20 | 21 | # display: 22 | # platform: tm1637 23 | # id: tm1637_display 24 | # dio_pin: D7 25 | # clk_pin: D6 26 | # lambda: |- 27 | # auto time = id(sntp_time).now(); 28 | # it.strftime("%H.%M", time); 29 | 30 | i2c: 31 | scl: GPIO13 32 | sda: GPIO14 33 | 34 | sensor: 35 | - platform: ina219 36 | address: 0x40 37 | shunt_resistance: 0.1 ohm 38 | 39 | current: 40 | name: "INA219 Current" 41 | power: 42 | name: "INA219 Power" 43 | bus_voltage: 44 | name: "INA219 Bus Voltage" 45 | shunt_voltage: 46 | name: "INA219 Shunt Voltage" 47 | max_voltage: 32.0V 48 | max_current: 3.2A 49 | update_interval: 3s 50 | # interval: 51 | # interval: 1s 52 | # then: 53 | # logger.log: 54 | # format: '' 55 | -------------------------------------------------------------------------------- /experiments/pesp_base.package.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | platform: ESP32 4 | board: esp-wrover-kit 5 | build_path: builds 6 | platformio_options: 7 | upload_speed: 921600 8 | 9 | wifi: 10 | ssid: !secret wifi_ssid 11 | password: !secret wifi_pass 12 | fast_connect: true 13 | 14 | logger: 15 | level: DEBUG 16 | 17 | ota: 18 | 19 | api: 20 | services: 21 | - service: set_q 22 | variables: 23 | level_percent: int 24 | frequency_hz: int 25 | then: 26 | - logger.log: 27 | format: "Setting level: %d freq: %d" 28 | args: [level_percent, frequency_hz] 29 | - output.ledc.set_frequency: 30 | id: pwm_power 31 | frequency: !lambda "return frequency_hz;" 32 | - output.set_level: 33 | id: pwm_power 34 | level: !lambda "return level_percent / 100.0;" 35 | 36 | i2c: 37 | scl: GPIO13 38 | sda: GPIO14 39 | scan: true 40 | 41 | pcf8574: 42 | - id: main 43 | address: 0x3F 44 | - id: aux 45 | address: 0x3B 46 | 47 | ads1115: 48 | address: 0x48 49 | 50 | status_led: 51 | pin: GPIO12 52 | 53 | output: 54 | - platform: mcp4725 55 | address: 0x60 56 | id: AQ0 57 | - platform: mcp4725 58 | address: 0x61 59 | id: AQ1 60 | - platform: ledc 61 | id: pwm_power 62 | pin: GPIO15 63 | 64 | light: 65 | - platform: monochromatic 66 | output: AQ0 67 | name: AQ0_Light 68 | 69 | - platform: monochromatic 70 | output: AQ1 71 | name: AQ1_Light 72 | 73 | sensor: 74 | - platform: ads1115 75 | multiplexer: A0_GND 76 | gain: 6.144 77 | name: AnalogA0 78 | update_interval: 5s 79 | 80 | - platform: ads1115 81 | multiplexer: A1_GND 82 | gain: 6.144 83 | name: AnalogA1 84 | update_interval: 5s 85 | 86 | - platform: ads1115 87 | multiplexer: A2_GND 88 | gain: 6.144 89 | name: AnalogA2 90 | update_interval: 5s 91 | 92 | - platform: ads1115 93 | multiplexer: A3_GND 94 | gain: 6.144 95 | name: AnalogA3 96 | update_interval: 5s 97 | 98 | switch: 99 | - platform: gpio 100 | name: Aux1Command 101 | pin: 102 | number: GPIO4 103 | mode: OUTPUT 104 | - platform: gpio 105 | name: Aux2Command 106 | pin: 107 | number: GPIO5 108 | mode: OUTPUT 109 | 110 | - platform: gpio 111 | name: PinCommand 112 | pin: 113 | pcf8574: aux 114 | number: 0 115 | mode: OUTPUT 116 | - platform: gpio 117 | name: LifterCommand 118 | pin: 119 | pcf8574: aux 120 | number: 1 121 | mode: OUTPUT 122 | - platform: gpio 123 | name: BreakCommand 124 | pin: 125 | pcf8574: aux 126 | number: 2 127 | mode: OUTPUT 128 | - platform: gpio 129 | name: MasterCommand 130 | pin: 131 | pcf8574: aux 132 | number: 3 133 | mode: OUTPUT 134 | -------------------------------------------------------------------------------- /experiments/pesp_button.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | platform: ESP32 4 | board: esp-wrover-kit 5 | build_path: builds 6 | platformio_options: 7 | upload_speed: 921600 8 | 9 | wifi: 10 | ssid: !secret wifi_ssid 11 | password: !secret wifi_pass 12 | fast_connect: true 13 | 14 | logger: 15 | level: DEBUG 16 | 17 | ota: 18 | 19 | api: 20 | services: 21 | - service: set_q 22 | variables: 23 | level_percent: int 24 | frequency_hz: int 25 | then: 26 | - logger.log: 27 | format: "Setting level: %d freq: %d" 28 | args: [level_percent, frequency_hz] 29 | - output.ledc.set_frequency: 30 | id: pwm_power 31 | frequency: !lambda "return frequency_hz;" 32 | - output.set_level: 33 | id: pwm_power 34 | level: !lambda "return level_percent / 100.0;" 35 | 36 | i2c: 37 | scl: GPIO13 38 | sda: GPIO14 39 | scan: true 40 | 41 | pcf8574: 42 | - id: main 43 | address: 0x3F 44 | - id: aux 45 | address: 0x3B 46 | 47 | ads1115: 48 | address: 0x48 49 | 50 | status_led: 51 | pin: GPIO12 52 | 53 | output: 54 | - platform: mcp4725 55 | address: 0x60 56 | id: AQ0 57 | - platform: mcp4725 58 | address: 0x61 59 | id: AQ1 60 | - platform: ledc 61 | id: pwm_power 62 | pin: GPIO15 63 | 64 | light: 65 | - platform: monochromatic 66 | output: AQ0 67 | name: AQ0_Light 68 | 69 | - platform: monochromatic 70 | output: AQ1 71 | name: AQ1_Light 72 | 73 | sensor: 74 | - platform: ads1115 75 | multiplexer: A0_GND 76 | gain: 6.144 77 | name: AnalogA0 78 | update_interval: 5s 79 | 80 | - platform: ads1115 81 | multiplexer: A1_GND 82 | gain: 6.144 83 | name: AnalogA1 84 | update_interval: 5s 85 | 86 | - platform: ads1115 87 | multiplexer: A2_GND 88 | gain: 6.144 89 | name: AnalogA2 90 | update_interval: 5s 91 | 92 | - platform: ads1115 93 | multiplexer: A3_GND 94 | gain: 6.144 95 | name: AnalogA3 96 | update_interval: 5s 97 | 98 | switch: 99 | - platform: gpio 100 | name: Aux1Command 101 | pin: 102 | number: GPIO4 103 | mode: OUTPUT 104 | - platform: gpio 105 | name: Aux2Command 106 | pin: 107 | number: GPIO5 108 | mode: OUTPUT 109 | 110 | - platform: gpio 111 | name: PinCommand 112 | pin: 113 | pcf8574: aux 114 | number: 0 115 | mode: OUTPUT 116 | - platform: gpio 117 | name: LifterCommand 118 | pin: 119 | pcf8574: aux 120 | number: 1 121 | mode: OUTPUT 122 | - platform: gpio 123 | name: BreakCommand 124 | pin: 125 | pcf8574: aux 126 | number: 2 127 | mode: OUTPUT 128 | - platform: gpio 129 | name: MasterCommand 130 | pin: 131 | pcf8574: aux 132 | number: 3 133 | mode: OUTPUT 134 | -------------------------------------------------------------------------------- /experiments/pesp_omotor.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | platform: ESP32 4 | board: esp-wrover-kit 5 | build_path: builds 6 | platformio_options: 7 | upload_speed: 921600 8 | 9 | wifi: 10 | ssid: !secret wifi_ssid 11 | password: !secret wifi_pass 12 | fast_connect: true 13 | 14 | logger: 15 | level: DEBUG 16 | 17 | ota: 18 | - platform: esphome 19 | 20 | i2c: 21 | scl: GPIO13 22 | sda: GPIO14 23 | scan: true 24 | 25 | pca9554: 26 | - id: shield_pca 27 | address: 0x21 28 | pin_count: 16 29 | 30 | binary_sensor: 31 | - platform: gpio 32 | name: ALARM_L J7 1 33 | pin: 34 | pca9554: shield_pca 35 | number: 14 36 | mode: INPUT 37 | - platform: gpio 38 | name: ALARM_R J6 1 39 | pin: 40 | pca9554: shield_pca 41 | number: 15 42 | mode: INPUT 43 | - platform: gpio 44 | name: Pin Up CN3 9 45 | pin: 46 | pca9554: shield_pca 47 | number: 0 48 | mode: INPUT 49 | - platform: gpio 50 | name: Pin Down CN3 10 51 | pin: 52 | pca9554: shield_pca 53 | number: 1 54 | mode: INPUT 55 | - platform: gpio 56 | name: Lifter Up CN3 11 57 | pin: 58 | pca9554: shield_pca 59 | number: 2 60 | mode: INPUT 61 | - platform: gpio 62 | name: Lifter Down CN3 12 63 | pin: 64 | pca9554: shield_pca 65 | number: 3 66 | mode: INPUT 67 | 68 | ads1115: 69 | - address: 0x48 70 | id: base_ads1115 71 | - address: 0x49 72 | id: shield_ads1115 73 | 74 | status_led: 75 | pin: GPIO12 76 | 77 | output: 78 | - platform: mcp4725 79 | address: 0x60 80 | id: AQ0 81 | - platform: mcp4725 82 | address: 0x61 83 | id: AQ1 84 | - platform: ledc 85 | id: pwm_power 86 | pin: GPIO15 87 | 88 | light: 89 | - platform: monochromatic 90 | output: AQ0 91 | name: AQ0_Light J7 5 92 | 93 | - platform: monochromatic 94 | output: AQ1 95 | name: AQ1_Light J6 5 96 | 97 | sensor: 98 | - platform: ads1115 99 | ads1115_id: base_ads1115 100 | multiplexer: A0_GND 101 | gain: 6.144 102 | name: AnalogA0 103 | update_interval: 5s 104 | 105 | - platform: ads1115 106 | ads1115_id: base_ads1115 107 | multiplexer: A1_GND 108 | gain: 6.144 109 | name: AnalogA1 110 | update_interval: 5s 111 | 112 | - platform: ads1115 113 | ads1115_id: base_ads1115 114 | multiplexer: A2_GND 115 | gain: 6.144 116 | name: AnalogA2 117 | update_interval: 5s 118 | 119 | - platform: ads1115 120 | ads1115_id: base_ads1115 121 | multiplexer: A3_GND 122 | gain: 6.144 123 | name: AnalogA3 124 | update_interval: 5s 125 | 126 | - platform: ads1115 127 | ads1115_id: shield_ads1115 128 | multiplexer: A0_GND 129 | gain: 6.144 130 | name: SAnalogA0 131 | update_interval: 1s 132 | 133 | - platform: ads1115 134 | ads1115_id: shield_ads1115 135 | multiplexer: A1_GND 136 | gain: 6.144 137 | name: SAnalogA1 138 | update_interval: 1s 139 | 140 | - platform: ads1115 141 | ads1115_id: shield_ads1115 142 | multiplexer: A2_GND 143 | gain: 6.144 144 | name: SAnalogA2 145 | update_interval: 1s 146 | 147 | - platform: ads1115 148 | ads1115_id: shield_ads1115 149 | multiplexer: A3_GND 150 | gain: 6.144 151 | name: SAnalogA3 152 | update_interval: 1s 153 | 154 | switch: 155 | - platform: gpio 156 | name: Run Brake L J7 10 157 | pin: 158 | pca9554: shield_pca 159 | number: 8 160 | mode: OUTPUT 161 | - platform: gpio 162 | name: Run Brake R J6 10 163 | pin: 164 | pca9554: shield_pca 165 | number: 9 166 | mode: OUTPUT 167 | - platform: gpio 168 | name: Start Stop L R J6J7 8 169 | pin: 170 | pca9554: shield_pca 171 | number: 10 172 | mode: OUTPUT 173 | - platform: gpio 174 | name: Alarm Reset L R J6J7 7 175 | pin: 176 | pca9554: shield_pca 177 | number: 11 178 | mode: OUTPUT 179 | - platform: gpio 180 | name: CW CCW L J7 9 181 | pin: 182 | pca9554: shield_pca 183 | number: 12 184 | mode: OUTPUT 185 | - platform: gpio 186 | name: CW CCW R J6 9 187 | pin: 188 | pca9554: shield_pca 189 | number: 13 190 | mode: OUTPUT 191 | 192 | - platform: gpio 193 | name: Aux1Command CN3 3 194 | pin: 195 | number: GPIO4 196 | mode: OUTPUT 197 | - platform: gpio 198 | name: Aux2Command CN3 4 199 | pin: 200 | number: GPIO5 201 | mode: OUTPUT 202 | 203 | - platform: gpio 204 | name: PinCommand CN3 5 205 | pin: 206 | pca9554: shield_pca 207 | number: 7 208 | mode: OUTPUT 209 | 210 | - platform: gpio 211 | name: LifterCommand CN3 6 212 | pin: 213 | pca9554: shield_pca 214 | number: 6 215 | mode: OUTPUT 216 | - platform: gpio 217 | name: BreakCommand CN3 7 218 | pin: 219 | pca9554: shield_pca 220 | number: 5 221 | mode: OUTPUT 222 | - platform: gpio 223 | name: MasterCommand CN3 8 224 | pin: 225 | pca9554: shield_pca 226 | number: 4 227 | mode: OUTPUT 228 | 229 | - platform: template 230 | name: Shield power 1Khz 231 | optimistic: True 232 | on_turn_on: 233 | then: 234 | - output.ledc.set_frequency: 235 | id: pwm_power 236 | frequency: 1000 237 | - output.set_level: 238 | id: pwm_power 239 | level: 1 240 | on_turn_off: 241 | then: 242 | - output.set_level: 243 | id: pwm_power 244 | level: 0 245 | 246 | web_server: 247 | version: 3 248 | js_url: https://oi.esphome.io/v3/www.js 249 | -------------------------------------------------------------------------------- /experiments/pesp_os32c.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | build_path: builds 4 | platformio_options: 5 | upload_speed: 921600 6 | 7 | esp32: 8 | board: wt32-eth01 9 | framework: 10 | type: arduino 11 | 12 | wifi: 13 | ssid: !secret wifi_ssid 14 | password: !secret wifi_pass 15 | fast_connect: true 16 | 17 | logger: 18 | level: DEBUG 19 | 20 | ota: 21 | 22 | i2c: 23 | scl: GPIO13 24 | sda: GPIO14 25 | scan: true 26 | 27 | ads1115: 28 | - address: 0x48 29 | id: ads0 30 | continuous_mode: true 31 | 32 | - address: 0x49 33 | id: ads1 34 | continuous_mode: true 35 | 36 | status_led: 37 | pin: GPIO12 38 | 39 | sensor: 40 | - platform: ads1115 41 | ads1115_id: ads0 42 | multiplexer: A0_A1 43 | 44 | gain: 45 | name: AnalogA0 46 | update_interval: 5s 47 | 48 | - platform: ads1115 49 | ads1115_id: ads0 50 | multiplexer: A1_GND 51 | gain: 4.096 52 | name: AnalogA1 53 | update_interval: 5s 54 | 55 | - platform: ads1115 56 | ads1115_id: ads0 57 | multiplexer: A2_GND 58 | gain: 4.096 59 | name: AnalogA2 60 | update_interval: 5s 61 | 62 | - platform: ads1115 63 | ads1115_id: ads0 64 | multiplexer: A3_GND 65 | gain: 4.096 66 | name: AnalogA3 67 | update_interval: 5s 68 | 69 | # - platform: ads1115 70 | # ads1115_id: ads1 71 | # multiplexer: A0_GND 72 | # gain: 4.096 73 | # name: AnalogB0 74 | # update_interval: 5s 75 | 76 | # - platform: ads1115 77 | # ads1115_id: ads1 78 | # multiplexer: A1_GND 79 | # gain: 4.096 80 | # name: AnalogB1 81 | # update_interval: 5s 82 | 83 | # - platform: ads1115 84 | # ads1115_id: ads1 85 | # multiplexer: A2_GND 86 | # gain: 4.096 87 | # name: AnalogB2 88 | # update_interval: 5s 89 | 90 | # - platform: ads1115 91 | # ads1115_id: ads1 92 | # multiplexer: A3_GND 93 | # gain: 4.096 94 | # name: AnalogB3 95 | # update_interval: 5s 96 | 97 | - platform: ina219 98 | address: 0x40 99 | shunt_resistance: 0.1 ohm 100 | current: 101 | name: "INA219 Current" 102 | power: 103 | name: "INA219 Power" 104 | bus_voltage: 105 | name: "INA219 Bus Voltage" 106 | shunt_voltage: 107 | name: "INA219 Shunt Voltage" 108 | max_voltage: 32.0V 109 | max_current: 3.2A 110 | update_interval: 5s 111 | -------------------------------------------------------------------------------- /experiments/rc522_i2c.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | # If buzzer is enabled, notify on api connection success 9 | on_boot: 10 | priority: -10 11 | then: 12 | - wait_until: 13 | api.connected: 14 | - logger.log: API is connected! 15 | - rtttl.play: "success:d=24,o=5,b=100:c,g,b" 16 | 17 | output: 18 | - platform: esp8266_pwm 19 | pin: D0 20 | id: buzzer 21 | 22 | # Define buzzer as output for RTTTL 23 | rtttl: 24 | output: buzzer 25 | 26 | wifi: 27 | ssid: !secret wifi_ssid 28 | password: !secret wifi_pass 29 | 30 | # Enable logging 31 | logger: 32 | level: DEBUG 33 | 34 | # Enable OTA updates 35 | ota: 36 | 37 | # spi: 38 | # clk_pin: D5 39 | # miso_pin: D6 40 | # mosi_pin: D7 41 | 42 | api: 43 | 44 | i2c: 45 | scan: true 46 | 47 | rc522_i2c: 48 | address: 0x28 49 | reset_pin: D3 50 | on_tag: 51 | then: 52 | - homeassistant.tag_scanned: !lambda "return x;" 53 | - rtttl.play: "success:d=24,o=5,b=100:c,g,b" 54 | 55 | binary_sensor: 56 | # - platform: rc522 57 | # uid: 84-52-FB-01 58 | # id: x 59 | # on_press: 60 | # - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" 61 | 62 | # on_release: 63 | # - rtttl.play: "scale_down:d=32,o=5,b=100:b,a#,g#,f#,e,d#,c#,c" 64 | - platform: rc522 65 | uid: CA-BE-41-CE 66 | id: y 67 | on_press: 68 | - rtttl.play: "MissionImp:d=16,o=6,b=95:32d,32d#,32d,32d#,32d,32d#,32d,32d#,32d,32d,32d#,32e,32f,32f#,32g,g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#,p,g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#,p,a#,g,2d,32p,a#,g,2c#,32p,a#,g,2c,a#5,8c,2p,32p,a#5,g5,2f#,32p,a#5,g5,2f,32p,a#5,g5,2e,d#,8d" 69 | -------------------------------------------------------------------------------- /experiments/rc522_spi.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | # If buzzer is enabled, notify on api connection success 9 | on_boot: 10 | priority: -10 11 | then: 12 | - wait_until: 13 | api.connected: 14 | - logger.log: API is connected! 15 | - rtttl.play: "success:d=24,o=5,b=100:c,g,b" 16 | 17 | output: 18 | - platform: esp8266_pwm 19 | pin: D3 20 | id: buzzer 21 | - platform: esp8266_pwm 22 | pin: D1 23 | id: servo_output 24 | 25 | # Define buzzer as output for RTTTL 26 | rtttl: 27 | output: buzzer 28 | 29 | wifi: 30 | ssid: !secret wifi_ssid 31 | password: !secret wifi_pass 32 | 33 | # Enable logging 34 | logger: 35 | level: DEBUG 36 | logs: 37 | api: DEBUG 38 | spi: DEBUG 39 | 40 | # # Enable OTA updates 41 | ota: 42 | 43 | spi: 44 | clk_pin: D5 45 | miso_pin: D6 46 | mosi_pin: D7 47 | 48 | api: 49 | 50 | servo: 51 | output: servo_output 52 | id: servo_1 53 | 54 | rc522_spi: 55 | reset_pin: D0 56 | cs_pin: D8 57 | update_interval: 2s 58 | on_tag: 59 | then: 60 | - homeassistant.tag_scanned: !lambda "return x;" 61 | - if: 62 | condition: 63 | not: 64 | rtttl.is_playing: 65 | then: 66 | - rtttl.play: "success:d=24,o=5,b=100:c,g,b" 67 | 68 | binary_sensor: 69 | - platform: rc522 70 | uid: 84-52-FB-01 71 | id: x 72 | on_press: 73 | - rtttl.play: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" 74 | 75 | on_release: 76 | - rtttl.play: "scale_down:d=32,o=5,b=100:b,a#,g#,f#,e,d#,c#,c" 77 | - platform: rc522 78 | uid: CA-BE-41-CE 79 | id: y 80 | on_press: 81 | #- rtttl.play: "MissionImp:d=16,o=6,b=95:32d,32d#,32d,32d#,32d,32d#,32d,32d#,32d,32d,32d#,32e,32f,32f#,32g,g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#,p,g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#,p,a#,g,2d,32p,a#,g,2c#,32p,a#,g,2c,a#5,8c,2p,32p,a#5,g5,2f#,32p,a#5,g5,2f,32p,a#5,g5,2e,d#,8d" 82 | - logger.log: "Start servo change" 83 | - servo.write: 84 | id: servo_1 85 | level: 50% 86 | - delay: 2s 87 | - logger.log: "Done" 88 | - servo.detach: servo_1 89 | - logger.log: "Detached" 90 | -------------------------------------------------------------------------------- /experiments/sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/experiments/sample.gif -------------------------------------------------------------------------------- /experiments/secrets.yaml: -------------------------------------------------------------------------------- 1 | !include ../secrets.yaml 2 | -------------------------------------------------------------------------------- /experiments/test-ac-dimmer.yaml: -------------------------------------------------------------------------------- 1 | esp8266: 2 | board: nodemcuv2 3 | 4 | esphome: 5 | name: test-ac-dimmer 6 | platformio_options: 7 | upload_speed: 921600 8 | 9 | output: 10 | - platform: ac_dimmer 11 | gate_pin: GPIO12 12 | zero_cross_pin: 13 | number: GPIO13 14 | mode: 15 | input: true 16 | pullup: True 17 | id: dimmer1 18 | 19 | light: 20 | - platform: monochromatic 21 | output: dimmer1 22 | name: light 23 | 24 | wifi: 25 | ssid: !secret wifi_ssid 26 | password: !secret wifi_pass 27 | 28 | web_server: 29 | 30 | logger: 31 | level: VERBOSE 32 | 33 | api: 34 | -------------------------------------------------------------------------------- /experiments/test-ape-fail-sensor.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-ape 3 | 4 | esp8266: 5 | board: nodemcuv2 6 | 7 | external_components: 8 | - source: github://glmnet/esphome-components 9 | components: [arduino_port_expander] 10 | refresh: 0s 11 | 12 | i2c: 13 | 14 | logger: 15 | 16 | arduino_port_expander: 17 | id: ape1 18 | 19 | binary_sensor: 20 | - platform: gpio 21 | pin: 22 | arduino_port_expander: ape1 23 | number: 12 24 | mode: 25 | input: True 26 | pullup: True 27 | name: bs-12 28 | id: ape_12 29 | 30 | wifi: 31 | ssid: !secret wifi_ssid 32 | password: !secret wifi_pass 33 | 34 | sensor: 35 | - platform: wifi_signal 36 | name: wifi 37 | - platform: arduino_port_expander 38 | id: sx 39 | pin: A0 40 | name: Ardu A0 41 | update_interval: 10s 42 | -------------------------------------------------------------------------------- /experiments/test-ape.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-ape 3 | platformio_options: 4 | upload_speed: 921600 5 | # on_boot: 6 | # then: 7 | # - delay: 2s 8 | # - light.turn_on: 9 | # id: l1 10 | # effect: Strobe 11 | 12 | # Enable logging 13 | logger: 14 | level: DEBUG 15 | logs: 16 | i2c: DEBUG 17 | 18 | esp8266: 19 | restore_from_flash: True 20 | board: nodemcuv2 21 | 22 | wifi: 23 | ssid: !secret wifi_ssid 24 | password: !secret wifi_pass 25 | 26 | # Enable Home Assistant API 27 | api: 28 | 29 | ota: 30 | 31 | i2c: 32 | 33 | arduino_port_expander: 34 | id: x 35 | address: 0x08 36 | analog_reference: DEFAULT 37 | 38 | binary_sensor: 39 | - platform: gpio 40 | pin: 41 | arduino_port_expander: x 42 | number: 12 43 | mode: 44 | input: True 45 | pullup: True 46 | name: bs-12 47 | id: ape_12 48 | on_state: 49 | then: 50 | - light.toggle: l1 51 | 52 | output: 53 | - platform: gpio 54 | pin: 55 | arduino_port_expander: x 56 | number: 13 57 | mode: 58 | output: True 59 | id: ape_13 60 | 61 | sensor: 62 | - platform: arduino_port_expander 63 | id: sx 64 | pin: A0 65 | name: Ardu A0 66 | update_interval: 10s 67 | filters: 68 | - multiply: 0.0032258064516129 # x / 1023.0 * 3.3 v 69 | 70 | preferences: 71 | flash_write_interval: 5s 72 | 73 | button: 74 | - platform: restart 75 | name: Test Restart 76 | 77 | light: 78 | - platform: binary 79 | name: light pin 13 80 | output: ape_13 81 | effects: 82 | - strobe: 83 | name: Strobe 84 | id: l1 85 | restore_mode: RESTORE_DEFAULT_OFF 86 | -------------------------------------------------------------------------------- /experiments/test-completions.yaml: -------------------------------------------------------------------------------- 1 | esp32: 2 | board: esp32doit-devkit-v1 3 | framework: 4 | type: arduino 5 | 6 | 7 | esphome: 8 | name: lala 9 | comment: |- 10 | Testing long block of text 11 | this is a block 12 | quote long description 13 | text 14 | 15 | thinghy 16 | 17 | 18 | script: 19 | - id: x1 # comment after text 20 | then: 21 | - dfplayer.play: 22 | file: !lambda return 32; 23 | loop: !lambda |- # comment 24 | return true; 25 | - dfplayer.set_volume: 26 | id: df1 27 | volume: !lambda return (32); 28 | - media_player.play: pepex 29 | - script.execute: |- # comment 30 | x1 31 | # this is green comment and must be brown above 32 | - lambda: return id(x1).execute(); 33 | code // below lambda, invalid? without | or > 34 | - lambda: 'return id(x1).execute();' 35 | - lambda: "return id(x1)/* WOW */.execute(); // comment in " # comment out 36 | 37 | - delay: "10s" 38 | - lambda: !lambda |- # comment 39 | /* Comment block 40 | */ 41 | id(x1).execute(); 42 | return id(x1).execute(); 43 | prep: lkjasfd 44 | 45 | lskjdf l 46 | while (true) { do const int [ volatile ] }; 47 | 48 | - lambda: >- # comment 49 | return id(x1).execute(); 50 | // id(x1).execute(); 51 | - lambda: |- # comment 52 | id(x1).execute(); 53 | - lambda: !lambda return id(x1).execute(); 54 | 55 | 56 | media_player: 57 | - platform: i2s_audio 58 | dac_type: external 59 | mode: stereo 60 | id: pepex 61 | i2s_bclk_pin: GPIO22 62 | i2s_dout_pin: GPIO21 63 | i2s_lrclk_pin: GPIO19 64 | 65 | 66 | uart: 67 | - baud_rate: 9600 68 | tx_pin: GPIO3 69 | id: ux1 70 | 71 | dfplayer: 72 | - uart_id: ux1 73 | id: df1 74 | -------------------------------------------------------------------------------- /experiments/test-dsmr-esp32.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | platformio_options: 4 | upload_speed: 921600 5 | 6 | packages: 7 | wifi: !include ../package.wifi.yaml 8 | 9 | esp32: 10 | framework: 11 | type: esp-idf 12 | board: esp32-c3-devkitm-1 13 | 14 | api: 15 | 16 | ota: 17 | 18 | logger: 19 | level: VERY_VERBOSE 20 | logs: 21 | uart.arduino_esp8266: DEBUG 22 | uart.idf: DEBUG 23 | api.service: DEBUG 24 | 25 | uart: 26 | baud_rate: 115200 27 | rx_pin: GPIO20 28 | 29 | dsmr: 30 | #decryption_key: !secret decryption_key 31 | crc_check: true 32 | gas_mbus_id: 2 33 | 34 | sensor: 35 | - platform: dsmr 36 | energy_delivered_tariff1: 37 | name: dsmr_energy_delivered_tariff1 38 | energy_delivered_lux: 39 | name: dsmr_energy_delivered_tarifflux 40 | gas_delivered: 41 | name: dsmr_gas_delivered 42 | 43 | text_sensor: 44 | - platform: dsmr 45 | # identification: 46 | # name: "dsmr_identification" 47 | # p1_version: 48 | # name: "dsmr_p1_version" 49 | gas_delivered_text: 50 | name: "gas delivered raw" 51 | 52 | external_components: 53 | source: github://glmnet/esphome@new-dsmr 54 | components: dsmr 55 | -------------------------------------------------------------------------------- /experiments/test-dsmr-esp8266.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp8266 3 | platformio_options: 4 | upload_speed: 921600 5 | 6 | packages: 7 | wifi: !include ../package.wifi.yaml 8 | 9 | esp8266: 10 | board: nodemcu 11 | 12 | api: 13 | 14 | ota: 15 | 16 | logger: 17 | level: VERY_VERBOSE 18 | logs: 19 | uart.arduino_esp8266: DEBUG 20 | uart.idf: DEBUG 21 | api.service: DEBUG 22 | 23 | uart: 24 | baud_rate: 115200 25 | rx_pin: RX 26 | 27 | dsmr: 28 | decryption_key: !secret decryption_key 29 | crc_check: true 30 | gas_mbus_id: 2 31 | 32 | sensor: 33 | - platform: dsmr 34 | energy_delivered_tariff1: 35 | name: dsmr_energy_delivered_tariff1 36 | energy_delivered_lux: 37 | name: dsmr_energy_delivered_tarifflux 38 | 39 | text_sensor: 40 | - platform: dsmr 41 | # identification: 42 | # name: "dsmr_identification" 43 | # p1_version: 44 | # name: "dsmr_p1_version" 45 | gas_delivered_text: 46 | name: "gas delivered raw" 47 | # external_components: 48 | # source: github://glmnet/esphome@dsmr-updates 49 | # components: dsmr 50 | 51 | -------------------------------------------------------------------------------- /experiments/test-esp32-c3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | substitutions: 3 | device_name: test-esp32-c3 4 | device_description: "Just testing the ESP32 C3" 5 | 6 | esphome: 7 | name: ${device_name} 8 | comment: "${device_description}" 9 | platformio_options: 10 | upload_speed: 921600 11 | board_build.flash_mode: dio 12 | 13 | logger: 14 | level: DEBUG 15 | 16 | esp32: 17 | variant: esp32c3 18 | board: ESP32-C3-DevKitM-1 19 | framework: 20 | type: esp-idf 21 | 22 | light: 23 | - platform: rgb 24 | name: "onboard-led" 25 | red: output_component1 26 | green: output_component2 27 | blue: output_component3 28 | 29 | - platform: monochromatic 30 | name: "onboard-ledc" 31 | output: output_ledc 32 | 33 | - platform: monochromatic 34 | name: "onboard-ledw" 35 | output: output_ledw 36 | 37 | # Example output entry 38 | output: 39 | - platform: ledc 40 | id: output_component1 41 | pin: GPIO3 42 | - platform: ledc 43 | id: output_component2 44 | pin: GPIO4 45 | - platform: ledc 46 | id: output_component3 47 | pin: GPIO5 48 | 49 | - platform: ledc 50 | id: output_ledw 51 | pin: GPIO19 52 | 53 | - platform: ledc 54 | id: output_ledc 55 | pin: GPIO18 56 | 57 | wifi: 58 | ssid: !secret wifi_ssid 59 | password: !secret wifi_pass 60 | 61 | api: 62 | 63 | ota: 64 | -------------------------------------------------------------------------------- /experiments/test-esp32c3-dsmr.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: esp32c3 3 | platform: ESP32 4 | board: esp32-c3-devkitm-1 5 | platformio_options: 6 | board_build.f_cpu: 80000000L 7 | platform: https://github.com/platformio/platform-espressif32#feature/arduino-idf-master 8 | on_boot: 9 | then: 10 | - if: 11 | condition: 12 | lambda: return id(has_key); 13 | then: 14 | - lambda: |- 15 | std::string key(id(stored_decryption_key), 32); 16 | id(dsmr_instance).set_decryption_key(key); 17 | else: 18 | - logger.log: 19 | level: info 20 | format: "Not using decryption key. If you need to set a key use Home Assistant service 'ESPHome: ${device_name}_set_dsmr_key'" 21 | 22 | # Enable logging 23 | logger: 24 | 25 | # Enable Home Assistant API 26 | api: 27 | services: 28 | service: set_dsmr_key 29 | variables: 30 | private_key: string 31 | then: 32 | - logger.log: 33 | format: Setting private key %s. Set to empty string to disable 34 | args: [private_key.c_str()] 35 | - globals.set: 36 | id: has_key 37 | value: !lambda "return private_key.length() == 32;" 38 | - lambda: |- 39 | if (private_key.length() == 32) 40 | private_key.copy(id(stored_decryption_key), 32); 41 | id(dsmr_instance).set_decryption_key(private_key); 42 | 43 | ota: 44 | password: "e927baf1b822ebe698d18b07dec266d6" 45 | 46 | web_server: 47 | port: 80 48 | 49 | uart: 50 | baud_rate: 115200 51 | #rx_pin: GPIO20 52 | rx_pin: RX 53 | 54 | wifi: 55 | ssid: "iRouter" 56 | password: "Sunshine.1010" 57 | 58 | # Enable fallback hotspot (captive portal) in case wifi connection fails 59 | ap: 60 | ssid: "Esp32C3 Fallback Hotspot" 61 | password: "K5AY5Ta90RQF" 62 | 63 | captive_portal: 64 | 65 | globals: 66 | - id: has_key 67 | type: bool 68 | restore_value: yes 69 | initial_value: "false" 70 | - id: stored_decryption_key 71 | type: char[32] 72 | restore_value: yes 73 | 74 | dsmr: 75 | id: dsmr_instance 76 | # For Luxembourg users set here your decryption key 77 | #decryption_key: !secret decryption_key // enable this when using decryption for Luxembourg; key like '00112233445566778899AABBCCDDEEFF' 78 | 79 | sensor: 80 | - platform: dsmr 81 | energy_delivered_lux: 82 | name: "Energy Consumed Luxembourg" 83 | state_class: total_increasing 84 | energy_delivered_tariff1: 85 | name: "Energy Consumed Tariff 1" 86 | state_class: total_increasing 87 | energy_delivered_tariff2: 88 | name: "Energy Consumed Tariff 2" 89 | state_class: total_increasing 90 | energy_returned_lux: 91 | name: "Energy Produced Luxembourg" 92 | state_class: total_increasing 93 | energy_returned_tariff1: 94 | name: "Energy Produced Tariff 1" 95 | state_class: total_increasing 96 | energy_returned_tariff2: 97 | name: "Energy Produced Tariff 2" 98 | state_class: total_increasing 99 | power_delivered: 100 | name: "Power Consumed" 101 | accuracy_decimals: 0 102 | filters: 103 | - multiply: 1000 104 | power_returned: 105 | name: "Power Produced" 106 | accuracy_decimals: 0 107 | filters: 108 | - multiply: 1000 109 | electricity_failures: 110 | name: "Electricity Failures" 111 | icon: mdi:alert 112 | electricity_long_failures: 113 | name: "Long Electricity Failures" 114 | icon: mdi:alert 115 | voltage_l1: 116 | name: "Voltage Phase 1" 117 | voltage_l2: 118 | name: "Voltage Phase 2" 119 | voltage_l3: 120 | name: "Voltage Phase 3" 121 | current_l1: 122 | name: "Current Phase 1" 123 | current_l2: 124 | name: "Current Phase 2" 125 | current_l3: 126 | name: "Current Phase 3" 127 | power_delivered_l1: 128 | name: "Power Consumed Phase 1" 129 | accuracy_decimals: 0 130 | filters: 131 | - multiply: 1000 132 | power_delivered_l2: 133 | name: "Power Consumed Phase 2" 134 | accuracy_decimals: 0 135 | filters: 136 | - multiply: 1000 137 | power_delivered_l3: 138 | name: "Power Consumed Phase 3" 139 | accuracy_decimals: 0 140 | filters: 141 | - multiply: 1000 142 | power_returned_l1: 143 | name: "Power Produced Phase 1" 144 | accuracy_decimals: 0 145 | filters: 146 | - multiply: 1000 147 | power_returned_l2: 148 | name: "Power Produced Phase 2" 149 | accuracy_decimals: 0 150 | filters: 151 | - multiply: 1000 152 | power_returned_l3: 153 | name: "Power Produced Phase 3" 154 | accuracy_decimals: 0 155 | filters: 156 | - multiply: 1000 157 | gas_delivered: 158 | name: "Gas Consumed" 159 | state_class: total_increasing 160 | gas_delivered_be: 161 | name: "Gas Consumed Belgium" 162 | state_class: total_increasing 163 | - platform: uptime 164 | name: "Uptime" 165 | - platform: wifi_signal 166 | name: "Wi-Fi Signal" 167 | update_interval: 60s 168 | 169 | text_sensor: 170 | - platform: dsmr 171 | identification: 172 | name: "DSMR Identification" 173 | p1_version: 174 | name: "DSMR Version" 175 | p1_version_be: 176 | name: "DSMR Version Belgium" 177 | - platform: wifi_info 178 | ip_address: 179 | name: "IP Address" 180 | ssid: 181 | name: "Wi-Fi SSID" 182 | bssid: 183 | name: "Wi-Fi BSSID" 184 | - platform: version 185 | name: "ESPHome Version" 186 | hide_timestamp: true 187 | -------------------------------------------------------------------------------- /experiments/test-gps.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | platform: ESP8266 3 | name: test-esp8266 4 | board: d1_mini 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | packages: 9 | wifi: !include ../package.wifi.yaml 10 | 11 | api: 12 | 13 | ota: 14 | 15 | logger: 16 | level: DEBUG 17 | baud_rate: 0 18 | 19 | uart: 20 | baud_rate: 9600 21 | tx_pin: GPIO15 22 | rx_pin: GPIO13 23 | 24 | i2c: 25 | - scl: GPIO5 26 | sda: GPIO4 27 | scan: true 28 | 29 | # Example configuration entry 30 | sensor: 31 | - platform: hmc5883l 32 | address: 0x1E 33 | field_strength_x: 34 | name: "HMC5883L Field Strength X" 35 | field_strength_y: 36 | name: "HMC5883L Field Strength Y" 37 | field_strength_z: 38 | name: "HMC5883L Field Strength Z" 39 | heading: 40 | name: "HMC5883L Heading" 41 | oversampling: 1x 42 | range: 130uT 43 | update_interval: 1s 44 | 45 | gps: 46 | latitude: 47 | name: gps_latitude 48 | longitude: 49 | name: gps_longitude 50 | 51 | time: 52 | - platform: gps 53 | -------------------------------------------------------------------------------- /experiments/test-prometheus.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: xx 3 | 4 | esp8266: 5 | board: d1 6 | 7 | wifi: 8 | ssid: !secret wifi_ssid 9 | 10 | sensor: 11 | - platform: template 12 | id: sensor_x 13 | 14 | - platform: template 15 | id: sensor_z4 16 | 17 | 18 | prometheus: 19 | relabel: 20 | sensor_x: 21 | id: new_id 22 | sensor_z4: 23 | name: new_id 24 | -------------------------------------------------------------------------------- /experiments/test-uda1380.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | platform: ESP32 3 | name: test-esp32 4 | board: esp32doit-devkit-v1 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | packages: 9 | wifi: !include ../package.wifi.yaml 10 | 11 | api: 12 | 13 | ota: 14 | 15 | logger: 16 | 17 | i2c: 18 | scan: true 19 | 20 | uda1380: 21 | - id: s21 22 | -------------------------------------------------------------------------------- /experiments/test.4relays.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local 3 | platform: ESP8266 4 | board: nodemcu 5 | # Use a local copy of ESPHome 6 | includes: 7 | - arduino_port_expander.h 8 | 9 | wifi: 10 | ssid: !secret wifi_ssid 11 | password: !secret wifi_pass 12 | 13 | api: 14 | 15 | ota: 16 | 17 | i2c: 18 | id: i2c_component 19 | 20 | logger: 21 | level: DEBUG 22 | 23 | 24 | custom_component: 25 | - id: ape 26 | lambda: |- 27 | auto ape_component = new ArduinoPortExpander(i2c_component, 0x08); 28 | return {ape_component}; 29 | 30 | output: 31 | - platform: custom 32 | type: binary 33 | lambda: |- 34 | return {ape_binary_output(ape, 7), 35 | ape_binary_output(ape, 6), 36 | ape_binary_output(ape, 5), 37 | ape_binary_output(ape, 4)}; 38 | outputs: 39 | - id: gpio_relay_1 40 | inverted: true 41 | - id: gpio_relay_2 42 | inverted: true 43 | - id: gpio_relay_3 44 | inverted: true 45 | - id: gpio_relay_4 46 | inverted: true 47 | 48 | light: 49 | - platform: binary 50 | id: relay1 51 | name: "Relay1" 52 | output: gpio_relay_1 53 | - platform: binary 54 | id: relay2 55 | name: "Relay2" 56 | output: gpio_relay_2 57 | - platform: binary 58 | id: relay3 59 | name: "Relay3" 60 | output: gpio_relay_3 61 | - platform: binary 62 | id: relay4 63 | name: "Relay4" 64 | output: gpio_relay_4 65 | 66 | sensor: 67 | - platform: pulse_counter 68 | pin: GPIO14 69 | name: "Pulse Counter" 70 | -------------------------------------------------------------------------------- /experiments/test.ac.wifi.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: eh_comedor_bgh 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | api: 9 | 10 | ota: 11 | 12 | wifi: 13 | ssid: !secret wifi_ssid 14 | password: !secret wifi_pass 15 | fast_connect: true 16 | 17 | # Enable logging 18 | 19 | logger: 20 | level: VERY_VERBOSE 21 | baud_rate: 0 22 | 23 | uart: 24 | tx_pin: TX 25 | rx_pin: RX 26 | baud_rate: 115200 27 | 28 | display: 29 | - platform: nextion 30 | # full_update_every : 30 31 | lambda: |- 32 | it.set_component_text_printf("t22", "%.2f", 5); 33 | // voff = voff + vstep; 34 | // it.printf( 0, voff, id(display_font), "Input: %.1f V", (input_voltage_sensor) ->state); 35 | -------------------------------------------------------------------------------- /experiments/test.aczc.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | includes: 8 | - aczc.h 9 | 10 | wifi: 11 | ssid: !secret wifi_ssid 12 | password: !secret wifi_pass 13 | 14 | api: 15 | 16 | ota: 17 | 18 | logger: 19 | level: VERBOSE 20 | 21 | binary_s,ensor: 22 | - platform: gpio 23 | name: test 24 | pin: 25 | number: D1 26 | mode: INPUT_PULLUP 27 | filters: 28 | - invert: 29 | 30 | output: 31 | - platform: gpio 32 | id: output1 33 | pin: GPIO0 34 | -------------------------------------------------------------------------------- /experiments/test.ape.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | includes: 8 | - arduino_port_expander.h 9 | 10 | wifi: 11 | ssid: !secret wifi_ssid 12 | password: !secret wifi_pass 13 | 14 | api: 15 | 16 | ota: 17 | 18 | # define i2c device 19 | # for an ESP8266 SDA is D2 and goes to Arduino's A4 20 | # SCL is D1 and goes to Arduino's A5 21 | i2c: 22 | id: i2c_component 23 | 24 | logger: 25 | level: DEBUG 26 | 27 | # define the port expander hub, here we define one with id 'expander1', but you can define many 28 | custom_component: 29 | - id: expander1 30 | lambda: |- 31 | auto expander = new ArduinoPortExpander(i2c_component, 0x08, true); 32 | return {expander}; 33 | 34 | # define binary outputs, here we have 4, as the relays are inverse logic (a path to ground turns 35 | # the relay ON), we defined the inverted: true option of ESPHome outputs. 36 | output: 37 | - platform: custom 38 | type: binary 39 | lambda: |- 40 | return {ape_binary_output(expander1, 2), 41 | ape_binary_output(expander1, 3), 42 | ape_binary_output(expander1, 4), 43 | ape_binary_output(expander1, 5)}; 44 | 45 | outputs: 46 | - id: relay_1 47 | inverted: true 48 | - id: relay_2 49 | inverted: true 50 | - id: relay_3 51 | inverted: true 52 | - id: relay_4 53 | inverted: true 54 | 55 | # connect lights to the first 2 relays 56 | light: 57 | - platform: binary 58 | id: ceiling_light 59 | name: Ceiling light 60 | output: relay_1 61 | - platform: binary 62 | id: room_light 63 | name: Living room light 64 | output: relay_2 65 | 66 | # connect a fan to the third relay 67 | fan: 68 | - platform: binary 69 | id: ceiling_fan 70 | output: relay_3 71 | name: Ceiling fan 72 | 73 | # connect a pump to the 4th relay 74 | switch: 75 | - platform: output 76 | name: Tank pump 77 | id: tank_pump 78 | output: relay_4 79 | 80 | # define binary sensors, use the Arduino PIN number for digital pins and 81 | # for analog use 14 for A0, 15 for A1 and so on... 82 | binary_sensor: 83 | - platform: custom 84 | lambda: |- 85 | return {ape_binary_sensor(expander1, 7), 86 | ape_binary_sensor(expander1, 8), 87 | ape_binary_sensor(expander1, 9), 88 | ape_binary_sensor(expander1, 10), 89 | ape_binary_sensor(expander1, 14) // 14 = A0 90 | }; 91 | 92 | binary_sensors: 93 | - id: push_button1 94 | internal: true # don't show on HA 95 | on_press: 96 | - light.toggle: ceiling_light 97 | - id: push_button2 98 | internal: true # don't show on HA 99 | on_press: 100 | - light.toggle: room_light 101 | - id: pir_sensor 102 | name: Living PIR 103 | device_class: motion 104 | - id: window_reed_switch 105 | name: Living Window 106 | device_class: window 107 | - id: garage_door 108 | name: Garage garage 109 | device_class: garage_door 110 | 111 | # define analog sensors 112 | sensor: 113 | - platform: custom 114 | lambda: |- 115 | return {ape_analog_input(expander1, 1), // 1 = A1 116 | ape_analog_input(expander1, 2)}; 117 | sensors: 118 | - name: LM35 Living room temperature 119 | id: lm35_temp 120 | filters: 121 | # update every 60s 122 | - throttle: 60s 123 | # LM35 outputs 0.01v per ºC, and 1023 means 3.3 volts 124 | - lambda: return x * 330.0 / 1023.0; 125 | - name: Analog A2 126 | id: analog_a2 127 | filters: 128 | - throttle: 2s 129 | -------------------------------------------------------------------------------- /experiments/test.api_just_connected.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local 3 | platform: ESP8266 4 | board: nodemcu 5 | includes: arduino_port_expander.h 6 | 7 | logger: 8 | level: DEBUG 9 | 10 | wifi: 11 | ssid: !secret wifi_ssid 12 | password: !secret wifi_pass 13 | 14 | api: 15 | 16 | ota: 17 | 18 | i2c: 19 | id: i2ccomponent 20 | 21 | sensor: 22 | - platform: wifi_signal 23 | name: "WiFi Signal Sensor" 24 | update_interval: 60s 25 | 26 | # remote_receiver: 27 | # id: rcvr 28 | # pin: 29 | # number: D5 30 | # inverted: True 31 | # mode: INPUT_PULLUP 32 | # dump: all 33 | 34 | # remote_transmitter: 35 | # carrier_duty_percent: 50% 36 | # pin: D6 37 | 38 | # climate: 39 | # - platform: coolix 40 | # receiver_id: rcvr 41 | # name: AC 42 | 43 | binary_sensor: 44 | # - platform: remote_receiver 45 | # name: NEC Button X 46 | # nec: 47 | # address: 0x00FF 48 | # command: 0xE21D 49 | 50 | - platform: status 51 | id: api_online 52 | on_press: 53 | then: 54 | - script.execute: api_just_connected 55 | - light.turn_on: led_green 56 | on_release: 57 | then: 58 | - light.turn_off: led_green 59 | - platform: homeassistant 60 | name: "Switch Galeria 2 from HA" 61 | entity_id: binary_sensor.switch_estudio_galeria_2 62 | on_state: 63 | then: 64 | if: 65 | condition: 66 | not: 67 | script.is_running: api_just_connected 68 | then: 69 | light.toggle: pro_mini_led 70 | else: 71 | logger.log: 'Not toggling pro_mini_led, api just connected' 72 | 73 | custom_component: 74 | - id: ape 75 | lambda: |- 76 | auto ape_component = new ArduinoPortExtender(i2ccomponent, 0x08); 77 | return {ape_component}; 78 | 79 | output: 80 | - platform: custom 81 | type: binary 82 | lambda: |- 83 | return {ape_binary_output(ape, 13)}; 84 | outputs: 85 | - id: gpio_relay_1 86 | inverted: true 87 | - platform: gpio 88 | id: gpio_d3 89 | pin: D3 90 | 91 | light: 92 | - platform: binary 93 | id: pro_mini_led 94 | name: "Pro Mini LED" 95 | output: gpio_relay_1 96 | 97 | - platform: binary 98 | id: led_green 99 | name: "Green LED" 100 | output: gpio_d3 101 | 102 | script: 103 | - id: api_just_connected 104 | then: 105 | - delay: 30s 106 | -------------------------------------------------------------------------------- /experiments/test.binary_sensor.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | # Enable logging 13 | logger: 14 | level: VERBOSE 15 | 16 | # Example configuration entry 17 | sensor: 18 | - platform: wifi_signal 19 | name: "WiFi Signal Sensor" 20 | update_interval: 60s 21 | 22 | # Enable Home Assistant API 23 | api: 24 | 25 | ota: 26 | 27 | binary_sensor: 28 | - platform: gpio 29 | pin: 30 | number: D0 31 | inverted: true 32 | mode: INPUT 33 | name: "D0 Binary sensor" 34 | on_press: 35 | then: 36 | - script.execute: timer1 37 | 38 | output: 39 | - platform: gpio 40 | pin: D4 41 | inverted: true 42 | id: gpio_d4 43 | 44 | light: 45 | - platform: binary 46 | id: esp_led 47 | output: gpio_d4 48 | 49 | script: 50 | - id: timer1 51 | then: 52 | - script.stop: timer1 53 | - light.turn_on: esp_led 54 | - delay: 5s 55 | - light.turn_off: esp_led 56 | -------------------------------------------------------------------------------- /experiments/test.bmp280.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | api: 13 | 14 | ota: 15 | 16 | # define i2c device 17 | # for an ESP8266 SDA is D2 and goes to Arduino's A4 18 | # SCL is D1 and goes to Arduino's A5 19 | i2c: 20 | id: i2c_component 21 | 22 | logger: 23 | level: DEBUG 24 | 25 | dallas: 26 | pin: D5 27 | 28 | sensor: 29 | - platform: bmp280 30 | temperature: 31 | name: bmp280_1_temperature 32 | oversampling: 16X 33 | pressure: 34 | name: bmp280_1_pressure 35 | address: 0x76 # pull down 10k to set address 0x66 (installed in board) 36 | 37 | - platform: bmp280 38 | temperature: 39 | name: bmp280_2_temperature 40 | oversampling: 16X 41 | pressure: 42 | name: bmp280_2_pressure 43 | address: 0x77 # pull up 3.3k to set address 0x77 44 | 45 | - platform: dht 46 | pin: D0 47 | model: am2302 48 | temperature: 49 | name: dht22_temperature 50 | 51 | - platform: dallas 52 | index: 0 53 | name: dallas_temperature 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /experiments/test.captive.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: eh_captive 3 | platform: ESP8266 4 | board: nodemcu 5 | 6 | logger: 7 | level: VERBOSE 8 | 9 | api: 10 | 11 | ota: 12 | 13 | wifi: 14 | ssid: !secret wifi_ssid 15 | password: deftretresss 16 | ap: 17 | ssid: "ESP Hotspot" 18 | password: "12345678" 19 | 20 | captive_portal: 21 | 22 | web_server: 23 | 24 | output: 25 | - platform: esp8266_pwm 26 | pin: D4 27 | frequency: 1000 Hz 28 | id: pwm_output 29 | 30 | # Example usage in a light 31 | light: 32 | - platform: monochromatic 33 | output: pwm_output 34 | name: "ESP Light" 35 | -------------------------------------------------------------------------------- /experiments/test.climate.mitsubishi.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_toshiba 3 | platform: ESP8266 4 | board: nodemcu 5 | 6 | logger: 7 | level: VERY_VERBOSE 8 | 9 | wifi: 10 | ssid: !secret wifi_ssid 11 | password: !secret wifi_pass 12 | 13 | api: 14 | 15 | ota: 16 | 17 | 18 | sensor: 19 | - platform: dht 20 | pin: D2 21 | model: DHT22 22 | temperature: 23 | name: "Estudio Test Temperature" 24 | id: estudio_test_dht_temp 25 | humidity: 26 | name: "Estudio Test Humidity" 27 | update_interval: 5s 28 | 29 | remote_transmitter: 30 | carrier_duty_percent: 50% 31 | pin: D5 32 | 33 | 34 | climate: 35 | platform: mitsubishi 36 | name: 'New AC No Sensor' 37 | sensor: estudio_test_dht_temp -------------------------------------------------------------------------------- /experiments/test.climate.whirlpool.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local 3 | platform: ESP8266 4 | board: nodemcu 5 | 6 | logger: 7 | level: VERBOSE 8 | 9 | wifi: 10 | ssid: !secret wifi_ssid 11 | password: !secret wifi_pass 12 | 13 | api: 14 | 15 | ota: 16 | 17 | dallas: 18 | pin: D4 19 | update_interval: 60s 20 | 21 | sensor: 22 | - platform: dallas 23 | #address: 0xF77AF93F12646128 24 | index: 0 25 | id: dallas_temp 26 | internal: true 27 | 28 | remote_receiver: 29 | id: rcvr 30 | pin: 31 | number: D5 32 | inverted: True 33 | mode: INPUT_PULLUP 34 | tolerance: 55 # high tolerance required for some remote control units 35 | #dump: raw 36 | 37 | remote_transmitter: 38 | carrier_duty_percent: 50% 39 | pin: D6 40 | 41 | climate: 42 | - platform: coolix 43 | sensor: dallas_temp 44 | name: 'AC Living' 45 | supports_heat: false -------------------------------------------------------------------------------- /experiments/test.coolix_receive.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp8266 3 | platform: ESP8266 4 | board: nodemcu 5 | # on_boot: 6 | # - delay: 5s 7 | # - lambda: |- 8 | # pinMode(D5, INPUT_PULLUP); 9 | 10 | wifi: 11 | ssid: !secret wifi_ssid 12 | password: !secret wifi_pass 13 | 14 | substitutions: 15 | node_name: Dormitorio Este 16 | 17 | api: 18 | 19 | ota: 20 | 21 | logger: 22 | level: DEBUG 23 | 24 | remote_receiver: 25 | pin: 26 | number: D5 27 | inverted: True 28 | mode: OUTPUT_OPEN_DRAIN 29 | tolerance: 45% 30 | id: ir_receiver 31 | 32 | remote_transmitter: 33 | carrier_duty_percent: 100% 34 | pin: 35 | number: D5 36 | inverted: true 37 | mode: OUTPUT_OPEN_DRAIN 38 | 39 | climate: 40 | - platform: coolix 41 | sensor: temp_norte 42 | name: "${node_name} AC" 43 | supports_heat: True 44 | supports_cool: True 45 | receiver_id: ir_receiver 46 | 47 | switch: 48 | - platform: restart 49 | name: " ${node_name} Ac Restart" 50 | 51 | i2c: 52 | id: i2c_component 53 | 54 | sensor: 55 | - platform: bmp280 56 | temperature: 57 | id: temp_norte 58 | name: "${node_name} Temperatura" 59 | oversampling: 1x 60 | pressure: 61 | name: "${node_name} Presion" 62 | oversampling: 1x 63 | address: 0x76 64 | update_interval: 60s 65 | 66 | binary_sensor: 67 | - platform: status 68 | name: "${node_name} AC Status" 69 | -------------------------------------------------------------------------------- /experiments/test.coolix_sender.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: coolix_sender 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | logger: 9 | level: VERY_VERBOSE 10 | logs: 11 | remote_receiver.esp8266: VERBOSE 12 | 13 | wifi: 14 | ssid: !secret wifi_ssid 15 | password: !secret wifi_pass 16 | fast_connect: true 17 | manual_ip: 18 | static_ip: 10.0.1.198 19 | gateway: 10.0.1.1 20 | subnet: 255.0.0.0 21 | 22 | api: 23 | 24 | ota: 25 | 26 | dallas: 27 | pin: D4 28 | update_interval: 60s 29 | 30 | sensor: 31 | - platform: dallas 32 | address: 0xF176C32712646128 33 | id: dallas_temp 34 | internal: true 35 | 36 | remote_receiver: 37 | id: rcvr 38 | pin: 39 | number: D5 40 | inverted: True 41 | mode: INPUT_PULLUP 42 | tolerance: 55 43 | 44 | remote_transmitter: 45 | carrier_duty_percent: 50% 46 | pin: D6 47 | 48 | climate: 49 | - platform: coolix 50 | receiver_id: rcvr 51 | sensor: dallas_temp 52 | name: AC 53 | #binary_sensor: 54 | # - platform: remote_receiver 55 | # name: NEC Button X 56 | # nec: 57 | # address: 0x00FF 58 | # command: 0xE21D 59 | 60 | -------------------------------------------------------------------------------- /experiments/test.dallas.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-local2 3 | platformio_options: 4 | upload_speed: 921600 5 | 6 | esp32: 7 | board: nodemcu-32s 8 | 9 | logger: 10 | level: DEBUG 11 | 12 | dallas: 13 | - pin: GPIO23 14 | update_interval: 10s 15 | 16 | sensor: 17 | - platform: dallas 18 | index: 0 19 | name: "Dallas Temperature 1" 20 | 21 | - platform: dallas 22 | index: 1 23 | name: "Dallas Temperature 2 " 24 | -------------------------------------------------------------------------------- /experiments/test.dfplayer.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | manual_ip: 13 | static_ip: 10.0.1.199 14 | gateway: 10.0.1.1 15 | subnet: 255.0.0.0 16 | 17 | 18 | logger: 19 | level: VERBOSE 20 | 21 | uart: 22 | tx_pin: GPIO2 23 | rx_pin: GPIO5 24 | baud_rate: 9600 25 | 26 | dfplayer: 27 | id: my_df_player 28 | on_finished_playback: 29 | then: 30 | logger.log: 'Somebody press play!' 31 | 32 | binary_sensor: 33 | - platform: template 34 | name: "dfplayer_is_playing" 35 | lambda: 'return id(my_df_player).is_playing();' 36 | 37 | api: 38 | services: 39 | - service: dfplayer_next 40 | then: 41 | - dfplayer.play_next: 42 | - service: dfplayer_previous 43 | then: 44 | - dfplayer.play_previous: 45 | - service: dfplayer_play 46 | variables: 47 | file: int 48 | then: 49 | - dfplayer.play: !lambda 'return file;' 50 | - service: dfplayer_play_loop 51 | variables: 52 | file: int 53 | loop_: bool 54 | then: 55 | - dfplayer.play: 56 | file: !lambda 'return file;' 57 | loop: !lambda 'return loop_;' 58 | - service: dfplayer_play_folder 59 | variables: 60 | folder: int 61 | file: int 62 | then: 63 | - dfplayer.play_folder: 64 | folder: !lambda 'return folder;' 65 | file: !lambda 'return file;' 66 | 67 | - service: dfplayer_play_loo_folder 68 | variables: 69 | folder: int 70 | then: 71 | - dfplayer.play_folder: 72 | id: my_df_player 73 | folder: !lambda 'return folder;' 74 | loop: True 75 | 76 | - service: dfplayer_set_device 77 | variables: 78 | device: int 79 | then: 80 | - dfplayer.set_device: 81 | device: TF_CARD 82 | - service: dfplayer_set_device_str 83 | variables: 84 | device: string 85 | then: 86 | - dfplayer.set_device: 87 | device: !lambda 'return (device == "USB")? dfplayer::USB : dfplayer::TF_CARD;' 88 | 89 | - service: dfplayer_set_volume 90 | variables: 91 | volume: int 92 | then: 93 | - dfplayer.set_volume: !lambda 'return volume;' 94 | - service: dfplayer_set_eq 95 | variables: 96 | preset: int 97 | then: 98 | - dfplayer.set_eq: !lambda 'return static_cast(preset);' 99 | 100 | - service: dfplayer_sleep 101 | then: 102 | - dfplayer.sleep 103 | 104 | - service: dfplayer_reset 105 | then: 106 | - dfplayer.reset 107 | 108 | - service: dfplayer_start 109 | then: 110 | - dfplayer.start 111 | 112 | - service: dfplayer_pause 113 | then: 114 | - dfplayer.pause 115 | 116 | - service: dfplayer_stop 117 | then: 118 | - dfplayer.stop 119 | 120 | - service: dfplayer_random 121 | then: 122 | - dfplayer.random 123 | 124 | 125 | # uart: 126 | # tx_pin: D0 127 | # rx_pin: D1 128 | # baud_rate: 9600 -------------------------------------------------------------------------------- /experiments/test.dht.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: esp8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | api: 9 | 10 | ota: 11 | 12 | logger: 13 | level: VERBOSE 14 | 15 | wifi: 16 | ssid: !secret wifi_ssid 17 | password: !secret wifi_pass 18 | output_power: 20.5dB 19 | manual_ip: 20 | static_ip: 10.0.1.199 21 | gateway: 10.0.1.1 22 | subnet: 255.0.0.0 23 | 24 | sensor: 25 | - platform: dht 26 | model: AM2302 27 | pin: D5 28 | update_interval: 60s 29 | temperature: 30 | name: "Living Room Temperature" 31 | humidity: 32 | name: "Living Room Humidity" 33 | 34 | 35 | web_server: 36 | css_url: "" 37 | css_include: "../esphome-docs/_static/webserver-v1.min.css" 38 | js_url: "" 39 | js_include: "../esphome-docs/_static/webserver-v1.min.js" 40 | -------------------------------------------------------------------------------- /experiments/test.dimmer.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | output_power: 20.5dB 12 | manual_ip: 13 | static_ip: 10.0.1.199 14 | gateway: 10.0.1.1 15 | subnet: 255.0.0.0 16 | 17 | api: 18 | 19 | ota: 20 | 21 | logger: 22 | level: VERY_VERBOSE 23 | 24 | switch: 25 | - platform: template 26 | optimistic: true 27 | name: "switch in 5s" 28 | turn_on_action: 29 | - light.turn_on: 30 | id: l1 31 | transition_length: 5s 32 | turn_off_action: 33 | - light.turn_off: 34 | id: l1 35 | transition_length: 5s 36 | 37 | 38 | - platform: template 39 | optimistic: true 40 | name: "switch in 0s" 41 | turn_on_action: 42 | - light.turn_on: 43 | id: l1 44 | transition_length: 0s 45 | turn_off_action: 46 | - light.turn_off: 47 | id: l1 48 | transition_length: 0s 49 | 50 | 51 | output: 52 | - platform: ac_dimmer 53 | id: dimmer1 54 | gate_pin: D7 55 | min_power: 12% 56 | init_with_half_cycle: false 57 | zero_cross_pin: 58 | number: D6 59 | mode: INPUT 60 | inverted: yes 61 | - platform: ac_dimmer 62 | id: dimmer2 63 | gate_pin: D5 64 | method: leading 65 | zero_cross_pin: 66 | number: D6 67 | mode: INPUT 68 | inverted: yes 69 | - platform: ac_dimmer 70 | id: dimmer3 71 | gate_pin: D4 72 | method: trailing 73 | zero_cross_pin: 74 | number: D6 75 | mode: INPUT 76 | inverted: yes 77 | 78 | light: 79 | - platform: monochromatic 80 | output: dimmer1 81 | name: Dimmer Light Halogen 82 | id: l1 83 | gamma_correct: 0 84 | 85 | - platform: monochromatic 86 | output: dimmer2 87 | name: Dimmer Light LED 88 | 89 | - platform: monochromatic 90 | output: dimmer3 91 | name: Dimmer Light Leading -------------------------------------------------------------------------------- /experiments/test.esp32.ble_scanner.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | # Enable fallback hotspot (captive portal) in case wifi connection fails 13 | # ap: 14 | # ssid: "Test Esp32 Fallback Hotspot" 15 | # password: "HBPaN3WZOE38" 16 | 17 | # captive_portal: 18 | 19 | # Enable logging 20 | logger: 21 | 22 | # Enable Home Assistant API 23 | api: 24 | 25 | ota: 26 | 27 | esp32_ble_tracker: -------------------------------------------------------------------------------- /experiments/test.esp32.dallas.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | platformio_options: 4 | upload_speed: 921600 5 | 6 | esp32: 7 | board: nodemcu-32s 8 | framework: 9 | type: esp-idf 10 | 11 | dallas: 12 | pin: GPIO33 13 | update_interval: 5s 14 | 15 | logger: 16 | level: VERY_VERBOSE 17 | logs: 18 | scheduler: DEBUG 19 | dallas.sensor: DEBUG 20 | 21 | sensor: 22 | # - platform: dallas 23 | # address: 0x5221e03f12646128 24 | # name: Temp1 25 | # - platform: dallas 26 | # address: 0xf176c32712646128 # pata rota 27 | # name: Temp2 28 | - platform: dallas 29 | index: 0 30 | name: Temp3 31 | 32 | output: 33 | - platform: ledc 34 | pin: GPIO2 35 | id: gpio2_out 36 | 37 | light: 38 | - platform: monochromatic 39 | output: gpio2_out 40 | name: test_led 41 | api: 42 | ota: 43 | 44 | wifi: 45 | ssid: !secret wifi_ssid 46 | password: !secret wifi_pass -------------------------------------------------------------------------------- /experiments/test.esp32.ethernet.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | # wifi: 9 | # ssid: !secret wifi_ssid 10 | # password: !secret wifi_pass 11 | 12 | logger: 13 | 14 | api: 15 | 16 | ota: 17 | 18 | ethernet: 19 | type: LAN8720 20 | mdc_pin: GPIO23 21 | mdio_pin: GPIO18 22 | clk_mode: GPIO0_IN 23 | phy_addr: 1 24 | power_pin: GPIO17 25 | #enable_mdns: true 26 | 27 | light: 28 | - platform: fastled_clockless 29 | name: LED 30 | pin: GPIO12 31 | num_leds: 1 32 | chipset: WS2812B 33 | rgb_order: GRB 34 | -------------------------------------------------------------------------------- /experiments/test.esp32.mcp_idf.yaml: -------------------------------------------------------------------------------- 1 | # this is a comment 2 | 3 | esphome: 4 | name: test-esp32 5 | # platform: ESP32 6 | # board: nodemcu-32s 7 | platformio_options: 8 | upload_speed: 921600 9 | 10 | esp32: 11 | board: nodemcu-32s 12 | framework: 13 | type: esp-idf 14 | 15 | wifi: 16 | ssid: !secret wifi_ssid 17 | password: !secret wifi_pass 18 | 19 | logger: 20 | 21 | api: 22 | encryption: 23 | key: "+/pGf5YDHQMO8ULAlTaynASGLz8m4p0+gzVzcuzdIro=" 24 | 25 | ota: 26 | 27 | mcp23017: 28 | id: mcp23017_hub 29 | 30 | i2c: 31 | 32 | # Individual outputs 33 | switch: 34 | - platform: gpio 35 | name: "MCP23017 Pin #0" 36 | pin: 37 | mcp23xxx: mcp23017_hub 38 | # Use pin number 0 39 | number: 0 40 | mode: OUTPUT 41 | inverted: false 42 | 43 | # Individual inputs 44 | binary_sensor: 45 | - platform: gpio 46 | name: "MCP23017 Pin #1" 47 | pin: 48 | mcp23xxx: mcp23017_hub 49 | # Use pin number 1 50 | number: 1 51 | # One of INPUT or INPUT_PULLUP 52 | mode: INPUT_PULLUP 53 | inverted: false 54 | -------------------------------------------------------------------------------- /experiments/test.esp32.omotor.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | # Enable logging 13 | logger: 14 | 15 | # Enable Home Assistant API 16 | api: 17 | 18 | ota: 19 | 20 | text_sensor: 21 | - platform: wifi_info 22 | ip_address: 23 | name: IP Address 24 | mac_address: 25 | name: MacAddress -------------------------------------------------------------------------------- /experiments/test.esp32.rf-rx.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | platformio_options: 4 | upload_speed: 921600 5 | 6 | esp32: 7 | framework: 8 | type: esp-idf 9 | board: nodemcu-32s 10 | 11 | logger: 12 | level: DEBUG 13 | logs: 14 | api.service: DEBUG 15 | 16 | # wifi: 17 | # ssid: !secret wifi_ssid 18 | # password: !secret wifi_pass 19 | 20 | # api: 21 | 22 | # ota: 23 | #substitutions: 24 | 25 | output: 26 | - platform: gpio 27 | pin: GPIO2 28 | id: led_output 29 | 30 | light: 31 | platform: binary 32 | output: led_output 33 | id: led 34 | 35 | binary_sensor: 36 | - platform: gpio 37 | id: flash_btn 38 | pin: GPIO0 39 | on_press: 40 | - light.toggle: led 41 | - platform: remote_receiver 42 | receiver_id: rx_rf 43 | id: btn_top 44 | name: CS_BotonArriba 45 | rc_switch_raw: 46 | protocol: 6 47 | code: "1011110110111101111000110101" 48 | 49 | filters: 50 | - delayed_off: 1s 51 | on_press: 52 | - light.turn_on: led 53 | - delay: 200ms 54 | - light.turn_off: led 55 | 56 | - platform: remote_receiver 57 | receiver_id: rx_rf 58 | id: btn_bottom_left 59 | name: CS_BotonIzq 60 | rc_switch_raw: 61 | protocol: 6 62 | code: "1011110110111101111000100101" 63 | filters: 64 | - delayed_off: 1s 65 | on_press: 66 | - light.turn_on: led 67 | - delay: 200ms 68 | - light.turn_off: led 69 | - delay: 200ms 70 | - light.turn_on: led 71 | - delay: 200ms 72 | - light.turn_off: led 73 | 74 | - platform: remote_receiver 75 | receiver_id: rx_rf 76 | id: btn_right 77 | name: CS_BotonDerecho 78 | rc_switch_raw: 79 | protocol: 6 80 | code: "1011110110111101111000010101" 81 | filters: 82 | - delayed_off: 1s 83 | on_press: 84 | - light.turn_on: led 85 | - delay: 200ms 86 | - light.turn_off: led 87 | - delay: 200ms 88 | - light.turn_on: led 89 | - delay: 200ms 90 | - light.turn_off: led 91 | - delay: 200ms 92 | - light.turn_on: led 93 | - delay: 200ms 94 | - light.turn_off: led 95 | 96 | remote_receiver: 97 | - id: rx_rf 98 | pin: 99 | number: GPIO12 100 | dump: 101 | - rc_switch 102 | 103 | # Settings to optimize recognition of RF devices 104 | tolerance: 50% 105 | filter: 250us 106 | idle: 7ms 107 | buffer_size: 2kb 108 | 109 | - id: rx_ir 110 | pin: 111 | number: GPIO14 112 | inverted: true 113 | dump: all 114 | buffer_size: 2kb 115 | 116 | remote_transmitter: 117 | pin: GPIO22 118 | carrier_duty_percent: 50% 119 | 120 | climate: 121 | - platform: tcl112 122 | id: climate1 123 | receiver_id: rx_ir 124 | -------------------------------------------------------------------------------- /experiments/test.esp32.touch.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | logger: 13 | level: DEBUG 14 | ota: 15 | 16 | api: 17 | 18 | esp32_touch: 19 | setup_mode: true 20 | iir_filter: 600ms 21 | low_voltage_reference: 0.8 22 | high_voltage_reference: 2.4 23 | voltage_attenuation: 0.5 24 | 25 | binary_sensor: 26 | - platform: esp32_touch 27 | id: touch_s1 28 | pin: GPIO27 29 | threshold: 1000 30 | 31 | sensor: 32 | - platform: template 33 | name: TankLevelRaw 34 | update_interval: 10s 35 | lambda: return touch_s1->get_value(); 36 | unit_of_measurement: "%" 37 | filters: 38 | - sliding_window_moving_average: 39 | window_size: 25 40 | send_every: 1 41 | -------------------------------------------------------------------------------- /experiments/test.esp32.wifi_info.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: nodemcu-32s 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | # Enable fallback hotspot (captive portal) in case wifi connection fails 13 | # ap: 14 | # ssid: "Test Esp32 Fallback Hotspot" 15 | # password: "HBPaN3WZOE38" 16 | 17 | # captive_portal: 18 | 19 | # Enable logging 20 | logger: 21 | 22 | # Enable Home Assistant API 23 | api: 24 | 25 | ota: 26 | 27 | text_sensor: 28 | - platform: wifi_info 29 | ip_address: 30 | name: IP Address 31 | mac_address: 32 | name: MacAddress -------------------------------------------------------------------------------- /experiments/test.esp32.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | platformio_options: 4 | upload_speed: 921600 5 | 6 | esp32: 7 | framework: 8 | type: esp-idf 9 | board: nodemcu-32s 10 | 11 | logger: 12 | 13 | wifi: 14 | ssid: glm-iot 15 | password: elledestaencendido 16 | 17 | api: 18 | 19 | ota: 20 | -------------------------------------------------------------------------------- /experiments/test.esp8266.rf-rx.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp8266 3 | # includes: 4 | # - arduino_port_expander.h 5 | 6 | esp8266: 7 | board: esp12e 8 | restore_from_flash: true 9 | 10 | wifi: 11 | networks: 12 | ssid: !secret wifi_ssid 13 | password: !secret wifi_pass 14 | #bssid: !secret bssid_airport_express 15 | 16 | captive_portal: 17 | 18 | ota: 19 | 20 | api: 21 | 22 | logger: 23 | level: DEBUG 24 | 25 | dallas: 26 | pin: GPIO14 27 | update_interval: 60s 28 | 29 | sensor: 30 | - platform: dallas 31 | address: 0x2771C02712646128 32 | name: Temperatura Patio 33 | ### 34 | # module info: 35 | # Male Header: 36 | # DI3 | DI2 | DI8 | T13 | 5V 37 | # 12V | NC | NC | GND | A0 38 | 39 | # Female Header 40 | # GND | 3.3V 41 | # DI9 | DI10 42 | # A1 | DI11 43 | # DI12 | NC 44 | 45 | # DI8 Puerta Frente 46 | # DI9 Puerta cocina 47 | # DI10 Puerta estudio 48 | # DI11 Switch Galeria Patio 49 | # DI12 Switch Galeria Proyectores 50 | # DI0 Movimiento Galeria 51 | # A1 # 15 # Switch Galeria 1 52 | 53 | # DI3 Cortina 54 | # DI2 Cortina 55 | # A0 Cortina 56 | 57 | -------------------------------------------------------------------------------- /experiments/test.esp8266.thermostat.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | esphome: 3 | name: test-esp8266 4 | 5 | esp8266: 6 | board: nodemcu 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | api: 13 | 14 | ota: 15 | 16 | logger: 17 | level: DEBUG 18 | #baud_rate: 0 # use UART pins for IO 19 | 20 | output: 21 | - platform: gpio 22 | id: rly1 23 | pin: GPIO13 24 | 25 | switch: 26 | - platform: output 27 | name: "Encendido termotanque casa" 28 | id: switchBoiler 29 | output: rly1 30 | restore_mode: ALWAYS_ON 31 | 32 | binary_sensor: 33 | - platform: template 34 | name: Calentando termotanque casa 35 | id: boiler_heating 36 | 37 | dallas: 38 | - pin: GPIO5 39 | 40 | sensor: 41 | - platform: dallas 42 | name: Temperatura termotanque casa 43 | address: 0xf176c32712646128 44 | id: temperature_sensor 45 | - platform: adc 46 | pin: A0 47 | id: ldr 48 | entity_category: diagnostic 49 | update_interval: 10s 50 | on_value: 51 | then: 52 | - lambda: |- 53 | id(boiler_heating).publish_state(x < 0.2); 54 | 55 | climate: 56 | - platform: thermostat 57 | name: Termotanque casa 58 | sensor: temperature_sensor 59 | min_heating_off_time: 60s 60 | min_heating_run_time: 60s 61 | min_idle_time: 30s 62 | heat_action: 63 | - switch.turn_on: switchBoiler 64 | idle_action: 65 | - switch.turn_off: switchBoiler 66 | heat_deadband: 1 67 | heat_overrun: 1 68 | visual: 69 | max_temperature: 60 70 | min_temperature: 10 71 | temperature_step: 1 72 | icon: mdi:water-boiler 73 | default_preset: Normal 74 | preset: 75 | - name: Normal 76 | default_target_temperature_low: 45 77 | mode: HEAT 78 | - name: Eco 79 | default_target_temperature_low: 30 80 | mode: HEAT 81 | preset_change: 82 | then: 83 | - logger.log: "Preset changed tiggered!" 84 | -------------------------------------------------------------------------------- /experiments/test.gpio0.yaml: -------------------------------------------------------------------------------- 1 | # single test esp12f led (GPIO2) and some boards (GPIO16 led) 2 | # leds are toggled with GPIO0 (usually built in flash button) 3 | 4 | esphome: 5 | name: test_esp8266 6 | platform: ESP8266 7 | board: nodemcuv2 8 | platformio_options: 9 | upload_speed: 921600 10 | 11 | logger: 12 | 13 | level: VERY_VERBOSE 14 | logs: 15 | api.service: DEBUG 16 | 17 | # api: 18 | 19 | packages: 20 | wifi: !include package.wifi.yaml 21 | 22 | #substitutions: 23 | 24 | output: 25 | - platform: esp8266_pwm 26 | pin: D1 27 | frequency: 1000 Hz 28 | id: rtttl_out 29 | 30 | rtttl: 31 | output: rtttl_out 32 | on_finished_playback: 33 | - logger.log: 'termino la cancion' 34 | 35 | api: 36 | services: 37 | - service: play_rtttl 38 | variables: 39 | song_str: string 40 | then: 41 | - rtttl.play: 42 | rtttl: !lambda 'return song_str;' 43 | 44 | binary_sensor: 45 | - platform: gpio 46 | id: flash_btn 47 | pin: GPIO0 48 | on_press: 49 | - if: 50 | condition: 51 | - rtttl.is_playing 52 | then: 53 | - rtttl.stop: 54 | else: 55 | - rtttl.play: 'MissionImp:d=16,o=6,b=95:32d,32d#,32d,32d#,32d,32d#,32d,32d#,32d,32d,32d#,32e,32f,32f#,32g,g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#,p,g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#,p,a#,g,2d,32p,a#,g,2c#,32p,a#,g,2c,a#5,8c,2p,32p,a#5,g5,2f#,32p,a#5,g5,2f,32p,a#5,g5,2e,d#,8d' 56 | - delay: 40s 57 | - rtttl.play: 'StarWars:d=4,o=5,b=45:32p,32f#,32f#,32f#,8b.,8f#.6,32e6,32d#6,32c#6,8b.6,16f#.6,32e6,32d#6,32c#6,8b.6,16f#.6,32e6,32d#6,32e6,8c#.6,32f#,32f#,32f#,8b.,8f#.6,32e6,32d#6,32c#6,8b.6,16f#.6,32e6,32d#6,32c#6,8b.6,16f#.6,32e6,32d#6,32e6,8c#6' 58 | -------------------------------------------------------------------------------- /experiments/test.mcp23017.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp32 3 | platform: ESP32 4 | board: esp32doit-devkit-v1 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | api: 9 | 10 | ota: 11 | 12 | logger: 13 | level: DEBUG 14 | 15 | wifi: 16 | ssid: !secret wifi_ssid 17 | password: !secret wifi_pass 18 | 19 | i2c: 20 | scan: true 21 | sda: GPIO14 22 | scl: GPIO13 23 | 24 | mcp23017: 25 | id: mcp23017_hub 26 | address: 0x21 27 | 28 | binary_sensor: 29 | - platform: gpio 30 | name: "MCP23017 GPA0 Pin #21" 31 | pin: 32 | mcp23xxx: mcp23017_hub 33 | number: 0 34 | mode: INPUT_PULLUP 35 | - platform: gpio 36 | name: "MCP23017 GPA1 Pin #22" 37 | pin: 38 | mcp23xxx: mcp23017_hub 39 | number: 1 40 | - platform: gpio 41 | name: "MCP23017 GPA2 Pin #23" 42 | pin: 43 | mcp23xxx: mcp23017_hub 44 | number: 2 45 | - platform: gpio 46 | name: "MCP23017 GPA3 Pin #24" 47 | pin: 48 | mcp23xxx: mcp23017_hub 49 | number: 3 50 | - platform: gpio 51 | name: "MCP23017 GPA4 Pin #25" 52 | pin: 53 | mcp23xxx: mcp23017_hub 54 | number: 4 55 | - platform: gpio 56 | name: "MCP23017 GPA5 Pin #26" 57 | pin: 58 | mcp23xxx: mcp23017_hub 59 | number: 5 60 | - platform: gpio 61 | name: "MCP23017 GPA6 Pin #27" 62 | pin: 63 | mcp23xxx: mcp23017_hub 64 | number: 6 65 | - platform: gpio 66 | name: "MCP23017 GPA7 Pin #28" 67 | pin: 68 | mcp23xxx: mcp23017_hub 69 | number: 7 70 | 71 | switch: 72 | - platform: gpio 73 | name: "MCP23017 GPB0 Pin #1" 74 | pin: 75 | mcp23xxx: mcp23017_hub 76 | number: 8 77 | - platform: gpio 78 | name: "MCP23017 GPB1 Pin #2" 79 | pin: 80 | mcp23xxx: mcp23017_hub 81 | number: 9 82 | - platform: gpio 83 | name: "MCP23017 GPB2 Pin #3" 84 | pin: 85 | mcp23xxx: mcp23017_hub 86 | number: 10 87 | - platform: gpio 88 | name: "MCP23017 GPB3 Pin #4" 89 | pin: 90 | mcp23xxx: mcp23017_hub 91 | number: 11 92 | - platform: gpio 93 | name: "MCP23017 GPB4 Pin #5" 94 | pin: 95 | mcp23xxx: mcp23017_hub 96 | number: 12 97 | - platform: gpio 98 | name: "MCP23017 GPB5 Pin #6" 99 | pin: 100 | mcp23xxx: mcp23017_hub 101 | number: 13 102 | - platform: gpio 103 | name: "MCP23017 GPB6 Pin #7" 104 | pin: 105 | mcp23xxx: mcp23017_hub 106 | number: 14 107 | - platform: gpio 108 | name: "MCP23017 GPB7 Pin #8" 109 | pin: 110 | mcp23xxx: mcp23017_hub 111 | number: 15 112 | -------------------------------------------------------------------------------- /experiments/test.rcswitch.rx.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | logger: 9 | level: VERBOSE 10 | 11 | wifi: 12 | ssid: !secret wifi_ssid 13 | password: !secret wifi_pass 14 | fast_connect: true 15 | manual_ip: 16 | static_ip: 10.0.1.199 17 | gateway: 10.0.1.1 18 | subnet: 255.0.0.0 19 | 20 | api: 21 | 22 | # ota: 23 | 24 | remote_receiver: 25 | pin: D6 26 | dump: 27 | - rc_switch 28 | - raw 29 | 30 | tolerance: 20% 31 | filter: 250us 32 | idle: 4ms 33 | buffer_size: 2kb 34 | 35 | 36 | remote_transmitter: 37 | pin: D7 38 | # RF uses a 100% carrier signal 39 | carrier_duty_percent: 100% 40 | 41 | binary_sensor: 42 | - platform: gpio 43 | pin: D3 44 | id: laal 45 | on_press: 46 | - remote_transmitter.transmit_rc_switch_raw: 47 | code: '110100000011110111000000' 48 | protocol: 1 49 | repeat: 50 | times: 5 51 | wait_time: 1ms -------------------------------------------------------------------------------- /experiments/test.rcswitch.tx.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | logger: 9 | level: DEBUG 10 | 11 | wifi: 12 | ssid: !secret wifi_ssid 13 | password: !secret wifi_pass 14 | fast_connect: true 15 | 16 | api: 17 | id: null 18 | port: 32 19 | password: alkjsfds 20 | reboot_timeout: 2s 21 | 22 | # ota: 23 | 24 | remote_transmitter: 25 | pin: D7 26 | # RF uses a 100% carrier signal 27 | carrier_duty_percent: 100% 28 | setup_priority: 32.3 29 | 30 | switch: 31 | - platform: template 32 | id: C3_Lock 33 | turn_on_action: 34 | - remote_transmitter.transmit_rc_switch_raw: 35 | code: "110100000011010100001100" 36 | protocol: 1 37 | repeat: 38 | times: 5 39 | wait_time: 2ms 40 | - platform: template 41 | id: C3_UnLock 42 | turn_on_action: 43 | - remote_transmitter.transmit_rc_switch_raw: 44 | code: "110100000011010100110000" 45 | protocol: 1 46 | repeat: 47 | times: 5 48 | wait_time: 2ms 49 | - platform: template 50 | id: C3_Bajar 51 | turn_on_action: 52 | - remote_transmitter.transmit_rc_switch_raw: 53 | code: "110100000011010100000011" 54 | protocol: 1 55 | repeat: 56 | times: 5 57 | wait_time: 2ms 58 | - platform: template 59 | id: C3_Subir 60 | turn_on_action: 61 | - remote_transmitter.transmit_rc_switch_raw: 62 | code: "110100000011010111000000" 63 | protocol: 1 64 | repeat: 65 | times: 5 66 | wait_time: 2ms 67 | 68 | - platform: template 69 | id: C4_Lock 70 | turn_on_action: 71 | - remote_transmitter.transmit_rc_switch_raw: 72 | code: "110111010100001100001100" 73 | protocol: 1 74 | repeat: 75 | times: 5 76 | wait_time: 2ms 77 | - platform: template 78 | id: C4_UnLock 79 | turn_on_action: 80 | - remote_transmitter.transmit_rc_switch_raw: 81 | code: "110111010100001100110000" 82 | protocol: 1 83 | repeat: 84 | times: 5 85 | wait_time: 2ms 86 | - platform: template 87 | id: C4_Bajar 88 | turn_on_action: 89 | - remote_transmitter.transmit_rc_switch_raw: 90 | code: "110111010100001111000000" 91 | protocol: 1 92 | repeat: 93 | times: 5 94 | wait_time: 2ms 95 | - platform: template 96 | id: C4_Subir 97 | turn_on_action: 98 | - remote_transmitter.transmit_rc_switch_raw: 99 | code: "110111010100001100000011" 100 | protocol: 1 101 | repeat: 102 | times: 5 103 | wait_time: 2ms 104 | 105 | - platform: template 106 | id: C9_Lock 107 | turn_on_action: 108 | - remote_transmitter.transmit_rc_switch_raw: 109 | code: "110100000011110100001100" 110 | protocol: 1 111 | repeat: 112 | times: 5 113 | wait_time: 2ms 114 | - platform: template 115 | id: C9_UnLock 116 | turn_on_action: 117 | - remote_transmitter.transmit_rc_switch_raw: 118 | code: "110100000011110100110000" 119 | protocol: 1 120 | repeat: 121 | times: 5 122 | wait_time: 2ms 123 | - platform: template 124 | id: C9_Bajar 125 | turn_on_action: 126 | - remote_transmitter.transmit_rc_switch_raw: 127 | code: "110100000011110100000011" 128 | protocol: 1 129 | repeat: 130 | times: 5 131 | wait_time: 2ms 132 | - platform: template 133 | id: C9_Subir 134 | turn_on_action: 135 | - remote_transmitter.transmit_rc_switch_raw: 136 | code: "110100000011110111000000" 137 | protocol: 1 138 | repeat: 139 | times: 5 140 | wait_time: 2ms 141 | 142 | cover: 143 | - platform: time_based 144 | device_class: blind 145 | name: "Cortina 9 Muro" 146 | open_action: 147 | - switch.turn_on: C9_Subir 148 | open_duration: 20s 149 | close_action: 150 | - switch.turn_on: C9_Bajar 151 | close_duration: 20s 152 | stop_action: 153 | - switch.turn_on: C9_UnLock 154 | has_built_in_endstop: true 155 | 156 | - platform: time_based 157 | device_class: shade 158 | name: "Cortina 4 Centro" 159 | open_action: 160 | - switch.turn_on: C4_Subir 161 | open_duration: 20s 162 | close_action: 163 | - switch.turn_on: C4_Bajar 164 | close_duration: 20s 165 | stop_action: 166 | - switch.turn_on: C4_UnLock 167 | has_built_in_endstop: true 168 | 169 | - platform: time_based 170 | device_class: shutter 171 | name: "Cortina 3 Pasillo" 172 | open_action: 173 | - switch.turn_on: C3_Subir 174 | open_duration: 20s 175 | close_action: 176 | - switch.turn_on: C3_Bajar 177 | close_duration: 20s 178 | stop_action: 179 | - switch.turn_on: C3_UnLock 180 | has_built_in_endstop: true 181 | -------------------------------------------------------------------------------- /experiments/test.remote.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | 12 | api: 13 | 14 | ota: 15 | 16 | logger: 17 | level: VERY_VERBOSE 18 | 19 | remote: 20 | id: remote_esp1 21 | endpoint: 10.0.1.1 22 | 23 | binary_sensor: 24 | - platform: remote 25 | id: remote_binary_sensor1 26 | remote_id: remote_esp1 27 | remote_binary_sensor_id: binary_sensor1 28 | on_press: 29 | - logger.log: 'Remote binary sensor press' 30 | - logger.log: 'Remote binary sensor released' 31 | 32 | -------------------------------------------------------------------------------- /experiments/test.rp2040.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: rp2040_1 3 | 4 | rp2040: 5 | board: pico 6 | -------------------------------------------------------------------------------- /experiments/test.ssd1306_display.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_servo 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | # Enable logging 14 | 15 | # Enable logging 16 | logger: 17 | level: VERBOSE 18 | 19 | # Enable Home Assistant API 20 | 21 | ota: 22 | 23 | font: 24 | - file: "Roboto-Regular.ttf" 25 | id: my_font 26 | size: 20 27 | 28 | i2c: 29 | sda: D3 30 | scl: D4 31 | 32 | globals: 33 | - id: bright 34 | type: int 35 | restore_value: no 36 | initial_value: '0' 37 | 38 | display: 39 | - id: blue_display 40 | platform: ssd1306_i2c 41 | model: "SSD1306 128x64" 42 | reset_pin: D0 43 | update_interval: 500ms 44 | address: 0x3C 45 | brightness: 10% 46 | lambda: |- 47 | it.printf(0, 40, id(my_font), "GLM %d%%", id(bright)); 48 | 49 | interval: 50 | - interval: 1sec 51 | then: 52 | lambda: |- 53 | auto d = id(blue_display); 54 | id(bright) += 10; 55 | if (id(bright) > 100) id(bright) = 0; 56 | d->set_brightness(id(bright) / 100.0); 57 | d->setup(); 58 | 59 | -------------------------------------------------------------------------------- /experiments/test.time_based_cover.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | api: 9 | 10 | wifi: 11 | ssid: !secret wifi_ssid 12 | password: !secret wifi_pass 13 | fast_connect: true 14 | 15 | # Enable logging 16 | 17 | text_sensor: 18 | - platform: wifi_info 19 | ip_address: 20 | name: ESP IP Address 21 | ssid: 22 | name: ESP Connected SSID 23 | bssid: 24 | name: ESP Connected BSSID 25 | 26 | 27 | logger: 28 | level: VERY_VERBOSE 29 | 30 | cover: 31 | - platform: time_based 32 | device_class: blind 33 | name: "Test" 34 | open_action: 35 | - logger.log: 'Cover open_action' 36 | open_duration: 10s 37 | close_action: 38 | - logger.log: 'Cover close_action' 39 | close_duration: 10s 40 | stop_action: 41 | - logger.log: 'Cover stop_action' 42 | has_built_in_endstop: true -------------------------------------------------------------------------------- /experiments/test.veggies.yaml: -------------------------------------------------------------------------------- 1 | # single test esp12f led (GPIO2) and some boards (GPIO16 led) 2 | # leds are toggled with GPIO0 (usually built in flash button) 3 | 4 | esphome: 5 | name: test_esp8266 6 | platform: ESP8266 7 | board: nodemcuv2 8 | platformio_options: 9 | upload_speed: 921600 10 | 11 | # ... 12 | includes: 13 | - "../my_home/arduino_port_expander.h" 14 | 15 | logger: 16 | level: DEBUG 17 | logs: 18 | api.service: DEBUG 19 | 20 | packages: 21 | wifi: !include ../package.wifi.yaml 22 | 23 | api: 24 | 25 | ota: 26 | 27 | i2c: 28 | id: i2c_component 29 | 30 | custom_component: 31 | - id: ape 32 | lambda: |- 33 | auto ape_component = new ArduinoPortExpander(i2c_component, 0x08); 34 | return {ape_component}; 35 | 36 | sensor: 37 | - platform: wifi_signal 38 | name: "Veggies WiFi Signal" 39 | update_interval: 60s 40 | 41 | - platform: custom 42 | lambda: |- 43 | return {ape_analog_input(ape, 0), 44 | ape_analog_input(ape, 1), // 1 = A1 45 | ape_analog_input(ape, 2)}; 46 | #ape_analog_input(ape, 2) -taken from line above 47 | sensors: 48 | - name: Analog A0 49 | id: Brightness 50 | filters: 51 | - throttle: 10s 52 | - name: Plant Moisture pin 2 53 | id: analog_a1 54 | unit_of_measurement: "moisture" 55 | filters: 56 | - throttle: 10s 57 | - name: Plant Moisture pin 3 58 | id: analog_a2 59 | unit_of_measurement: "moisture" 60 | filters: 61 | - throttle: 10s 62 | 63 | ##I'm working below this line to try to figure out how to only power up the moisture sensor periodically 64 | #................................ 65 | #interval: 66 | # - interval: 1min 67 | # then: 68 | # - output.turn_on: output_pin_1 69 | # - delay: 5000ms 70 | #.............. 71 | # - sensor.publish: 72 | # id: analog_a2 73 | # state: !lambda |- 74 | # return id(analog_a2).state; 75 | #.............. 76 | 77 | # - platform: custom -attemp to use Lambda to call sensor 78 | # lambda: |- 79 | # return {ape_analog_input(ape, 2)}; 80 | 81 | # id(analog_a2).publish_state(); -I tried adding this to get the reading. 82 | # - component.update: analog_a2 -This was the orgianl call 83 | #I think the issue is this middle code 84 | # - delay: 2000ms 85 | # - output.turn_off: output_pin_1 86 | #................................ 87 | output: 88 | - platform: custom 89 | type: binary 90 | lambda: |- 91 | return {ape_binary_output(ape, 0), 92 | ape_binary_output(ape, 1), 93 | ape_binary_output(ape, 2)}; 94 | outputs: 95 | - id: output_pin_0 96 | inverted: true 97 | - id: output_pin_1 98 | inverted: true 99 | - id: output_pin_2 100 | inverted: true 101 | 102 | 103 | switch: 104 | - platform: output 105 | name: veg_relay_1 106 | output: output_pin_0 107 | 108 | - platform: output 109 | name: veg_relay_2 110 | output: output_pin_1 111 | 112 | - platform: output 113 | name: veg_relay_3 114 | output: output_pin_2 115 | -------------------------------------------------------------------------------- /experiments/test.vl53l0x.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | api: 9 | 10 | ota: 11 | 12 | logger: 13 | level: VERBOSE 14 | 15 | wifi: 16 | ssid: !secret wifi_ssid 17 | password: !secret wifi_pass 18 | output_power: 20.5dB 19 | manual_ip: 20 | static_ip: 10.0.1.199 21 | gateway: 10.0.1.1 22 | subnet: 255.0.0.0 23 | 24 | i2c: 25 | 26 | sensor: 27 | - platform: vl53l0x 28 | name: "VL53L0x Distance" 29 | update_interval: 2s 30 | -------------------------------------------------------------------------------- /experiments/test.water.sensor.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local 3 | platform: ESP8266 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | logger: 9 | level: VERY_VERBOSE 10 | 11 | wifi: 12 | ssid: !secret wifi_ssid 13 | password: !secret wifi_pass 14 | 15 | api: 16 | 17 | ota: 18 | 19 | sensor: 20 | - platform: pulse_counter 21 | pin: GPIO12 #D6 22 | name: "Tanque agua flujo entrada" 23 | update_interval: 5s 24 | filters: 25 | - lambda: return (x / 27.0) * 60.0; 26 | 27 | unit_of_measurement: "L/hr" 28 | - platform: pulse_counter 29 | pin: D5 # 30 | name: "Tanque agua flujo entrada D5" 31 | update_interval: 5s 32 | unit_of_measurement: "L/hr" 33 | -------------------------------------------------------------------------------- /experiments/test.web_server_spa.yaml: -------------------------------------------------------------------------------- 1 | # single test esp12f led (GPIO2) and some boards (GPIO16 led) 2 | # leds are toggled with GPIO0 (usually built in flash button) 3 | 4 | esphome: 5 | name: test_esp8266 6 | platform: ESP8266 7 | board: nodemcuv2 8 | platformio_options: 9 | upload_speed: 921600 10 | 11 | logger: 12 | level: VERBOSE 13 | logs: 14 | api.service: DEBUG 15 | display.tm1637: DEBUG 16 | 17 | packages: 18 | wifi: !include ../package.wifi.yaml 19 | 20 | api: 21 | 22 | ota: 23 | 24 | web_server_spa: 25 | app_path: '../../esphome-react/esphome-react/build' 26 | 27 | 28 | # web_server: 29 | 30 | switch: 31 | - platform: template 32 | name: sw1 33 | id: sw1 34 | turn_on_action: 35 | - logger.log: 'sw1 on turn on' 36 | 37 | - globals.set: 38 | id: counter_global 39 | value: '0' 40 | - sensor.template.publish: 41 | id: count 42 | state: '0' 43 | - globals.set: 44 | id: counter_long 45 | value: '0' 46 | - sensor.template.publish: 47 | id: count_long 48 | state: '0' 49 | 50 | 51 | 52 | binary_sensor: 53 | - platform: gpio 54 | name: barrera 55 | pin: 56 | number: GPIO14 57 | mode: input_pullup 58 | id: ir_barrier 59 | filters: 60 | # minimum time needed to count 61 | - delayed_off: 500ms 62 | # minimum time wait between count 63 | - delayed_on: 1500ms 64 | 65 | on_release: 66 | - globals.set: 67 | id: counter_global 68 | value: !lambda 'return id(counter_global) + 1;' 69 | - sensor.template.publish: 70 | id: count 71 | state: !lambda 'return id(counter_global);' 72 | - script.execute: script_count_long 73 | on_press: 74 | - script.stop: script_count_long 75 | 76 | script: 77 | - id: script_count_long 78 | mode: restart 79 | then: 80 | - delay: 4500ms 81 | - globals.set: 82 | id: counter_long 83 | value: !lambda 'return id(counter_long) + 1;' 84 | - sensor.template.publish: 85 | id: count_long 86 | state: !lambda 'return id(counter_long);' 87 | 88 | 89 | globals: 90 | - id: counter_global 91 | type: int 92 | restore_value: no 93 | initial_value: '0' 94 | 95 | - id: counter_long 96 | type: int 97 | restore_value: no 98 | initial_value: '0' 99 | 100 | sensor: 101 | - platform: template 102 | name: count 103 | id: count 104 | lambda: 'return id(counter_global);' 105 | - platform: template 106 | name: count_long 107 | id: count_long 108 | lambda: 'return id(counter_long);' 109 | 110 | display: 111 | platform: tm1637 112 | id: tm1637_display 113 | clk_pin: D6 114 | dio_pin: D7 115 | update_interval: 100ms 116 | lambda: |- 117 | it.printf("%4d", id(counter_global)); -------------------------------------------------------------------------------- /experiments/test.ws2812b.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | wifi: 9 | ssid: !secret wifi_ssid 10 | password: !secret wifi_pass 11 | fast_connect: true 12 | 13 | # Enable logging 14 | 15 | logger: 16 | level: DEBUG 17 | baud_rate: 0 18 | 19 | ota: 20 | 21 | # Example configuration entry 22 | api: 23 | 24 | light: 25 | - platform: neopixelbus 26 | variant: WS2812 27 | num_leds: 138 28 | pin: GPIO3 29 | name: "LampEspejoBanio" 30 | id: led 31 | 32 | effects: 33 | - random: 34 | - random: 35 | name: Random Effect With Custom Values 36 | transition_length: 5s 37 | update_interval: 7s 38 | - addressable_rainbow: 39 | name: Rainbow Effect With Custom Values 40 | speed: 10 41 | width: 50 42 | 43 | - platform: partition 44 | name: "LampEspejoBanio_Izquierda" 45 | segments: 46 | - id: led 47 | from: 0 48 | to: 44 49 | 50 | - platform: partition 51 | name: "LampEspejoBanio_Arriba" 52 | segments: 53 | - id: led 54 | from: 45 55 | to: 68 56 | 57 | - platform: partition 58 | name: "LampEspejoBanio_Derecha" 59 | segments: 60 | - id: led 61 | from: 69 62 | to: 113 63 | 64 | - platform: partition 65 | name: "LampEspejoBanio_Abajo" 66 | segments: 67 | - id: led 68 | from: 114 69 | to: 137 70 | -------------------------------------------------------------------------------- /experiments/test.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test-completions 3 | 4 | sensor: 5 | - platform: adc # Polling component 6 | on_value: 7 | -------------------------------------------------------------------------------- /experiments/test_base.yaml: -------------------------------------------------------------------------------- 1 | substitutions: 2 | num: "23" 3 | device: esp${num} 4 | 5 | packages: 6 | wifi_info: !include wifi_info.yaml 7 | 8 | esphome: 9 | name: ${device} 10 | build_path: ./build/${device} 11 | 12 | wifi: 13 | ap: 14 | ssid: ${device}_AP 15 | password: testtestAP 16 | manual_ip: 17 | static_ip: 192.168.1.1${num} 18 | gateway: 192.168.1.1 19 | subnet: 255.255.255.0 20 | dns1: 192.168.1.1 21 | -------------------------------------------------------------------------------- /experiments/test_nec.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_nec 3 | platform: ESP8266 4 | board: nodemcu 5 | 6 | platformio_options: 7 | upload_speed: 921600 8 | 9 | logger: 10 | level: VERBOSE 11 | 12 | <<: !include ../common/wifi.yaml 13 | 14 | api: 15 | 16 | ota: 17 | 18 | remote_receiver: 19 | id: rcvr 20 | pin: 21 | number: D5 22 | inverted: True 23 | mode: INPUT_PULLUP 24 | tolerance: 50% 25 | dump: all 26 | 27 | remote_transmitter: 28 | carrier_duty_percent: 50% 29 | pin: D6 30 | 31 | switch: 32 | - platform: template 33 | name: "Edifier Mute" 34 | turn_on_action: 35 | - remote_transmitter.transmit_nec: 36 | address: 0x00FF 37 | command: 0x827D 38 | - platform: template 39 | name: "Hyundai Netflix" 40 | turn_on_action: 41 | - remote_transmitter.transmit_nec: 42 | address: 0xFD 43 | command: 0xC23D # 0x43 44 | - platform: template 45 | name: "Soundbar power" 46 | turn_on_action: 47 | - remote_transmitter.transmit_nec: 48 | address: 0xFF 49 | command: 0xA25D 50 | -------------------------------------------------------------------------------- /experiments/test_packages_main.yaml: -------------------------------------------------------------------------------- 1 | substitutions: 2 | device_name: living_room 3 | friendly_device_name: Living room 4 | 5 | packages: 6 | wifi: !include test_packages/test_packages_package_wifi.yaml 7 | heating_base: !include test_packages/test_packages_package1.yaml 8 | 9 | 10 | esphome: 11 | name: ${device_name} 12 | 13 | api: 14 | services: 15 | - service: start_laundry 16 | then: 17 | - delay: 3h 18 | 19 | uart: 20 | rx_pin: GPIO12 21 | tx_pin: GPIO13 22 | baud_rate: 9600 23 | 24 | sensor: 25 | - platform: mhz19 26 | co2: 27 | name: "CO2" 28 | temperature: 29 | name: "Temperature" 30 | update_interval: 60s 31 | automatic_baseline_calibration: false 32 | -------------------------------------------------------------------------------- /experiments/test_pca8574.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp32 3 | platform: ESP32 4 | board: esp32doit-devkit-v1 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | logger: 9 | 10 | wifi: 11 | ssid: !secret wifi_ssid 12 | password: !secret wifi_pass 13 | 14 | api: 15 | 16 | ota: 17 | 18 | i2c: 19 | scan: true 20 | 21 | pcf8574: 22 | - address: 0x27 23 | 24 | switch: 25 | - platform: gpio 26 | pin: 27 | pcf8574: 28 | number: 0 29 | name: PCF8574_0 30 | -------------------------------------------------------------------------------- /experiments/test_servo.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_local2 3 | platform: ESP8266 4 | board: nodemcuv2 5 | esp8266_restore_from_flash: true 6 | 7 | wifi: 8 | ssid: !secret wifi_ssid 9 | password: !secret wifi_pass 10 | fast_connect: true 11 | 12 | # Enable logging 13 | 14 | # Enable logging 15 | logger: 16 | level: VERY_VERBOSE 17 | 18 | # Enable Home Assistant API 19 | 20 | ota: 21 | 22 | api: 23 | 24 | servo: 25 | - id: test_servo 26 | output: pwm_output 27 | min_level: 5% 28 | max_level: 10% 29 | restore: true 30 | 31 | 32 | # Example output platform 33 | # On ESP32, use ledc output 34 | output: 35 | - platform: esp8266_pwm 36 | id: pwm_output 37 | pin: D0 38 | frequency: 50 Hz 39 | 40 | globals: 41 | - id: servo_level 42 | type: float 43 | 44 | binary_sensor: 45 | - platform: gpio 46 | pin: 47 | number: D1 48 | mode: INPUT_PULLUP 49 | id: btn_up 50 | filters: 51 | - invert: 52 | 53 | - platform: gpio 54 | pin: 55 | number: D2 56 | mode: INPUT_PULLUP 57 | id: btn_down 58 | filters: 59 | - invert: 60 | 61 | - platform: gpio 62 | 63 | pin: 64 | number: D3 65 | mode: INPUT_PULLUP 66 | name: "DETACH" 67 | on_press: 68 | - servo.detach: test_servo 69 | 70 | interval: 71 | - interval: 1s 72 | then: 73 | - if: 74 | condition: 75 | binary_sensor.is_on: btn_up 76 | then: 77 | lambda: |- 78 | if (id(servo_level) < 1.0) id(servo_level) += 0.1; 79 | id(test_servo).write(id(servo_level)); 80 | 81 | 82 | - if: 83 | condition: 84 | binary_sensor.is_on: btn_down 85 | then: 86 | lambda: |- 87 | if (id(servo_level) > -1.0) id(servo_level) -= 0.1; 88 | id(test_servo).write(id(servo_level)); 89 | 90 | -------------------------------------------------------------------------------- /experiments/test_sim800.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | #name: test_local 3 | name: eh_planta_alta 4 | platform: ESP8266 5 | board: nodemcuv2 6 | 7 | # Enable logging 8 | logger: 9 | baud_rate: 0 # disable log by hardware UART 10 | level: DEBUG 11 | logs: 12 | i2c: DEBUG 13 | #sim800l: VERY_VERBOSE 14 | 15 | # Enable Home Assistant API 16 | api: 17 | 18 | ota: 19 | 20 | uart: 21 | id: sim800uart 22 | tx_pin: TX #D0 23 | rx_pin: RX #D1 24 | baud_rate: 9600 25 | 26 | sim800l: 27 | # uart_id: sim800uart 28 | id: sms 29 | 30 | on_sms_received: 31 | lambda: |- 32 | ESP_LOGD("main", "Received sms from %s: %s", sender.c_str(), message.c_str()); 33 | // id(received_sms_from).publish_state(sender); 34 | // id(received_sms_body).publish_state(message); 35 | setup_priority: 32 36 | uart_id: sim800uart 37 | update_interval: 12s 38 | 39 | # text_sensor: 40 | # - platform: template 41 | # id: received_sms_from 42 | # - platform: template 43 | # id: received_sms_body 44 | 45 | # font: 46 | # - file: "Roboto-Regular.ttf" 47 | # id: my_font 48 | # size: 14 49 | 50 | # i2c: 51 | # sda: D3 52 | # scl: D4 53 | binary_sensor: 54 | - platform: sim800l 55 | 56 | sensor: 57 | - platform: dht 58 | pin: D2 59 | model: DHT22 60 | 61 | temperature: 62 | name: "Estudio Test Temperature" 63 | id: estudio_test_dht_temp 64 | humidity: 65 | name: "Estudio Test Humidity" 66 | 67 | update_interval: 5s 68 | 69 | # display: 70 | # - platform: ssd1306_i2c 71 | # model: "SSD1306 128x64" 72 | # reset_pin: D0 73 | # address: 0x3C 74 | # lambda: |- 75 | # it.print(0, 0, id(my_font), id(received_sms_from).state.c_str()); 76 | # it.print(0, 14, id(my_font), id(received_sms_body).state.c_str()); 77 | 78 | climate: 79 | - platform: bang_bang 80 | id: bb 81 | sensor: estudio_test_dht_temp 82 | default_target_temperature_low: 10 83 | default_target_temperature_high: 20 84 | idle_action: 85 | lambda: |- 86 | return; 87 | cool_action: 88 | lambda: |- 89 | return; 90 | 91 | # # remote_transmitter: 92 | # # carrier_duty_percent: 50% 93 | # # pin: D5 94 | 95 | # # climate: 96 | # # platform: tcl112 97 | # # name: 'test AC TCL' 98 | -------------------------------------------------------------------------------- /experiments/test_tcl112.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_tcl112 3 | platform: esp32 4 | board: nodemcu 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | logger: 9 | level: VERBOSE 10 | 11 | 12 | wifi: 13 | ssid: !secret wifi_ssid 14 | password: !secret wifi_pass 15 | 16 | api: 17 | 18 | ota: 19 | 20 | dallas: 21 | - pin: D4 22 | id: dallas_component 23 | update_interval: 60s 24 | - pin: 25 | 26 | 27 | sensor: 28 | - platform: dallas 29 | dallas_id: dallas_component 30 | address: 0xF176C32712646128 31 | id: dallas_temp 32 | internal: true 33 | 34 | remote_receiver: 35 | id: rcvr 36 | pin: 37 | number: D5 38 | inverted: True 39 | mode: 40 | input: True 41 | pullup: True 42 | 43 | tolerance: 50% 44 | dump: raw 45 | 46 | remote_transmitter: 47 | carrier_duty_percent: 50% 48 | pin: D6 49 | 50 | climate: 51 | platform: coolix 52 | name: "New AC No Sensor" 53 | sensor: dallas_temp 54 | receiver_id: rcvr 55 | -------------------------------------------------------------------------------- /experiments/test_tm1637.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test_esp8266 3 | platform: ESP8266 4 | board: nodemcuv2 5 | platformio_options: 6 | upload_speed: 921600 7 | 8 | logger: 9 | level: VERBOSE 10 | 11 | wifi: 12 | ssid: !secret wifi_ssid 13 | password: !secret wifi_pass 14 | 15 | api: 16 | password: lelexe 17 | 18 | time: 19 | - platform: homeassistant 20 | id: homeassistant_time 21 | 22 | display: 23 | platform: tm1637 24 | id: laal 25 | clk_pin: D6 26 | dio_pin: D5 27 | update_interval: 500ms 28 | intensity: 3 29 | lambda: |- 30 | static int i = 0; 31 | i++; 32 | if ((i % 2) == 0) 33 | it.strftime("%H.%M", id(homeassistant_time).now()); 34 | else 35 | it.strftime("%H%M", id(homeassistant_time).now()); 36 | 37 | globals: 38 | - id: intensity 39 | type: int 40 | 41 | binary_sensor: 42 | - platform: gpio 43 | id: gpio0_ 44 | pin: GPIO0 45 | filters: 46 | - delayed_on: 10ms 47 | on_press: 48 | - then: 49 | lambda: |- 50 | id(intensity) += 1; 51 | if (id(intensity) == 8) 52 | id(intensity) = 0; 53 | id(laal).set_intensity(static_cast(id(intensity))); 54 | ESP_LOGD("main", "Intensity %d", id(intensity)); 55 | auto z = NAN; 56 | if (isnan(z)) 57 | ESP_LOGD("main", "isnan function works"); 58 | if (z == NAN) 59 | ESP_LOGD("main", "== NAN works"); 60 | -------------------------------------------------------------------------------- /experiments/test_waveshare.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: test 3 | on_boot: 4 | then: 5 | - delay: 20s 6 | - component.update: display_1 7 | 8 | esp32: 9 | board: node32s 10 | 11 | spi: 12 | clk_pin: GPIO22 13 | mosi_pin: GPIO23 14 | logger: 15 | 16 | font: 17 | - file: 18 | type: gfonts 19 | family: Roboto 20 | weight: 900 21 | id: font1 22 | size: 16 23 | 24 | display: 25 | - platform: waveshare_epaper 26 | id: display_1 27 | model: 4.20in 28 | cs_pin: GPIO21 29 | dc_pin: GPIO19 30 | busy_pin: GPIO18 31 | reset_pin: GPIO5 32 | rotation: 270 33 | reset_duration: 2ms 34 | #full_update_every: 30 35 | lambda: |- 36 | it.print(0, 0, id(font1), "GUILLOTE 2!"); 37 | #update_interval: never 38 | -------------------------------------------------------------------------------- /experiments/tmc_stepper_setup.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "esphome.h" 5 | 6 | class TMCStepperComponent : public Component, public UARTDevice 7 | { 8 | public: 9 | TMCStepperComponent(UARTComponent *parent) : UARTDevice(parent) {} 10 | 11 | void setup() override 12 | { 13 | TMC2209Stepper stepper_driver(this, 0.15f, 0b00); 14 | stepper_driver.pdn_disable(true); 15 | stepper_driver.begin(); 16 | stepper_driver.microsteps(64); 17 | stepper_driver.TCOOLTHRS(910); 18 | stepper_driver.rms_current(600); 19 | stepper_driver.SGTHRS(20); 20 | 21 | stepper_driver.en_spreadCycle(false); 22 | 23 | //DRIVER SETUP 24 | 25 | //stepper_driver.TPWMTHRS(0); 26 | /*stepper_driver.semin(0); 27 | stepper_driver.semax(2); 28 | stepper_driver.sedn(0b00); 29 | stepper_driver.toff(4); 30 | stepper_driver.blank_time(24); 31 | 32 | */ 33 | } 34 | void loop() override 35 | { 36 | } 37 | }; -------------------------------------------------------------------------------- /experiments/web-spa-react/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | !/** 3 | 4 | # dependencies 5 | /node_modules 6 | /.pnp 7 | .pnp.js 8 | 9 | # testing 10 | /coverage 11 | 12 | # production 13 | /build 14 | 15 | # misc 16 | .DS_Store 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | -------------------------------------------------------------------------------- /experiments/web-spa-react/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `npm start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `npm test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `npm run build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `npm run eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | -------------------------------------------------------------------------------- /experiments/web-spa-react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "esphome-react", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@material-ui/core": "^4.11.0", 7 | "@types/node": "^12.12.54", 8 | "@types/react": "^16.9.46", 9 | "@types/react-dom": "^16.9.8", 10 | "react": "^16.13.1", 11 | "react-dom": "^16.13.1", 12 | "typescript": "^3.7.5" 13 | }, 14 | "devDependencies": { 15 | "@testing-library/jest-dom": "^4.2.4", 16 | "@testing-library/react": "^9.5.0", 17 | "@testing-library/user-event": "^7.2.1", 18 | "@types/jest": "^24.9.1", 19 | "react-scripts": "3.4.3" 20 | }, 21 | "scripts": { 22 | "start": "react-scripts start", 23 | "build": "react-scripts build", 24 | "test": "react-scripts test", 25 | "eject": "react-scripts eject" 26 | }, 27 | "eslintConfig": { 28 | "extends": "react-app" 29 | }, 30 | "browserslist": { 31 | "production": [ 32 | ">0.2%", 33 | "not dead", 34 | "not op_mini all" 35 | ], 36 | "development": [ 37 | "last 1 chrome version", 38 | "last 1 firefox version", 39 | "last 1 safari version" 40 | ] 41 | } 42 | } -------------------------------------------------------------------------------- /experiments/web-spa-react/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/experiments/web-spa-react/public/favicon.ico -------------------------------------------------------------------------------- /experiments/web-spa-react/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /experiments/web-spa-react/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/experiments/web-spa-react/public/logo192.png -------------------------------------------------------------------------------- /experiments/web-spa-react/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/experiments/web-spa-react/public/logo512.png -------------------------------------------------------------------------------- /experiments/web-spa-react/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /experiments/web-spa-react/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /experiments/web-spa-react/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /experiments/web-spa-react/src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | const { getByText } = render(); 7 | const linkElement = getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /experiments/web-spa-react/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import logo from './logo.svg'; 3 | import './App.css'; 4 | import ESPHome, { useEventSource, useEventSourceListener } from './esphome/esphome-client'; 5 | import { Button, FormControlLabel, Switch, Typography } from '@material-ui/core'; 6 | 7 | type ESPHomeState = { 8 | switch_sw1: boolean, 9 | sensor_count: number, 10 | sensor_count_long: number, 11 | }; 12 | 13 | //dev_node='test_esp8266.local' 14 | function App() { 15 | const url = "http://test_esp8266.local"; 16 | const [logs, setLog] = useState([]); 17 | 18 | const [esphome, setEsphome] = useState( 19 | { 20 | switch_sw1: false, 21 | sensor_count: 0, 22 | sensor_count_long: 0, 23 | }); 24 | 25 | const [eventSource, eventSourceStatus] = useEventSource(url + "/events", false); 26 | useEventSourceListener(eventSource, ['log'], evt => { 27 | // setLog([ 28 | // ...logs, 29 | // //...JSON.parse(evt.data) 30 | // evt.data 31 | // ]); 32 | console.log('esphome: ', evt.data); 33 | }, [logs]); 34 | useEventSourceListener(eventSource, ['state'], evt => { 35 | const data = JSON.parse(evt.data); 36 | const id = (data.id as string).replace('-', '_'); 37 | setEsphome({ 38 | ...esphome, 39 | [id]: data.value 40 | }); 41 | }, [esphome]); 42 | 43 | const setSwitch = (id: string, state: boolean) => { 44 | fetch(`${url}/switch/${id}/turn_${state ? "on" : "off"}`, { method: 'POST' }); 45 | }; 46 | 47 | return ( 48 |
49 |
Comunicación: {eventSourceStatus}
50 | 51 | Cuenta Bolsas 52 | 53 | 54 | Comun: {esphome.sensor_count} 55 | 56 | 57 | 58 | Largas: {esphome.sensor_count_long} 59 | 60 | {/* 61 | setSwitch("sw1", !esphome.switch_sw1)} />} 63 | label="Small" 64 | /> */} 65 | 66 | 67 | 68 | {/*
69 | {eventSourceStatus === "open" ? null :
Loading...
} 70 | {logs.map((msg) =>
{msg}
)} 71 |
*/} 72 |
73 | ); 74 | 75 | } 76 | 77 | export default App; 78 | -------------------------------------------------------------------------------- /experiments/web-spa-react/src/esphome/esphome-client.ts: -------------------------------------------------------------------------------- 1 | import { Component } from "react"; 2 | 3 | import { useEffect, useRef, useState } from "react"; 4 | 5 | class ESPHome extends Component { 6 | 7 | // private const source: EventSource; 8 | 9 | // constructor(devUrl: string) { 10 | // super(); 11 | 12 | // source = new EventSource("http://test_esp8266.local/events"); 13 | 14 | // this.source.addEventListener("x", {}); 15 | // } 16 | 17 | 18 | }; 19 | 20 | export default ESPHome; 21 | 22 | // source.addEventListener('log', function (e) { 23 | // const log = document.getElementById("log"); 24 | // let klass = ''; 25 | // if (e.data.startsWith("")) { 26 | // klass = 'e'; 27 | // } else if (e.data.startsWith("")) { 28 | // klass = 'w'; 29 | // } else if (e.data.startsWith("")) { 30 | // klass = 'i'; 31 | // } else if (e.data.startsWith("")) { 32 | // klass = 'c'; 33 | // } else if (e.data.startsWith("")) { 34 | // klass = 'd'; 35 | // } else if (e.data.startsWith("")) { 36 | // klass = 'v'; 37 | // } else { 38 | // log.innerHTML += e.data + '\n'; 39 | // } 40 | // log.innerHTML += '' + e.data.substr(7, e.data.length - 10) + "\n"; 41 | // }); 42 | 43 | // source.addEventListener('state', function (e) { 44 | // const data = JSON.parse(e.data); 45 | // document.getElementById(data.id).children[1].innerText = data.state; 46 | // }); 47 | 48 | // const states = document.getElementById("states"); 49 | // let i = 0, row; 50 | // for (; row = states.rows[i]; i++) { 51 | // if (row.classList.contains("switch")) { 52 | // (function (id) { 53 | // row.children[2].children[0].addEventListener('click', function () { 54 | // const xhr = new XMLHttpRequest(); 55 | // xhr.open("POST", '/switch/' + id.substr(7) + '/toggle', true); 56 | // xhr.send(); 57 | // }); 58 | // })(row.id); 59 | // } 60 | // if (row.classList.contains("fan")) { 61 | // (function (id) { 62 | // row.children[2].children[0].addEventListener('click', function () { 63 | // const xhr = new XMLHttpRequest(); 64 | // xhr.open("POST", '/fan/' + id.substr(4) + '/toggle', true); 65 | // xhr.send(); 66 | // }); 67 | // })(row.id); 68 | // } 69 | // if (row.classList.contains("light")) { 70 | // (function (id) { 71 | // row.children[2].children[0].addEventListener('click', function () { 72 | // const xhr = new XMLHttpRequest(); 73 | // xhr.open("POST", '/light/' + id.substr(6) + '/toggle', true); 74 | // xhr.send(); 75 | // }); 76 | // })(row.id); 77 | // } 78 | // if (row.classList.contains("cover")) { 79 | // (function (id) { 80 | // row.children[2].children[0].addEventListener('click', function () { 81 | // const xhr = new XMLHttpRequest(); 82 | // xhr.open("POST", '/cover/' + id.substr(6) + '/open', true); 83 | // xhr.send(); 84 | // }); 85 | // row.children[2].children[1].addEventListener('click', function () { 86 | // const xhr = new XMLHttpRequest(); 87 | // xhr.open("POST", '/cover/' + id.substr(6) + '/close', true); 88 | // xhr.send(); 89 | // }); 90 | // })(row.id); 91 | // } 92 | // } 93 | 94 | 95 | type EventSourceConstructor = { new(url: string, eventSourceInitDict?: EventSourceInit): EventSource }; 96 | 97 | export type EventSourceStatus = "init" | "open" | "closed" | "error"; 98 | 99 | export type EventSourceEvent = Event & { data: string }; 100 | 101 | export function useEventSource(url: string, withCredentials?: boolean, ESClass: EventSourceConstructor = EventSource) { 102 | const source = useRef(null); 103 | const [status, setStatus] = useState("init"); 104 | useEffect(() => { 105 | if (url) { 106 | const es = new ESClass(url, { withCredentials }); 107 | source.current = es; 108 | 109 | es.addEventListener("open", () => setStatus("open")); 110 | es.addEventListener("error", () => setStatus("error")); 111 | 112 | return () => { 113 | source.current = null; 114 | es.close(); 115 | }; 116 | } 117 | 118 | setStatus("closed"); 119 | }, [url, withCredentials, ESClass]); 120 | 121 | return [source.current, status] as const; 122 | } 123 | 124 | export function useEventSourceListener( 125 | source: EventSource | null, 126 | types: string[], 127 | listener: (e: EventSourceEvent) => void, 128 | dependencies: any[] = [] 129 | ) { 130 | useEffect(() => { 131 | if (source) { 132 | types.forEach((type) => source.addEventListener(type, listener as any)); 133 | return () => types.forEach((type) => source.removeEventListener(type, listener as any)); 134 | } 135 | }, [source, ...dependencies]); 136 | } -------------------------------------------------------------------------------- /experiments/web-spa-react/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /experiments/web-spa-react/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | 6 | ReactDOM.render( 7 | 8 | 9 | , 10 | document.getElementById('root') 11 | ); 12 | -------------------------------------------------------------------------------- /experiments/web-spa-react/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /experiments/web-spa-react/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /experiments/web-spa-react/src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /experiments/web-spa-react/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "noEmit": true, 20 | "jsx": "react" 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /experiments/wifi_info.yaml: -------------------------------------------------------------------------------- 1 | text_sensor: 2 | - platform: wifi_info 3 | bssid: 4 | name: ${device} Connected BSSID 5 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/logo.png -------------------------------------------------------------------------------- /package.wifi.yaml: -------------------------------------------------------------------------------- 1 | 2 | wifi: 3 | ssid: !secret wifi_ssid 4 | password: !secret wifi_pass -------------------------------------------------------------------------------- /pixelmix.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/pixelmix.ttf -------------------------------------------------------------------------------- /secrets.yaml: -------------------------------------------------------------------------------- 1 | # required for actions 2 | wifi_ssid: wifi_ssid 3 | wifi_pass: password 4 | -------------------------------------------------------------------------------- /smile.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/smile.bmp -------------------------------------------------------------------------------- /smile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/smile.png -------------------------------------------------------------------------------- /test.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glmnet/esphome_devices/cb4faf28072c7bf58649aba4d9ddb18e13fb2d32/test.txt --------------------------------------------------------------------------------