Skip to content

Commit

Permalink
Bugfix to use size and position in templates for the rectangle
Browse files Browse the repository at this point in the history
  • Loading branch information
gickowtf committed Apr 7, 2024
1 parent 56511b1 commit a84c096
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion custom_components/divoom_pixoo/const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
DOMAIN = "divoom_pixoo"
VERSION = "1.9.0"
VERSION = "1.10.1"
CURRENT_ENTRY_VERSION = 2
2 changes: 1 addition & 1 deletion custom_components/divoom_pixoo/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/gickowtf/pixoo-homeassistant/issues",
"requirements": [],
"version": "1.9.0"
"version": "1.10.1"
}
12 changes: 9 additions & 3 deletions custom_components/divoom_pixoo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,15 @@ def _render_page(self, page):
elif component['type'] == "rectangle":
try:
rendered_color = render_color(component.get('color'), self.hass, variables=rendered_variables)
position = ( int(Template(str(component['position'][0])).async_render()), int(Template(str(component['position'][1])).async_render(variables=rendered_variables)) )
size = ( int(Template(str(component['size'][0])).async_render()), int(Template(str(component['size'][1])).async_render(variables=rendered_variables)) )
size = (size[0] - 1, size[1] - 1)

position = [
int(Template(str(position), self.hass).async_render(variables=rendered_variables)) for position in
component['position']
]
size = [
int(Template(str(size), self.hass).async_render(variables=rendered_variables)) for size in
component['size']
]

rendered_fill = bool(Template(str(component.get('filled', True)), self.hass).async_render(variables=rendered_variables))

Expand Down

0 comments on commit a84c096

Please sign in to comment.