Display of the current album cover of a media player~
Combined with a media player entity which supports entity_picture attribute, you can automate display of that using the push_image service of the Custom Component.
On the plate (named plate_livingroom in this example) you'd have two objects, first a rectangular object with rounded corners, secod an image object placed inside of it. It's hidden by default so you could place this on top of your existing media player controls, and have it pop up only when there's a cover present. To look nice together use the clip_corner property:
The automation below takes care of unhiding them when a cover appears on the sound_livingroom media player, updating the picture when it changes and hiding them again when the player drops the entity_picture attribute (it's stopped or the played media doesn't have a corresponding picture):
Backlight ON (dimmed) if there's any light in the room, OFF otherwise~
The night mode activates when all the lights are off and shutters are down below 25% (assuming it's dark enough for the backlight to be disturbing in such situation), the day mode activates otherwise. During the day, when the screen is after short idle, it dims to the level configured in Home Assistant, but never turns off. During the night, the screen turns off after the long idle period.
This will act directly on the plate in a certain room, as it is triggered by entities located in that room. If you have multiple plates in various rooms, you can create separate automations for each.
Note the condition which assures to avoid triggering the automations falsely when Home Assistant (re)starts (allows running the automation only when Home Assistant has been up for at least 2 minutes).
Backlight ON (dimmed) during the day, OFF during the night for all the plates~
The night mode activates when sun goes down, and the day mode activates when the sun comes up. During the day, when the screen is after short idle, it dims to the level configured in Home Assistant, but never turns off. During the night, the screen turns off after the long idle period.
Assuming your plate's configured MQTT group name is plates, this will affect all the plates in your system at once:
Note here too the condition which assures to avoid triggering the automations falsely when Home Assistant (re)starts (allows running the automation only when Home Assistant has been up for at least 2 minutes).
Turn ON moodlight when backlight goes OFF (and back)~
If your plate has moodlights, it is useful in dark situations, when you don't want to have the screen backlit on all the time as above, but have the mood light on instead. During the day mood light doesn't light.
Put your light.plate_my_room_moodlight to a Lovelace card entity row and select a nice color for moodlight.
You can use this to protect and prolonge the lifetime of the LCD screens, thus being more green and generating less hazardous waste.
Wall mounted LCD screens' main problem is that they display the same picture 99.999% of the time. Even if somebody turns off backlight during the night or dark periods, the LCD screen keeps showing the same picture, seen by nobody. There are high chances that this will lead to screen picture burn-in after a few years of operation.
One way to reduce this is to "train" the pixels periodically with completely different other content.
Assuming your group name is configured as plates in your screens running openHASP, here is a possible solution to extend their life (all at once). The cycle runs for 30 seconds each time, can be stopped by touching. The trigger runs this 6 times each night.
1 2 3 4 5 6 7 8 9101112131415161718192021
-id:openhasp_antiburn_start_at_nightalias:openHASP anti-burn-in start at nightinitial_state:'on'trigger:-platform:timeat:'00:20:00'-platform:timeat:'01:20:00'-platform:timeat:'02:20:00'-platform:timeat:'03:20:00'-platform:timeat:'04:20:00'-platform:timeat:'05:20:00'action:-service:mqtt.publishdata:topic:hasp/plates/command/antiburnpayload:'1'
Another way to reduce the chance of burn-in is to clear the contents of the screen while the backlight is turned off, as nobody sees the pixels anyway.
Just add these actions to the first automation example which draw an overlay with a black base object on page 0 when display is off, and deletes it when comes back on:
for automation openhasp-moodlight-on, add to actions:
openHasp devices report several device properties to the Custom Component... including tftWidth and tftHeight.
These properties are exposed in home assistant as device attributes and can be used in template automations.
Here is a modified version of the Display clock and temperature example configuration that will use a "generic" jsonl file that has no hard-coded layout attributes: x, y, w, h and will appear the same on devices with different resolutions and screen orientations.
Tell the openHasp device to create three text labels.
As we are not specifying x/y coordinates, when the device first powers on, all three labels will be drawn in the upper left corner with their default size/values.
When plate00 comes online and connects to the MQTT broker, the openHasp Custom Component will be invoked and the yaml below will be executed.
The templates will be executed and the computed x, y, w, h values for each UI component will be sent to the plate.
1 2 3 4 5 6 7 8 910111213141516171819202122232425
{"page":0,"comment":"Default to page0 as the header and page/layout"}{"id":1,"comment":"Time in the top left","obj":"label","text":"00:00","bg_color":"#2C3E50"}{"id":2,"comment":"Temp in the middle","obj":"label","text":"00.0°C","bg_color":"#2C3E50"}{"id":3,"comment":"Humidity in the top right","obj":"label","text":"00.0%","bg_color":"#2C3E50"}
Assuming that the above jsonl was deployed to a openHasp device named plate00, configure the Home Assistant Custom Component with yaml like this:
# The top left corner is 0,0, X grows positive to the right and Y grows positive downplate00:objects:# Header: Time-obj:"p0b1"properties:"align":"left""text":"{{states('sensor.time')}}""mode":"loop"### Draw the labels with a 1% margin from the top and sides"x":>-{% set scnWd = state_attr('openhasp.plate00', 'tftWidth') | int %}{% set hdrHorMargin = (scnWd*0.01) | int %}{{hdrHorMargin}} "y":>-{% set scnHt = state_attr('openhasp.plate00', 'tftHeight') | int %}{% set hdrVrtMargin = (scnHt*0.01) | int %}{{hdrVrtMargin}} # Width is 1/3 of the screen width after subtracting margins##"w":>-{% set numObj = 3 %}{% set scnWd = state_attr('openhasp.plate00', 'tftWidth') | int %}{% set hdrHorMargin = (scnWd*0.01) | int %}{% set usableHdrWd = scnWd-(2*hdrHorMargin) %}{% set hdrLblWd = (usableHdrWd/numObj) | int %}{{hdrLblWd}} # Height is 10% of the screen, after margin##"h":>-{% set scnHt = state_attr('openhasp.plate00', 'tftHeight') | int %}{% set hdrVrtMargin = (scnHt*0.01) | int %}{% set hdrHt = (scnHt*0.1) | int %}{% set hdrLblHt = hdrHt-hdrVrtMargin %}{{hdrLblHt}} # Header: Temp-obj:"p0b2"properties:"align":"center""text":"{{states('sensor.room_temperature')}}°C""mode":"loop"### Draw the labels with a 1% margin from the top and sides"x":>-{% set numObj = 3 %}{% set scnWd = state_attr('openhasp.plate00', 'tftWidth') | int %}{% set hdrHorMargin = (scnWd*0.01) | int %}{% set usableHdrWd = scnWd-(2*hdrHorMargin) %}{% set hdrLblWd = (usableHdrWd/numObj) | int %}{% set hdrHorMargin = (scnWd*0.01) | int %}{{hdrHorMargin+hdrLblWd}}"y":>-{% set scnHt = state_attr('openhasp.plate00', 'tftHeight') | int %}{% set hdrVrtMargin = (scnHt*0.01) | int %}{{hdrVrtMargin}} # Width is 1/3 of the screen width after subtracting margins##"w":>-{% set numObj = 3 %}{% set scnWd = state_attr('openhasp.plate00', 'tftWidth') | int %}{% set hdrHorMargin = (scnWd*0.01) | int %}{% set usableHdrWd = scnWd-(2*hdrHorMargin) %}{% set hdrLblWd = (usableHdrWd/numObj) | int %}{{hdrLblWd}} # Height is 10% of the screen, after margin##"h":>-{% set scnHt = state_attr('openhasp.plate00', 'tftHeight') | int %}{% set hdrVrtMargin = (scnHt*0.01) | int %}{% set hdrHt = (scnHt*0.1) | int %}{% set hdrLblHt = hdrHt-hdrVrtMargin %}{{hdrLblHt}} # Header: Humidity-obj:"p0b3"properties:"align":"right""text":"{{states('sensor.room_humidity')}}%""mode":"loop"### Draw the labels with a 1% margin from the top and sides"x":>-{% set numObj = 3 %}{% set scnWd = state_attr('openhasp.plate00', 'tftWidth') | int %}{% set hdrHorMargin = (scnWd*0.01) | int %}{% set usableHdrWd = scnWd-(2*hdrHorMargin) %}{% set hdrLblWd = (usableHdrWd/numObj) | int %}{% set hdrHorMargin = (scnWd*0.01) | int %}{{hdrHorMargin+(2*hdrLblWd)}} "y":>-{% set scnHt = state_attr('openhasp.plate00', 'tftHeight') | int %}{% set hdrVrtMargin = (scnHt*0.01) | int %}{{hdrVrtMargin}} # Width is 1/3 of the screen width after subtracting margins##"w":>-{% set numObj = 3 %}{% set scnWd = state_attr('openhasp.plate00', 'tftWidth') | int %}{% set hdrHorMargin = (scnWd*0.01) | int %}{% set usableHdrWd = scnWd-(2*hdrHorMargin) %}{% set hdrLblWd = (usableHdrWd/numObj) | int %}{{hdrLblWd}} # Height is 10% of the screen, after margin##"h":>-{% set scnHt = state_attr('openhasp.plate00', 'tftHeight') | int %}{% set hdrVrtMargin = (scnHt*0.01) | int %}{% set hdrHt = (scnHt*0.1) | int %}{% set hdrLblHt = hdrHt-hdrVrtMargin %}{{hdrLblHt}}
You should be able to shift the screen orientation for plate00 by 90 degrees and restart the device to apply your change.
When the device boots back up and connects to MQTT, openHasp should report a different value for it's tftHeight and tftWidth which will cause Home Assistant to re-evaluate the templates.
A few seconds after connecting to MQTT, plate00 should have an updated layout that reflects it's new screen orientation.