Here my ESPHome configuration for the Tilt Hydrometer:
esphome:
name: 182-tilt
libraries:
- "ESP32 BLE Arduino"
esp32:
board: nodemcu-32s
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
web_server:
ota:
password: "***"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
captive_portal:
esp32_ble_tracker:
on_ble_advertise:
then:
- lambda: |-
if(x.get_ibeacon().has_value()) {
auto ibeacon = x.get_ibeacon().value();
if(strcmp(ibeacon.get_uuid().to_string().c_str(), "DE742DF0-7013-12B5-444B-B1C540BB95A4") == 0) {
id(purple_temperature_fahrenheit).publish_state(ibeacon.get_major());
id(purple_gravity).publish_state(ibeacon.get_minor());
}else
if(strcmp(ibeacon.get_uuid().to_string().c_str(), "DE742DF0-7013-12B5-444B-B1C530BB95A4") == 0) {
id(black_temperature_fahrenheit).publish_state(ibeacon.get_major());
id(black_gravity).publish_state(ibeacon.get_minor());
}else{
ESP_LOGD("ble_adv", "iBeacon uuid: %s",ibeacon.get_uuid().to_string().c_str());
}
}
sensor:
# purple
- platform: template
id: purple_temperature_fahrenheit
name: "Purple temperature fahrenheit"
update_interval: never
unit_of_measurement: "°F"
- platform: template
id: purple_gravity
name: "Purple gravity"
update_interval: never
unit_of_measurement: ""
- platform: template
name: Purple Temperature_C
id: purple_temperature_celsius
lambda: return (id(purple_temperature_fahrenheit).state-32) * .5556;
update_interval: 5s
# black
- platform: template
id: black_temperature_fahrenheit
name: "Black temperature fahrenheit"
update_interval: never
unit_of_measurement: "°F"
- platform: template
id: black_gravity
name: "Black gravity"
update_interval: never
unit_of_measurement: ""
- platform: template
name: Black Temperature_C
id: black_temperature_celsius
lambda: return (id(black_temperature_fahrenheit).state-32) * .5556;
update_interval: 5s
# https://hobbybrauer.de/forum/wiki/doku.php/konvertierung_sg_plato
I did not jet manage to get the gravity in °Plato, the formula is known, but still fighting with the pow() function which does not compile.
If an unknown Tilt Sensor (other than black or purple) is nearby, the uuid will be printed to the log.
I use the temperature value as input to a smart thermostat, which then toggles a Shelly to power a heating matt. Using Kveik gives me a perfect temperature control without cooling.
Cheers!
References used: