ff-bath-bt-proxy-02.yaml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. substitutions:
  2. devicename: ff-bath-bt-proxy-02
  3. low_devicename: ff_bath_bt_proxy_02
  4. friendly_devicename: FF Bath Bluetooth Proxy
  5. # globals:
  6. # - id: asia_low
  7. # type: float
  8. # initial_value: '60.0'
  9. # - id: asia_high
  10. # type: float
  11. # initial_value: '94.95'
  12. # - id: patryk_low
  13. # type: float
  14. # initial_value: '95.0'
  15. # - id: patryk_high
  16. # type: float
  17. # initial_value: '120.0'
  18. # - id: ala_low
  19. # type: float
  20. # initial_value: '10.0'
  21. # - id: ala_high
  22. # type: float
  23. # initial_value: '20.0'
  24. esphome:
  25. name: $devicename
  26. friendly_name: $friendly_devicename
  27. esp32:
  28. board: esp32dev
  29. framework:
  30. # type: arduino
  31. type: esp-idf
  32. # sdkconfig_options:
  33. # CONFIG_BT_BLE_50_FEATURES_SUPPORTED: y
  34. # CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
  35. # CONFIG_BOOTLOADER_WDT_ENABLE: n
  36. # CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE: y
  37. # CONFIG_ESP_INT_WDT: n
  38. # CONFIG_ESP_TASK_WDT: n
  39. # CONFIG_INT_WDT: n
  40. # CONFIG_TASK_WDT: n
  41. packages:
  42. # Enable Home Assistant API
  43. esphome: !include common/keys.yaml
  44. diag: !include common/diag.yaml
  45. # Enable logging
  46. logger:
  47. web_server:
  48. port: 80
  49. wifi:
  50. ssid: !secret iot_ssid
  51. password: !secret iot_password
  52. domain: .int.mmax.cloud
  53. esp32_ble_tracker:
  54. # scan_parameters:
  55. # We currently use the defaults to ensure Bluetooth
  56. # can co-exist with WiFi In the future we may be able to
  57. # enable the built-in coexistence logic in ESP-IDF
  58. # active: true
  59. # bluetooth_proxy:
  60. # active: true
  61. time:
  62. - platform: homeassistant
  63. id: esptime
  64. sensor:
  65. - platform: template
  66. name: "Xiaomi Mi Scale Weight Time"
  67. id: xiaomi_weight_time
  68. lambda: "return id(xiaomi_weight_time).state;"
  69. device_class: timestamp
  70. - platform: xiaomi_miscale
  71. mac_address: 'd0:3e:7d:3e:e3:5e'
  72. clear_impedance: true
  73. weight:
  74. name: "Xiaomi Mi Scale Weight"
  75. id: weight_miscale
  76. # force_update: true
  77. filters:
  78. - timeout:
  79. timeout: 30s
  80. value: !lambda return 0;
  81. on_value:
  82. then:
  83. - sensor.template.publish:
  84. id: xiaomi_weight_time
  85. state: !lambda "return id(esptime).now().timestamp;"
  86. # on_value:
  87. # then:
  88. # - lambda: |-
  89. # if (id(weight_miscale).state >= id(asia_low) && id(weight_miscale).state <= id(asia_high)) {
  90. # return id(weight_user_asia).publish_state(x);}
  91. # else if (id(weight_miscale).state >= id(patryk_low) && id(weight_miscale).state <= id(patryk_high)) {
  92. # return id(weight_user_patryk).publish_state(x);}
  93. # else if (id(weight_miscale).state >= id(ala_low) && id(weight_miscale).state <= id(ala_high)) {
  94. # return id(weight_user_ala).publish_state(x);}
  95. impedance:
  96. name: "Xiaomi Mi Scale Impedance"
  97. id: impedance_miscale
  98. # force_update: true
  99. filters:
  100. - timeout:
  101. timeout: 30s
  102. value: !lambda return 0;
  103. # on_value:
  104. # then:
  105. # - lambda: |-
  106. # if (id(weight_miscale).state >= id(asia_low) && id(weight_miscale).state <= id(asia_high)) {
  107. # return id(impedance_user_asia).publish_state(x);}
  108. # else if (id(weight_miscale).state >= id(patryk_low) && id(weight_miscale).state <= id(patryk_high)) {
  109. # return id(impedance_user_patryk).publish_state(x);}
  110. # else if (id(weight_miscale).state >= id(ala_low) && id(weight_miscale).state <= id(ala_high)) {
  111. # return id(impedance_user_ala).publish_state(x);}
  112. # - platform: template
  113. # name: Weight Asia
  114. # id: weight_user_asia
  115. # unit_of_measurement: 'kg'
  116. # icon: mdi:weight-kilogram
  117. # accuracy_decimals: 2
  118. # - platform: template
  119. # name: Impedance Asia
  120. # id: impedance_user_asia
  121. # unit_of_measurement: 'Ω'
  122. # icon: mdi:omega
  123. # accuracy_decimals: 0
  124. # - platform: template
  125. # name: Weight Patryk
  126. # id: weight_user_patryk
  127. # unit_of_measurement: 'kg'
  128. # icon: mdi:weight-kilogram
  129. # accuracy_decimals: 2
  130. # - platform: template
  131. # name: Impedance Patryk
  132. # id: impedance_user_patryk
  133. # unit_of_measurement: 'Ω'
  134. # icon: mdi:omega
  135. # accuracy_decimals: 0
  136. # - platform: template
  137. # name: Weight Ala
  138. # id: weight_user_ala
  139. # unit_of_measurement: 'kg'
  140. # icon: mdi:weight-kilogram
  141. # accuracy_decimals: 2
  142. # - platform: template
  143. # name: Impedance Ala
  144. # id: impedance_user_ala
  145. # unit_of_measurement: 'Ω'
  146. # icon: mdi:omega
  147. # accuracy_decimals: 0