OpenEPaperLink / Home_Assistant_Integration

Home assistant Integration for the OpenEPaperLink project
https://openepaperlink.de
Apache License 2.0
159 stars 35 forks source link

Unable to have a calculated value for parameter x_end #160

Closed metscore closed 3 months ago

metscore commented 3 months ago

Describe the bug I'm trying to draw a rectangle with a calculated value derived from a state. When I paste the yaml into the automation of HomeAssistant and reload the same yaml directly, the calculated value is x_end: "[object Object]": null which makes the automation fail.

To Reproduce Steps to reproduce the behavior:

  1. In Home Assistant, go the Automations tab and Create an automation.
  2. Press Edit in yaml mode
  3. Paste the this partial code as one part of a payload:
- type: rectangle
  x_start: 82
  y_start: 24
  x_end: {{ (states('sensor.pollen_malmo_bjork') | int * 10 + 80 - 2) }}
  y_end: 38
  width: 0
  fill: red
  outline: red
  1. Save the automation and re-open in yaml mode again.
  2. The "calculated" value (x_end) is now replaced with x_end: "[object Object]": null

image

  1. If the "erroneous" calculation is replaced by a regular numerical value, the display output works just fine.

image

If I try to use the following code, i.e. no state object, just values x_end: {{ 123 | int * 10 + 80 - 2 }}

this also results in a x_end: "[object Object]": null

Expected behavior For instance I expected the following x_end: {{ 123 | int * 10 + 80 - 2 }} to result in 1308 since it works perfectly in HA developer tools template.

image

Additional context I use HA core 2024.7.4 HA OS 12.4 OpenEPaperLink 0.4.9.1

metscore commented 3 months ago

I seems to work as expected. I apologize for supplying this as a bug.

This works for me:

x_end: "{{ (states('sensor.pollen_malmo_bjork') | int) * 10 + 120 }}"