I’m creating a sensor and setting it’s state as Text as a means of displaying dynamic text. Works well, however if I’m spacing out text I’m noting any spaces >1 in a row are removed, so you only ever have 1 space, which prevents me formating the text.
Any ideas how to prevent a Dashboard item, widget_type = sensor, to behave so it doesn’t do this for text used…
e.g.
power_notes:
widget_type: sensor
entity: sensor.dashboard_notes_power
widget_style: "font-family: Courier New; font-size: 140%; text-align: left;" # background: black;"
.
def _dashboard_clearcost_update(self, power_usage, solar_generation):
def justify(myInt):
return str(int(myInt)).rjust(5, '·')
available_power = solar_generation - power_usage
available_power = 0 if available_power < 0 else available_power
self._gc_set_state(
DASHBOARD_NOTES_POWER,
state = "Solar: %s W<BR/>Power: %s W<BR/><HR/>Avail: %s W" % (justify(solar_generation), justify(power_usage), justify(available_power))
)