trip5 / EspHome-Led-Clock

EHLC: EspHome-Led-Clock (for Sinilink XY-Clock & 303WifiLC01)
The Unlicense
7 stars 1 forks source link

please add sensors from home assistant #2

Closed rsvln closed 1 week ago

rsvln commented 2 weeks ago

Thank you very much for your impressive work!

I have an idea for developing the project. Could you add displaying information from home assistant sensors? The use case is as follows: we register a home assistant sensor in the settings for example a sensor.tempbedroom_temperature and it is displayed at a specified interval as the date is already displayed. It might be difficult to implement dynamically, but would it then be possible to add sensors to yaml? For example to provide 2-3 static display interval slots for this?

trip5 commented 2 weeks ago

Were you looking at my https://github.com/trip5/EspHome-Led-PixelClock repo? I actually just did this for another of my clock projects a week or so ago...

I should probably continue the idea and also separate this project into 2 distinct purposes - one for Home Assistant connectivity and the other as a clock (perhaps travel or whatever but still, just a clock). It wouldn't be too hard for me to "backport" the idea into this project (since they share a lot of the same codebase)...

I'm thinking... we're very stuck at how we can display decimals, limited to 4 characters, and many characters simply can't be displayed. So perhaps too you could make static "sensors" that show what sensor is coming next... ie. 1) In 2) 26.5C 3) Out 4) 15.1C etc.

Make sense? What do you think? Give me a bit of time and I'll see what I can do.

rsvln commented 2 weeks ago

Yes, that's what I need, I would be very grateful!

As for the sequential display of information I think there is no point in unnecessary information, your example could look like this: ti 26 (temperature in) to 15 (temperature out) hi 56 (humidity in) ho 82 (humidity out) There is no big sense in tenths and the user already knows which scale Celsius or Fahrenheit the readings are set to.

But for really long information, of course, you can provide for a sequential display as you have already implemented for IP address on boot

And also: is it possible to output the action of playing sounds in home assistant as it is available in the web interface? So that it could be used in automations?

trip5 commented 2 weeks ago

Not a bad idea for the sensor. BTW, "ti26" or "ho82" means no room for a space. And the i will look the same as a 1 or I (upper-case I) or l (lower-case L)... so I will see if I can give an option to display a sensor's name or something (two screens in quick succession). I've tried what you suggested - and you can try to with the HA service... send "ti26" and it's kind of weird to look at on a 7-segment display with only 4 characters available. But yup, it's possible...

It might take a bit. I've been looking into issues with my other projects. The ESP8266's lack of memory is frustrating sometimes (thus the split)... It'll probably take a few days but... I was already thinking of doing this anyways, so you just gave me a bit of motivation to actually get it done. Stay tuned!

rsvln commented 2 weeks ago

2024-06-25 22-03-00 7-Segment Display Decoder - Online Simulator Calculator Generator — Mozilla Firefox

If clock will display the information like this then it seems to me there won't be any confusion.

trip5 commented 2 weeks ago

I just checked. Pretty similar... more like (quick edit in MSpaint):

342889896-acf788a8-bd0a-416d-80a3-e23eac8194dc

But that's on the driver... which is here actually: https://github.com/trip5/esphome-tm1650/blob/main/components/tm1650/tm1650font.h

So far, I've just been using a fork of code someone else re-coded from an inbuilt esphome library... Never really thought to edit the actual font until now.

Hm. This one looks different, maybe... and a bit more complete: https://github.com/supercrab/arduino-seven-segment/blob/master/Characters.h I wish they had more pics of what the characters look like. But at least the ABCDEFG segments are similar enough I can probably work with it. Just adding a link here for my own reference later.

Not sure if I want to move the little i - it's on the right side for reasons - but there's probably another character that is useable on the right side... like the pipe | but that's full height... anyways, rambling. This will come after the sensors perhaps.

rsvln commented 1 week ago

Here is a generator with which you can complete character set with any combination http://tools.krupson.eu/SevenSegPCF8574/ Found it here https://github.com/Krupson/SevenSegPCF8574

trip5 commented 1 week ago

Not bad. Uses the same mapping except for the decimal point which that generator puts at the end instead of at the beginning. But that's easy to fix. I'll dig it out later... thanks!

trip5 commented 1 week ago

Actually testing out the font with sensors kinda ticked me off. So many broken characters, unreadable, no variety...

Did quite a few changes to the TM1650 font using the tool you located. Seems to be readable. I did leave the i's on the left side but there's some on the right you might be able to use. But it would be nice to generate a better preview of what all the characters look like. Where did you get the 7-segment images from earlier? I might be able to use that?

BTW, made pretty good progress. Just one (hopefully) bug to iron out and then the new versions will be ready.

rsvln commented 1 week ago

I took them from here, here are all the combinations https://www.dcode.fr/7-segment-display

trip5 commented 1 week ago

Probably too lazy to generate a proper preview of the TM1650 font. Maybe... I'll see. But for now, I think I got the sensors available, working, and configurable. Take a look, try it out. I'm pretty happy with the HA version in conjunction with the updated font.

Test out the screens you're planning on displaying with the service call (and I even used your above examples in the template.yaml).

rsvln commented 1 week ago

Thank you very much! Everything worked out. I just slightly corrected the font to my taste :) I'll also try to redo it so that all attributes are shown one after another and not through a full cycle. It's a bit of a pity that now there is no web server due to lack of memory.

trip5 commented 1 week ago

A little pity yeah but you can still get all the options through Home Assistant. I tried but it was so unstable. Any attempt to use the WebUI would crash the ESP and force a reboot. If you're adventurous enough to disable various other functions like OTA and captive portal, it might work... those 2 functions take up a pretty good amount of memory.

I'm glad you figured out how to modify the font. The tool you linked to above made that pretty easy. I was just happy to get missing characters in and the t and T look like actual letters.

I'll come back to it at some point and create previews for the 7-segment font on the library.