esphome: name: laundry platform: ESP8266 board: nodemcuv2 logger: level: INFO ota: password: "03af999284928f8525c82a13771a4a4f" wifi: ssid: !secret ssid password: !secret pass fast_connect: true mqtt: broker: henry.int.jnf.me username: esphome password: esphome topic_prefix: esphome/laundry i2c: sda: D6 scl: D5 scan: True id: bus_a sensor: - platform: mpu6050 address: 0x68 update_interval: 1s gyro_x: name: "Dryer Gyro X" id: dryer_gyro_x internal: true gyro_y: name: "Dryer Gyro Y" id: dryer_gyro_y internal: true gyro_z: name: "Dryer Gyro Z" id: dryer_gyro_z internal: true temperature: name: "Dryer Temperature" filters: - throttle: 30s - platform: mpu6050 address: 0x69 update_interval: 1s gyro_x: name: "Washer Gyro X" id: washer_gyro_x internal: true gyro_y: name: "Washer Gyro Y" id: washer_gyro_y internal: true gyro_z: name: "Washer Gyro Z" id: washer_gyro_z internal: true temperature: name: "Washer Temperature" filters: - throttle: 30s - platform: template name: "Dryer Gyro All" id: dryer_gyro_all unit_of_measurement: °/s² lambda: |- return fabs(id(dryer_gyro_x).state) + fabs(id(dryer_gyro_y).state) + fabs(id(dryer_gyro_z).state); update_interval: 1s filters: - lambda: |- static float last_dryer_value = 0; static float dryer_change = 0; dryer_change = x - last_dryer_value; last_dryer_value = x; return fabs(dryer_change); - sliding_window_moving_average: window_size: 120 send_every: 10 - platform: template name: "Washer Gyro All" id: washer_gyro_all unit_of_measurement: °/s² lambda: |- return fabs(id(washer_gyro_x).state) + fabs(id(washer_gyro_y).state) + fabs(id(washer_gyro_z).state); update_interval: 1s filters: - lambda: |- static float last_washer_value = 0; static float washer_change = 0; washer_change = x - last_washer_value; last_washer_value = x; return fabs(washer_change); - sliding_window_moving_average: window_size: 120 send_every: 10 binary_sensor: - platform: template name: "Dryer" id: dryer lambda: |- if (id(dryer_gyro_all).state >= 2.0) { return true; } else { return false; } filters: - delayed_on: 30s - delayed_off: 60s - platform: template name: "Washer" id: washer lambda: |- if (id(washer_gyro_all).state >= 1.0) { return true; } else { return false; } filters: - delayed_on: 30s - delayed_off: 120s