Hi
I came to this thread as I’ve recently got this display and was wanting to get it working in HA, so thanks for the tips here so far.
To give back - I notice that others were struggling to get text working. I’ve managed it.
My service entry is as follows: -
@service
async def text( address=None, text="Hello World", font_size=16, font_path="./pyscript/fonts/Rain-DRM3.otf", text_mode=1, speed=95, text_color_mode=1,text_color=(255,0,0),text_bg_mode=0,text_bg_color=(0,255,255) ):
conn = ConnectionManager()
await conn.connectByAddress(address)
Text().setMode(text=text,font_size=font_size,font_path=font_path,text_mode=text_mode,speed=speed,text_color_mode=text_color_mode,text_color=text_color,text_bg_mode=text_bg_mode,text_bg_color=text_bg_color)
This works and I can tweak all the settings. The fun bit was finding where to put the font, and how to reference it. In the font_path above you see that the runtime path is in the config directory, so referencing a font in ./pyscript/fonts does the trick - I’ve copied the default font in there.
You also need to have text=“text” as a parameter in the setMode - I see that @jonaseymour you put just the string itself in the setMode.
My service has all applicable parameters so for example I can call it with yaml like this:
action: pyscript.text
data:
address: 17:40:12:80:7D:C9
text: "It's GREEN Bin Day"
font_size: 22
speed: 100
text_mode: 1
text_bg_mode: 1
text_bg_color: [0,128,0]
text_color_mode: 2
I don’t really like the scaling/spacing of the text compared to what comes out of the Android app, but I think that will need customising the library so that’s for another day.
Hope this helps someone.
