/ tech

Cube motion Sensor

Petit projet sur l'idée d'un pote.

Cube réalisé sous Fusion360, avec 4 faces utilisables.
chaque face a sa fonction :

  • Eteint les lumieres du salon
  • Allume les lumières du salon
  • Mode soirée (change les couleurs des lampes du salon toutes les 3 minutes avec transition)
  • Mode Cinéma (basé sous le statut de plex)

A imprimer en 0.20 avec 15% de remplissage, activer les supports pour chacune des pièces.

Partie modelisation 3D

https://www.thingiverse.com/thing:4242851

Partie EspHOME

esphome:
  name: chambreami
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "wifi SSID"
  password: "*******"
  power_save_mode: none
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Chambreami Fallback Hotspot"
    password: "Ax48LmP4nlLxI"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "*******"

ota:
  password: "*******"

i2c:
  - sda: D5
    scl: D3
    scan: True

sensor:
  - platform: wifi_signal
    name: "Chambre ami WiFi Signal Sensor"
    update_interval: 60s
  - platform: uptime
    name: 3D Uptime Sensor
  - platform: mpu6050
    address: 0x68
    update_interval: 2s
    accel_x:
      id: accel_x
      name: "MPU6050 Accel x"      
    accel_y:
      id: accel_y    
      name: "MPU6050 Accel Y"
    accel_z:
      id: accel_z    
      name: "MPU6050 Accel z"
    gyro_x:
      name: "MPU6050 Gyro X"
    gyro_y:
      name: "MPU6050 Gyro Y"
    gyro_z:
      name: "MPU6050 Gyro z"
    temperature:
      name: "MPU6050 Temperature"
  - platform: template
    name: "AccelX"
    id: accelx
    lambda: |-
      if ((id(accel_x).state) > 5) {
      return 10;
      }
      else
      {
      if ((id(accel_x).state) > 0) {
      return 1;
      }
      else {
      return -1;
      }
      }
    update_interval: 2s
  - platform: template
    name: "AccelY"
    id: accely
    lambda: |-
      if ((id(accel_y).state) > 5) {
      return 10;
      }
      else
      {
      if ((id(accel_y).state) > 0) {
      return 1;
      }
      else {
      return -1;
      }
      }
    update_interval: 2s
  - platform: template
    name: "AccelZ"
    id: accelz
    lambda: |-
      if ((id(accel_z).state) > 5) {
      return 10;
      }
      else
      {
      if ((id(accel_z).state) > 0) {
      return 1;
      }
      else {
      return -1;
      }
      }
    update_interval: 2s    

text_sensor:    
  - platform: version
    name: "ESPHome Version"
  - platform: wifi_info
    ip_address:
      name: Chambre ami IP Address    
  - platform: template
    update_interval: 2s  
    name: "Move"
    lambda: |-
      if ((((id(accelx).state) == -1.0) && ((id(accely).state) == -1.0) && ((id(accelz).state) == 1.0)) || (((id(accelx).state) == -1.0) && ((id(accely).state) == 1.0) && ((id(accelz).state) == 1.0))) {
      return {"Eteint"};
      }
      else
      {
      if ((((id(accelx).state) == 1.0) && ((id(accely).state) == 10.0) && ((id(accelz).state) == 1.0)) || (((id(accelx).state) == 1.0) && ((id(accely).state) == 10.0) && ((id(accelz).state) == -1.0)) || (((id(accelx).state) == 1.0) && ((id(accely).state) == 10.0) && ((id(accelz).state) == -1.0)) || (((id(accelx).state) == -1.0) && ((id(accely).state) == 10.0) && ((id(accelz).state) == -1.0))) {
      return {"Allume"};
      }
      else
      {
      if ((((id(accelx).state) == 10.0) && ((id(accely).state) == -1.0) && ((id(accelz).state) == -1.0)) || (((id(accelx).state) == 10.0) && ((id(accely).state) == 1.0) && ((id(accelz).state) == 1.0)) || (((id(accelx).state) == 10.0) && ((id(accely).state) == 1.0) && ((id(accelz).state) == -1.0))) {
      return {"Cinema"};
      }
      else
      {
      if ((((id(accelx).state) == 1.0) && ((id(accely).state) == -1.0) && ((id(accelz).state) == -1.0)) || (((id(accelx).state) == 1.0) && ((id(accely).state) == -1.0) && ((id(accelz).state) == 1.0))) {
      return {"Soiree"};
      }
      else
      {
      return {"Rien"};
      }
      }
      }
      }

Photos

IMG_20200325_155448

IMG_20200325_155453

IMG_20200325_155500

IMG_20200327_112813

IMG_20200327_112819

Cube motion Sensor
Share this