lubeda / EspHoMaTriXv2

A simple DIY status display with a 8x32 RGB LED matrix, implemented with esphome.io and Home Assistant.
MIT License
275 stars 25 forks source link

text box helper home assistant and local temperature sensor #244

Open bepppppo opened 1 month ago

bepppppo commented 1 month ago

Question

I have read and tried different solutions to get my display 8x32 to show a local temperature sensor DHT22 attached to the esp32, not only when there are changes to the sensor but at a specific time, for example every 2 minutes. My target is to get the display to show clock and every 2 minutes room temperature via DHT22 and ouside temperature from home assistant weather service. Also when I need I wanted to be able to Type in a text box from home assistant (via helpers) and the display will show that message for around 2 minutes. I have accomplish this with regular esphome code but I wanted to try out your firmware as it is very nice.

So just to make it simple I would like to have these 2 functions:

1- input box from home assistant input box helper without using automations

2- show local DHT22 temperature sensor every 2 minutes

I appreciate your help on this

Additional information

Logs

(optional) Add relevant logs which could help tackle the problem.

Additional context

this is my current working code for esphome without EspHoMaTriXv2 component:

esphome: name: admin-front-clock friendly_name: "Admin Front Clock" on_boot: priority: 800 then:

time:

Enable logging

logger: level: WARN web_server: port: 80 include_internal: true button:

sensor:

text_sensor:

light:

script:

globals:

display:

font:

andrewjswan commented 1 month ago

In EspHoMaTriXv2 there is a concept of a screen queue. Each screen has a display time and a lifetime from the moment it is placed in the queue. Therefore, there is no simple solution to the problem of displaying a screen every 2 minutes. If you have only 2 screens, a clock and a temperature, then make the display time of the clock 1 minute 50 seconds for the clock screen, and for the temperature screen the display time is 10 seconds, conditionally this will give what you want.

Regarding the text output, in HA you create an input_text, based on it you create a template sensor, and add it to ESPHome, in ESPHome you create an automation to change this sensor that will display it. But it is easier to do all this on the HA side. You can create a text entity in ESPHome, and create automation and output for changing the value.

bepppppo commented 1 month ago

thank you for your reply andrew, do you have an example code I can refer to create the HA automation for the text box? also the text entity in esphome? Also thank you for the hint regarding the clock display time, I would have liked to display at least 3 screens: clock, local sensor and HA temperature. Anyway I appreciate your help

trip5 commented 1 month ago

I feel like you might be a bit new to Home Assistant... I'll try to add to your knowledge but you will absolutely need to experiment and try and fail and try again until you get the result you want. And that's OK. It took me a weeks to wrap my head around how to do all of this but I learned a lot and applied that knowledge to other things I wanted to do...

Adding the device to Home Assistant adds a service. These are visible in Developer Tools and you can test out what you would like to accomplish there. Once you figure it how you want it there, you can move that over to an Automation or Script.

I personally use an automation that is triggered every 5 minutes that starts a script that first deletes the screens from the queues and then screens to the queue. There are some good examples in the wiki right here already you can take a look at.

https://github.com/lubeda/EspHoMaTriXv2/blob/main/wiki/home.md

Please note the main branch differs very much from what some people are actually using. I'm personally still stuck on a 2023 branch because I haven't had the time to make sure I know what I'm doing with the latest - upgrading is not always needed if you're happy with what works!

https://github.com/lubeda/EspHoMaTriXv2/tree/2024.6.pre/wiki

But there's also some extra info in the wiki of the latest branch too. I have to use the error-checking code that is shown in this part because my living-room and weather-sensors sometimes don't work and the script will crash my clock goes blank if I don't:

https://github.com/lubeda/EspHoMaTriXv2/blob/2024.6.pre/wiki/weather-display.md

andrewjswan commented 1 month ago

also the text entity in esphome?

https://esphome.io/components/text/index.html

thank you for your reply andrew, do you have an example code I can refer to create the HA automation for the text box?

This is a banal automation, a trigger for a change in state, an action for output, to any screen that is suitable.

bepppppo commented 1 month ago

thank you both, I will try and experiment a bit.