Bazmundi

ESPHOME ttgo t-camera yaml with mqtt

Mar 6th, 2021 (edited)
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. esphome:
  2. name: t_camv162c
  3. platform: ESP32
  4. board: esp-wrover-kit
  5.  
  6. wifi:
  7. ssid: "xxxxx"
  8. password: "xxxxx"
  9. manual_ip:
  10. static_ip: xxx.xxx.xxx.xxx
  11. subnet: xxx.xxx.xxx.xxx
  12. gateway: xxx.xxx.xxx.xxx
  13.  
  14.  
  15. # Enable fallback hotspot (captive portal) in case wifi connection fails
  16. ap:
  17. ssid: "xxx"
  18. password: "xxx"
  19.  
  20. captive_portal:
  21.  
  22. # Enable logging
  23. logger:
  24.  
  25. # Enable Home Assistant API
  26. api:
  27.  
  28. ota:
  29.  
  30. mqtt:
  31. broker: 192.168.1.130
  32. topic_prefix: /os/cameras/b8f009c0d984
  33. birth_message:
  34. topic: /os/cameras/status
  35. payload: "b8f009c0d984 online"
  36. will_message:
  37. topic: /os/cameras/status
  38. payload: "b8f009c0d984 lost"
  39. shutdown_message:
  40. topic: /os/cameras/status
  41. payload: "b8f009c0d984 offline"
  42. log_topic: /os/debug
  43. client_id: b8f009c0d984
  44. on_message:
  45. topic: /os/soundOff
  46. then:
  47. - mqtt.publish_json:
  48. topic: !lambda |-
  49. return "/os/herald";
  50. payload: !lambda |-
  51. root["gadgetType"] = 3;
  52. root["gadgetId"] = get_mac_address();
  53. root["online"] = 1;
  54.  
  55.  
  56. binary_sensor:
  57. - platform: gpio
  58. pin: GPIO19
  59. name: PIR
  60. id: movement
  61. device_class: motion
  62. on_state:
  63. then:
  64. - mqtt.publish:
  65. topic: !lambda |-
  66. return "/os/cameras/" + get_mac_address() +"/motion";
  67. payload: !lambda |-
  68. return id(movement).state ? "1" : "0";
  69.  
  70. - platform: gpio
  71. pin:
  72. number: GPIO15
  73. mode: INPUT_PULLUP
  74. inverted: True
  75. name: Button
  76.  
  77. - platform: status
  78. name: Status
  79.  
  80. sensor:
  81. - platform: wifi_signal
  82. name: WiFi Signal
  83. update_interval: 10s
  84. - platform: uptime
  85. name: Uptime
  86.  
  87. esp32_camera:
  88. name: Camera
  89. external_clock:
  90. pin: GPIO4
  91. frequency: 20MHz
  92. i2c_pins:
  93. sda: GPIO18
  94. scl: GPIO23
  95. data_pins: [GPIO34, GPIO13, GPIO14, GPIO35, GPIO39, GPIO38, GPIO37, GPIO36]
  96. vsync_pin: GPIO5
  97. href_pin: GPIO27
  98. pixel_clock_pin: GPIO25
  99. # power_down_pin: GPIO26
  100. resolution: 640x480
  101. jpeg_quality: 10
  102. vertical_flip: true
  103. horizontal_mirror: true
  104.  
  105. i2c:
  106. sda: GPIO21
  107. scl: GPIO22
  108.  
  109. font:
  110. - file: "fonts/times-new-roman.ttf"
  111. id: tnr1
  112. size: 20
  113. - file: "fonts/times-new-roman.ttf"
  114. id: tnr2
  115. size: 35
  116. - file: "fonts/times-new-roman.ttf"
  117. id: tnr3
  118. size: 70
  119.  
  120.  
  121. time:
  122. - platform: homeassistant
  123. id: homeassistant_time
  124.  
  125. display:
  126. - platform: ssd1306_i2c
  127. model: "SSD1306 128x64"
  128. address: 0x3C
  129. rotation: 180
  130. lambda: |-
  131.  
  132. if(id(movement).state) {
  133. it.print(64, 54, id(tnr3), TextAlign::BASELINE_CENTER, "Boo!");
  134. } else {
  135. it.strftime(64, 0, id(tnr1), TextAlign::TOP_CENTER,"%d-%m-%Y", id(homeassistant_time).now());
  136. it.strftime(64, 64, id(tnr2), TextAlign::BASELINE_CENTER, "%H:%M", id(homeassistant_time).now());
  137. }
Add Comment
Please, Sign In to add comment