cokeman0 / OpenEpaperElectricPriceTag

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

Error rendering data template #3

Closed ericedberg closed 7 months ago

ericedberg commented 7 months ago

When I try to run just the service draw custom I get error Error rendering data template: UndefinedError: 'spacing' is undefined When I try to run whole automation it does not work. I have replaced sensor whit find function in yaml, all lines are mine sensor. I replaced tag entity to.

Have any idea?

cokeman0 commented 7 months ago

Did you switch "to edit in YAML" before pasting. ? (3 dot in the top left)

I think you are missing the "spacing variable and others"

ericedberg commented 7 months ago

Did you switch "to edit in YAML" before pasting. ? (3 dot in the top left)

I think you are missing the "spacing variable and others"

Yes i switched to yaml before, but I will test again and I would look for spacing variable and others so I dont miss it. I´ll come back with result later. Thanks.

cokeman0 commented 7 months ago

and when you test, also do run from the "3 dots", or you just run part of the automation.

ericedberg commented 7 months ago

I did both. When I i run part, i get error, when i run from "dots" i dont get the error but my epaper does not update. I did check my code and i got

mode: single variables: spacing: "{{'16','40','64','88','112','136','160','184','208','232','256','280' }}" spacingwith: "{{7}}" maxgrafhigh: "{{90}}" grafbottom: "{{114}}" grafpricesize: "{{10}}" grafpriceoffset: "{{8}}"

cokeman0 commented 7 months ago

have you switched the ID of the tag to your tag, and what does the AP show you, are the an image pending ? [image: image.png]

On Thu, Feb 1, 2024 at 9:40 AM ericedberg @.***> wrote:

I did both. When I i run part, i get error, when i run from "dots" i dont get the error but my epaper does not update. I did check my code and i got

mode: single variables: spacing: "{{'16','40','64','88','112','136','160','184','208','232','256','280' }}" spacingwith: "{{7}}" maxgrafhigh: "{{90}}" grafbottom: "{{114}}" grafpricesize: "{{10}}" grafpriceoffset: "{{8}}"

— Reply to this email directly, view it on GitHub https://github.com/cokeman0/OpenEpaperElectricPriceTag/issues/3#issuecomment-1920779441, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQYAKVW5Y656CUH7LHTHPTYRNIGPAVCNFSM6AAAAABCUNFBMGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRQG43TSNBUGE . You are receiving this because you commented.Message ID: @.***>

ericedberg commented 7 months ago

Yes i change ID. And now i doublecheck, and test to send just some line from developer and it change. When i run automation AP does not say image pending. Strange.

cokeman0 commented 7 months ago

does the system logs show errors?

On torsdag den 1. feb. 2024 9.51 AM, wrote:

Yes i change ID. And now i doublecheck, and test to send just some line from developer and it change. When i run automation AP does not say image pending. Strange. You are receiving this because you commented.Message ID:

ericedberg commented 7 months ago

Yes. Two error.

Logger: homeassistant.components.automation.epaper_graf_12_hours_nordpool_edition Source: helpers/script.py:476 Integration: Automation (documentation, issues) First occurred: 31 januari 2024 kl. 11:25:08 (18 occurrences) Last logged: 09:50:20

ePaper -graf 12 hours - Nordpool edition: Error executing script. Unexpected error for call_service at pos 2: cannot open resource ePaper -graf 12 hours - Nordpool edition: Error executing script. Unexpected error for call_service at pos 2: unknown file format Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 713, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 675, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/open_epaper_link/init.py", line 38, in drawcustomservice imgbuff = await hass.async_add_executor_job(customimage,entity_id, service, hass) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/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 152, in customimage font = ImageFont.truetype(font_file, size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 797, in truetype return freetype(font) ^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 794, in freetype return FreeTypeFont(font, size, index, encoding, layout_engine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 226, in init self.font = core.getfont( ^^^^^^^^^^^^^ OSError: cannot open resource

Logginformation (FEL) Logger: homeassistant.components.automation.epaper_graf_12_hours_nordpool_edition Source: components/automation/init.py:669 Integration: Automation (documentation, issues) First occurred: 31 januari 2024 kl. 11:25:08 (18 occurrences) Last logged: 09:50:20

While executing automation automation.epaper_graf_12_hours_nordpool_edition Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 669, in async_trigger await self.action_script.async_run( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1587, in async_run return await asyncio.shield(run.async_run()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 426, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 479, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 502, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 713, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 675, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/open_epaper_link/init.py", line 38, in drawcustomservice imgbuff = await hass.async_add_executor_job(customimage,entity_id, service, hass) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/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 152, in customimage font = ImageFont.truetype(font_file, size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 797, in truetype return freetype(font) ^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 794, in freetype return FreeTypeFont(font, size, index, encoding, layout_engine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 226, in init self.font = core.getfont( ^^^^^^^^^^^^^ OSError: cannot open resource

cokeman0 commented 7 months ago

Hmm, don't know... sorry

On Thu, Feb 1, 2024 at 10:02 AM ericedberg @.***> wrote:

Yes. Two error.

Logger: homeassistant.components.automation.epaper_graf_12_hours_nordpool_edition Source: helpers/script.py:476 Integration: Automation (documentation https://www.home-assistant.io/integrations/automation, issues https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22 ) First occurred: 31 januari 2024 kl. 11:25:08 (18 occurrences) Last logged: 09:50:20

ePaper -graf 12 hours - Nordpool edition: Error executing script. Unexpected error for call_service at pos 2: cannot open resource ePaper -graf 12 hours - Nordpool edition: Error executing script. Unexpected error for call_service at pos 2: unknown file format Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 713, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 675, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/open_epaper_link/init.py", line 38, in drawcustomservice imgbuff = await hass.async_add_executor_job(customimage,entity_id, service, hass) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/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 152, in customimage font = ImageFont.truetype(font_file, size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 797, in truetype return freetype(font) ^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 794, in freetype return FreeTypeFont(font, size, index, encoding, layout_engine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 226, in init* self.font = core.getfont( ^^^^^^^^^^^^^ OSError: cannot open resource

Logginformation (FEL) Logger: homeassistant.components.automation.epaper_graf_12_hours_nordpool_edition Source: components/automation/init.py:669 Integration: Automation (documentation https://www.home-assistant.io/integrations/automation, issues https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22 ) First occurred: 31 januari 2024 kl. 11:25:08 (18 occurrences) Last logged: 09:50:20

While executing automation automation.epaper_graf_12_hours_nordpool_edition Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 669, in async_trigger await self.action_script.async_run( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1587, in async_run return await asyncio.shield(run.async_run()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 426, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 479, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 502, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 713, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 675, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/open_epaper_link/init.py", line 38, in drawcustomservice imgbuff = await hass.async_add_executor_job(customimage,entity_id, service, hass) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/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 152, in customimage font = ImageFont.truetype(font_file, size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 797, in truetype return freetype(font) ^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 794, in freetype return FreeTypeFont(font, size, index, encoding, layout_engine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/PIL/ImageFont.py", line 226, in init* self.font = core.getfont( ^^^^^^^^^^^^^ OSError: cannot open resource

— Reply to this email directly, view it on GitHub https://github.com/cokeman0/OpenEpaperElectricPriceTag/issues/3#issuecomment-1920825947, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQYAKW7U3IC6WYVPPKMRNTYRNKYLAVCNFSM6AAAAABCUNFBMGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRQHAZDKOJUG4 . You are receiving this because you commented.Message ID: @.***>

ericedberg commented 7 months ago

Yesterday I save font in media/fonts but now i cannot see them anymore, have to double check.

cokeman0 commented 7 months ago

Yes, that might be the problem

On Thu, Feb 1, 2024 at 10:08 AM ericedberg @.***> wrote:

Yesterday I save font in media/fonts but now i cannot see them anymore, have to double check.

— Reply to this email directly, view it on GitHub https://github.com/cokeman0/OpenEpaperElectricPriceTag/issues/3#issuecomment-1920839597, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQYAKRB2NM2BS6EOSUWZWDYRNLPNAVCNFSM6AAAAABCUNFBMGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRQHAZTSNJZG4 . You are receiving this because you commented.Message ID: @.***>

ericedberg commented 7 months ago

They are there, but i did not see them thru frontend. Logged in to filesystem and they are in place... :(

ericedberg commented 7 months ago

Triggered by the time pattern at 1 februari 2024 kl. 10:04:16 Testa Bekräfta att klockan är efter 6:00 och före 23:30 Fördröjning för 10 sekunder 10 sekunder later Anropa en tjänst "OpenEPaperLink: Draw Custom Image" på open_epaper_link.000001814CF13B35 Stopped because an error was encountered at 1 februari 2024 kl. 10:04:26 (runtime: 10.15 seconds)

unknown file format

ericedberg commented 7 months ago

Do i need to have Energi Data Service also? I use Nordpool.

cokeman0 commented 7 months ago

Try to check etag adresse. all mine are lower case

On torsdag den 1. feb. 2024 10.18 AM, wrote:

Triggered by the time pattern at 1 februari 2024 kl. 10:04:16 Testa Bekräfta att klockan är efter 6:00 och före 23:30 Fördröjning för 10 sekunder 10 sekunder later Anropa en tjänst "OpenEPaperLink: Draw Custom Image" på open_epaper_link.000001814CF13B35 Stopped because an error was encountered at 1 februari 2024 kl. 10:04:26 (runtime: 10.15 seconds) unknown file format You are receiving this because you commented.Message ID:

cokeman0 commented 7 months ago

nope, unless you also use EDS :-)

On torsdag den 1. feb. 2024 10.23 AM, wrote:

Try to check etag adresse. all mine are lower case On torsdag den 1. feb. 2024 10.18 AM, wrote: > Triggered by the time pattern at 1 februari 2024 kl. 10:04:16 Testa Bekräfta att klockan är efter 6:00 och före 23:30 Fördröjning för 10 sekunder 10 sekunder later Anropa en tjänst "OpenEPaperLink: Draw Custom Image" på open_epaper_link.000001814CF13B35 Stopped because an error was encountered at 1 februari 2024 kl. 10:04:26 (runtime: 10.15 seconds) unknown file format You are receiving this because you commented.Message ID:

Med venlig hilsen

Michael Dahl

ericedberg commented 7 months ago

change to lower case. Same result. I have to think about it, maybe figure out. Some file format is wrong... Did anyone else use this automation also?

cokeman0 commented 7 months ago

Fileformat, don't know, there is no "file" only the build in automation editor.

I know a lot is using this.

On torsdag den 1. feb. 2024 10.34 AM, wrote:

change to lower case. Same result. I have to think about it, maybe figure out. Some file format is wrong... Did anyone else use this automation also? You are receiving this because you commented.Message ID:

ericedberg commented 7 months ago

Only file it links to is the Font...

cokeman0 commented 7 months ago

Can you try to download font again and confirm the filesize of the font files

Med venlig hilsen

Michael Dahl

tors. 1. feb. 2024 10.39 skrev ericedberg @.***>:

Only file it links to is the Font...

— Reply to this email directly, view it on GitHub https://github.com/cokeman0/OpenEpaperElectricPriceTag/issues/3#issuecomment-1920904670, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQYAKTUIR54OI565NDAHZ3YRNPD5AVCNFSM6AAAAABCUNFBMGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRQHEYDINRXGA . You are receiving this because you commented.Message ID: @.***>

ericedberg commented 7 months ago

I think i download them at wrong way last time, filesize doesnt match. Now i think its right. Can open on computer. But i cannot save in right place when at work. Test at home later.

cokeman0 commented 7 months ago

Super

Med venlig hilsen

Michael Dahl

tors. 1. feb. 2024 10.54 skrev ericedberg @.***>:

I think i download them at wrong way last time, filesize doesnt match. Now i think its right. Can open on computer. But i cannot save in right place when at work. Test at home later.

— Reply to this email directly, view it on GitHub https://github.com/cokeman0/OpenEpaperElectricPriceTag/issues/3#issuecomment-1920936066, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQYAKWBYERPN5BICBY4JDDYRNQ47AVCNFSM6AAAAABCUNFBMGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRQHEZTMMBWGY . You are receiving this because you commented.Message ID: @.***>

ericedberg commented 7 months ago

it was the font-file. Now it's working!