Getting decimal point from an esp32 climate thermometer in HA

I have this ESP BT sensor:

  - platform: xiaomi_lywsd03mmc
    mac_address: A4:C1:38:E3:25:E8
    bindkey: "05e04076be48f427f3d90e166d0fbd5e"
    temperature:
      name: "Toilet Temperatur"
      id: toilet_temp

And this ESP climate thermostat:

  - platform: thermostat
    name: "Toilet Termostat"
    sensor: toilet_temp
    default_target_temperature_low: 20 °C
    heat_action:
      - switch.turn_on: toilet_heat
    idle_action:
      - switch.turn_off: toilet_heat
    visual:
      min_temperature: 16 °C
      max_temperature: 22 °C
      temperature_step: .5 °C

In HA they look like this:

As you can see the sensor.toilet_temperatur has decimal point, but the climate.toilet_termostat doesnt. How can I make the thermostat showing a decimal point also?

Its a little frustrating that the simple thermostat in HA doesnt show a decimal point and just round .5 up or down:

image

I dont know if this will but we can try toe things. First you can try specifying a decimal accuracy with the toilet sensor and see if this makes any change with the thermostat.

  - platform: xiaomi_lywsd03mmc
    mac_address: A4:C1:38:E3:25:E8
    bindkey: "05e04076be48f427f3d90e166d0fbd5e"
    temperature:
      name: "Toilet Temperatur"
      id: toilet_temp
      accuracy_decimals: 1

Second use float instead of integers in thermostat config.

  - platform: thermostat
    name: "Toilet Termostat"
    sensor: toilet_temp
    default_target_temperature_low: 20.0 °C
    heat_action:
      - switch.turn_on: toilet_heat
    idle_action:
      - switch.turn_off: toilet_heat
    visual:
      min_temperature: 16.0 °C
      max_temperature: 22.0 °C
      temperature_step: 0.1 °C
1 Like

hi @sheminasalam ,

thanks for your answer . I cant test it at the moment - guessing my ESP i running out of flash when I get this error trying to OTA a new flash:

RAM:   [==        ]  18.6% (used 60932 bytes from 327680 bytes)
Flash: [========  ]  81.1% (used 1488478 bytes from 1835008 bytes)
========================= [SUCCESS] Took 88.81 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.0.32
INFO Uploading /data/underfloorheating/.pioenvs/underfloorheating/firmware.bin (1488592 bytes)
Uploading: [====================                                        ] 34% 
**ERROR Error sending data: timed out**

If this issue persists, first make a very basic configuration in esphome with just wifi, ota and all, upload it to the device and when it boots up go to the web ui and upload the compiled bin of this config. Hopefully it should work. But make sure you dont edit this present configuration to the basic config.

I’m not sure I understand . Wont the webserver take up alot of resources? and what do you mean with dont edit this present configuration to the basic config ?

If you want you can skip the webserver also and go for ota update. Usually for me the webbserver has not been an issue but my flash was just over 60% occupied.

I meant that instead of creating a new basic config and upload it to the device, you also have the option to delete all the elements from the present yaml leaving out the basic ones and upload this to the device. If you do so without taking any backup of the config, you wont be able to revive the deleted parts.

Now I tried hooking it directly to my RPI but now its impossible for me to do anything:

Retrieving maximum program size /data/underfloorheating/.pioenvs/underfloorheating/firmware.elf
Checking size /data/underfloorheating/.pioenvs/underfloorheating/firmware.elf
RAM:   [=         ]  12.9% (used 42304 bytes from 327680 bytes)
Flash: [=====     ]  47.5% (used 871954 bytes from 1835008 bytes)
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, ftdi, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Use manually specified: /dev/ttyUSB1
Uploading /data/underfloorheating/.pioenvs/underfloorheating/firmware.bin
Serial port /dev/ttyUSB1
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x61)
*** [upload] Error 2
========================= [FAILED] Took 29.66 seconds =========================

This is with a very basic configuration - the same I used to get it up and running the first time.
Do you know if its possible to get any ESP32’s that doesnt run out of flash so easily ?

If you are flashing the device with RPI, you dont need to go with a basic configuration at first, you can flash the device with the original config after erasing the flash memory. From the log it seems that the wiring is not correct or unstable. Please make sure the wiring with is correct.

I managed to get it up and running - just had to hold down the boot button while flashing it .
I tried to do what you said and now I have 0.5 roundings in my thermostats in HA . thats better than the 1.0 I had before . Thanks alot . If you have any sources where I can learn to upload new firmware a smart way when there is very little flash left - Please share .

I think this is the magic part :slight_smile: