TM1637 and ESP - unable to print decimal point when projecting float number

Trivial problem - I’m using 8x using 7 segment displays connected to ESP8266 to project current data about my solar system. I was following this tutorial, which clearly explains that float values will have a dot based on the precision selected (in my case .1f or even .2f). I am happy with response time and the way how things work. Except for one small thing - I am unable to force displays to show the decimal point when projecting these float numbers.

I am capturing float values form esphome (e.g. 27.70000)

Here’s my problem:

it.printf(1, "%.1f",id(battery_voltage).state);

returns _ 277

it.printf(0, "%.1f",id(battery_voltage).state);

returns 27:7_

it.printf(0, "%.2f",id(battery_voltage).state);

returns 27:70

What am I doing wrong here?

Using a TM1637 Display without any decimal points maybe? :thinking:


1 Like

each segment has a “dot” available. But that gave me idea to troubleshoot with static values…

edit: you are correct, sir… this is a “clock” module, that recognizes a “dot” as colon when used after second segment.
I’ll stick with integers for now then…

1 Like

Interesting. The ESPHome docs for that display only mentions the colon (:) and no points :thinking:

To display the colon punctuation use the . in the colon place. (See clock example below)

Maybe it isn’t supported (yet) by the esphome component? Maybe raise a bug/feature request or hit the devs on the discord :speaking_head:

most likely I bought a module that (despite dot being visible) does not really support the punctuation… I tried experimenting with values like or … , every time all I got was only 11:11 or nothing… So I guess it’s the hardware that does not work as expected.