Advertisement
to4ko

Untitled

Jul 27th, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. substitutions:
  2. board_name: d1mini_co2_mb
  3.  
  4. esphome:
  5. name: d1mini_co2_mb
  6. platform: ESP8266
  7. board: d1_mini
  8.  
  9. wifi:
  10. ssid: !secret wifi_ssid
  11. password: !secret wifi_pass
  12. domain: .localdomain
  13. reboot_timeout: 0s
  14. manual_ip:
  15. static_ip: 192.168.1.104
  16. gateway: 192.168.1.1
  17. subnet: 255.255.255.0
  18.  
  19.  
  20. # Enable logging
  21. logger:
  22.  
  23. # Enable Home Assistant API
  24. api:
  25. reboot_timeout: 0s
  26.  
  27. ota:
  28.  
  29. # web_server:
  30. # port: 80
  31.  
  32. binary_sensor:
  33. - platform: status
  34. name: ${board_name}_Status
  35.  
  36. uart:
  37. rx_pin: D1
  38. tx_pin: D2
  39. baud_rate: 9600
  40.  
  41. text_sensor:
  42. - platform: template
  43. name: ${board_name}_Uptime
  44. lambda: |-
  45. uint32_t dur = id(uptime_sensor).state;
  46. int dys = 0;
  47. int hrs = 0;
  48. int mnts = 0;
  49. if (dur > 86399) {
  50. dys = trunc(dur / 86400);
  51. dur = dur - (dys * 86400);
  52. }
  53. if (dur > 3599) {
  54. hrs = trunc(dur / 3600);
  55. dur = dur - (hrs * 3600);
  56. }
  57. if (dur > 59) {
  58. mnts = trunc(dur / 60);
  59. dur = dur - (mnts * 60);
  60. }
  61. char buffer[17];
  62. sprintf(buffer, "%ud %02uh %02um %02us", dys, hrs, mnts, dur);
  63. return {buffer};
  64. icon: mdi:clock-start
  65. update_interval: 15s
  66.  
  67. sensor:
  68. - platform: uptime
  69. name: ${board_name}_Uptime_s
  70. id: uptime_sensor
  71. update_interval: 15s
  72.  
  73. - platform: mhz19
  74. co2:
  75. name: "Z19 CO2 MB"
  76. temperature:
  77. name: "Z19 Temp MB"
  78. update_interval: 60s
  79.  
  80. - platform: wifi_signal
  81. name: ${board_name}_WiFi_RSSI
  82. update_interval: 60s
  83.  
  84. switch:
  85. - platform: restart
  86. name: ${board_name}_Restart
  87.  
  88. time:
  89. - platform: homeassistant
  90. id: homeassistant_time
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement