Displaying calendar data on Adafruits Magtag (ePaper)

I have an Adafruit Magtag that I’m trying to display a list of the days tasks on.
I’ve created a sensor in homeassistant that I’ve confirmed works in homeassistant. I’ve been unsuccessful in getting the sensor to write to the display. I attempted to log if the sensor data is getting to the magtag device, and the log shows it isn’t, however I’m not sure the logger is setup correctly.

Any help would be appreciated.

text_sensor:
  - platform: homeassistant
    id: calevents_daily_from_ha
    entity_id: sensor.calevents_daily
    attribute: list
    
    on_value: 
      then:
        - logger.log: 
            format: "the calender is %s"
            args: [ 'id(calevents_daily_from_ha).state.c_str()' ]


#for the display
spi:
  clk_pin: GPIO36
  mosi_pin: GPIO35
  miso_pin: GPIO37

#display for the magtag in the esphome docs is gdew029t5
display:
  - platform: waveshare_epaper
    cs_pin: GPIO8
    dc_pin: GPIO7
    busy_pin: GPIO5
    reset_pin: GPIO6
    model: gdew029t5
    update_interval: 30s
    rotation: 270
    lambda: |-
      it.print(0, 20, id(roboto_big), "Hello World");
      it.printf(0, 0, id(roboto_big), "%s", id(calevents_daily_from_ha).state.c_str());

Is list a valid attribute for your calendar sensor?

You can remove the attribute for a test, the sensor should then return “on” or “off” depending on if there are active events.

The list attribute works when used in the template editor in home assistant.

{{ states(‘sensor.calevents_daily’) }}
{{ state_attr(‘sensor.calevents_daily’,‘list’) }}

will result in:
83
Feb.20 09:00: Go help Amy
Feb.20 15:00: Shift as Makerspace Tech at Hawk Makerspace

Which is what’s on my calendar.

I commented out “attribute: list” and then changed the display code to:

    lambda: |-
      it.print(0, 0, id(roboto_big), "Hello World");
      it.printf(0, 20, id(roboto_big), "%f", id(calevents_daily_from_ha).state);
      it.printf(0, 40, id(roboto_big), "%s", id(calevents_daily_from_ha).state);

Which resulted in the magtag displaying
Hello World
1.836559
|b|?
and two errors in the log:
Encountered character without representation in font: ‘\x8c’
Encountered character without representation in font: ‘\xfd’

It turned out that my original code is fine. While the ESPHome Builder recognized and allowed me to edit, compile, and send files to the Magtag, the ESPHome integration did not know that the Magtag was a ESPHome device. On the homeassistant front end notifications, there was a “new device” found and it was the Magtag. Once I added it, everything began to work. Problem solved!