cokeman0 / OpenEpaperElectricPriceTag

OpenEpaper Electric price tag with 12h graf
7 stars 1 forks source link

Code not works when minus prices? #8

Closed rhoddan closed 6 months ago

rhoddan commented 6 months ago

First - thanks for a great code. Today we have minus prices and I guess the code isn't support that?

Logger: homeassistant.components.automation.el_pricesink Source: helpers/script.py:504 integration: Automation (documentation, issues) First occurred: 09:31:13 (1 occurrences) Last logged: 09:31:13

backup eink: Error executing script. Unexpected error for call_service at pos 2: y1 must be greater than or equal to y0 Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 504, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 733, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 696, in _async_run_long_action return await long_task ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/open_epaper_link/init.py", line 44, in drawcustomservice imgbuff = await hass.async_add_executor_job(customimage,entity_id, service, hass) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/open_epaper_link/imagegen.py", line 145, in customimage img_rect.rectangle([(element['x_start'],element['y_start']),(element['x_end'],element['y_end'])],fill = getIndexColor(element['fill']), outline=getIndexColor(element['outline']), width=element['width']) File "/usr/local/lib/python3.12/site-packages/PIL/ImageDraw.py", line 303, in rectangle self.draw.draw_rectangle(xy, fill, 1) ValueError: y1 must be greater than or equal to y0

cokeman0 commented 6 months ago

Hi,

Are you using the EDS or nordpool edition, The Nordpool, should have been fixed to handle negative values, I just haven gotten around to updating the EDS version. I'll try to get to it this week, but are a bit stressed at work.

On søndag den 7. apr. 2024 7.00 AM, wrote:

First - thanks for a great code. Today we have minus prices and I guess the code isn't support that? Logger: homeassistant.components.automation.el_pricesink Source: helpers/script.py:504 integration: Automation (documentation, issues) First occurred: 09:31:13 (1 occurrences) Last logged: 09:31:13 backup eink: Error executing script. Unexpected error for call_service at pos 2: y1 must be greater than or equal to y0 Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 504, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 733, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 696, in _async_run_long_action return await long_task ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/open_epaper_link/init.py", line 44, in drawcustomservice imgbuff = await hass.async_add_executor_job(customimage,entity_id, service, hass) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/open_epaper_link/imagegen.py", line 145, in customimage img_rect.rectangle([(element['x_start'],element['y_start']),(element['x_end'],element['y_end'])],fill = getIndexColor(element['fill']), outline=getIndexColor(element['outline']), width=element['width']) File "/usr/local/lib/python3.12/site-packages/PIL/ImageDraw.py", line 303, in rectangle self.draw.draw_rectangle(xy, fill, 1) ValueError: y1 must be greater than or equal to y0 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID:

rhoddan commented 6 months ago

The Nordpool variant...

rhoddan commented 6 months ago

Hmm maybe there is an updated code I missed. Need to doublecheck. If that's case I'm sorry...

cokeman0 commented 6 months ago

please do, and let me know, so this issue can be closed

rhoddan commented 6 months ago

I have now updated to latest code (which was newer than my code). Without minus prices to test today I'm sure it's working now. Thanks again for a great code 👍