Closed pbcjh10 closed 1 month ago
home-assistant_2024-08-26T09-11-13.046Z.log
Error while processing template: Template<template=({{(as_local(as_datetime(states('sensor.pvopt_charge_start')))|string)[:16]}}) renders=42>
Error while processing template: Template<template=({{(as_local(as_datetime(states('sensor.pvopt_charge_end')))|string)[:16]}}) renders=42>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 603, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2638, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 394, in call
return __context.call(__obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/dt.py", line 159, in as_local
if dattim.tzinfo == DEFAULT_TIME_ZONE:
^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'tzinfo'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 715, in async_render_to_info
render_info._result = self.async_render( # noqa: SLF001
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 605, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: AttributeError: 'NoneType' object has no attribute 'tzinfo'```
```Invalid value for number.pvopt_pass_threshold_p: 4.0 (range 0.0 - 1.0)`1``
Appdeamon/PV_opt creates two log files, "Pv_opt.log" which is unique to Pv_opt, and "error.log" which contains any errors from apps running in Appdeamon. Can you post both of those? From what I can make of your install paths, they are at:
/homeassistant/appdaemon/pv_opt.log /homeassistant/appdaemon/error.log
You also need to check you have a "config.yaml" file at the following location:
/homeassistant/appdaemon/apps/pv_opt/config/config.yaml
Whilst all of my PV_opt is also at /homeassistant/appdaemon/, there is no apps.yaml file in that or any of the subfolders. My apps.yaml is in a separate folder called /addon_configs/a0d7b954_appdaemon/apps/, and the file is basically empty.
What I do have is an appdaemon.yaml file at the the following location :
/addon_configs/a0d7b954_appdaemon/appdaemon.yaml
which has the following entry: " app_dir: /homeassistant/appdaemon/apps"
which appears to provide the link between the two paths.
Hi Steve,
I did some trouble shooting using claude.ai and actually got things working.
Here’s a question though – I’ve just plugged in my car and octopus has generated me some cheap slots during the day.
But the charge plan is only showing things for tomorrow not today.
Does it work with Intelligent Octopus Go? I guess my hope is that it would ‘not’ discharge battery during cheap rates (unless it thought I was going to be over full later, and it would top up battery if shortfall was predicted.
Today for example I came home and plugged the car in this morning; Octopus have given me 8:75-12:00 and 14:30-16:00 at cheap rate. But the next Charge plan is tomorrow from 06:00-09:30 which won’t be at the cheap rate.
Any ideas? Is there any easy way to troubleshoot this?
Thanks,
Peter
From: stevebuk1 @.> Sent: 27 August 2024 21:02 To: fboundy/pv_opt @.> Cc: pbcjh10 @.>; Manual @.> Subject: Re: [fboundy/pv_opt] Error while processing template: (Issue #264)
Appdeamon/PV_opt creates two log files, "Pv_opt.log" which is unique to Pv_opt, and "error.log" which contains any errors from apps running in Appdeamon. Can you post both of those? From what I can make of your install paths, they are at:
/homeassistant/appdaemon/pv_opt.log /homeassistant/appdaemon/error.log
You also need to check you have a "config.yaml" file at the following location:
/homeassistant/appdaemon/apps/pv_opt/config/config.yaml
Whilst all of my PV_opt is also at /homeassistant/appdaemon/, there is no apps.yaml file in that or any of the subfolders. My apps.yaml is in a separate folder called /addon_configs/a0d7b954_appdaemon/apps/, and the file is basically empty.
What I do have is an appdaemon.yaml file at the the following location :
/addon_configs/a0d7b954_appdaemon/appdaemon.yaml
which has the following entry: " app_dir: /homeassistant/appdaemon/apps"
which appears to provide the link between the two paths.
— Reply to this email directly, view it on GitHub https://github.com/fboundy/pv_opt/issues/264#issuecomment-2313402278 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3A5EQAWIBIIJTI5IMBRXTZTTLKDAVCNFSM6AAAAABNDS62Y2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJTGQYDEMRXHA . You are receiving this because you are subscribed to this thread. https://github.com/notifications/beacon/AE3A5EXMQEGHC4ATOZHJGQDZTTLKDA5CNFSM6AAAAABNDS62Y2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUJ4O32M.gif Message ID: @. @.> >
Here’s a question though – I’ve just plugged in my car and octopus has generated me some cheap slots during the day. But the charge plan is only showing things for tomorrow not today. Does it work with Intelligent Octopus Go?
For the version you have installed (the production version, via HACS), the answer is "sort of". Pv_opt will download the IOG tariff using the Octopus Energy Integration but at fixed times during the day. It will do battery/charge discharge based on the cheap rate of 23:30 to 5:30, but it generally means it won't pick up any extra slots you get allocated. I've been working on a Beta version of Pv_opt that properly integrates IOG, more on this later.
I guess my hope is that it would ‘not’ discharge battery during cheap rates (unless it thought I was going to be over full later, and it would top up battery if shortfall was predicted.
Yes thats basically it, but based on what is lowest cost.
Today for example I came home and plugged the car in this morning; Octopus have given me 8:75-12:00 and 14:30-16:00 at cheap rate. But the next Charge plan is tomorrow from 06:00-09:30 which won’t be at the cheap rate. Any ideas? Is there any easy way to troubleshoot this?
Even given the limitations of the production release which will only pick up the cheap rate of 23:30 to 05:30, I wouldn't have expected any charging at 6:00 to 9:00. Troubleshooting is largely impossible without a Pv_opt.log attached, extra debugging can be turned on via config.yaml if needs be. However, for all IOG issues, please use the open issue of EV charging support here #121.
As mentioned earlier there is an EV integration in development thats in Beta. It supports IOG by detecting car plugin to pick up the extra slots, and for those who have their EV chargers wired as part of thier house load, it will prevent house battery discharge during EV charging. It currently only works with Zappi chargers when its the Zappi that is integrated with IOG (and not the car), but am happy to add the other chargers IOG support, just let me know (Ohme and Wallbox I think are the only other two).
If you have a Zappi charger and want to try the Beta release, then
Copy all of pv_opt.py, solis.py and py.py from
https://github.com/stevebuk1/pv_opt/tree/dev/apps/pv_opt
to your homeassistant location here:
/homeassistant/appdaemon/apps/pv_opt
Appdeamon will automatically detect the updated files and restart Pv_opt automatically.
Probably best to also use the dashboard here, as it has extra windows for displaying the car charging plan etc. https://github.com/stevebuk1/pv_opt/blob/dev/pvopt_dashboard.yaml
Okay, So I have your fork running I think. But I cant load the dashboard. I've copied and pasted, and re-downloaded the dependencies
template-entity-row
bar-card
card-mod
Stack In Card
layout-card
apexcharts-card
Are there any other things for your dashboard? When i copy and paste the yaml into a new blank dashboard there's no error messages, it just displays nothing. Not sure what I'm doing wrong.
I also have this error appearing but think this is unrelated: Logger: homeassistant.components.recorder.db_schema Source: components/recorder/db_schema.py:625 integration: Recorder (documentation, issues) First occurred: 11:22:36 (46 occurrences) Last logged: 14:32:26
State attributes for sensor.pvopt_base_cost exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
State attributes for sensor.pvopt_opt_cost exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
State attributes for sensor.pvopt_opt_cost_current exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
State attributes for sensor.pvopt_opt_cost_flux exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
Hi all, Just to follow up. Steve, i have changed to your fork - still running in test mode and not sure what I'm looking for but will watch for a few days before turning it on.
Just to follow up, this was caused I think by Appdaemon changes whereby it used to install files inside the homeassistant directory and now installs via Addons outside /homeassistant. I needed a redirect in my config file like this: app_dir: /homeassistant/appdaemon/apps config_dir: /homeassistant/appdaemon/apps/pv_opt I then also needed an init.py within my pv_opt folder It then worked, but the dashboard only showed up once I edited in my octopus import/export entity numbers/names correctly, without these it would just error and not load at all.
I think I am up and running - until the next patch or failure! Happy for this to be closed but I thought I'd reply in case it helps some other clueless newbie trying to fumble their way through yaml!
Great, pleased its up and running. Yes you just get errors until it finds the essential entities for Solcast, the inverter and power consumption as without these it can't produce a charge/discharge plan. Best leave it in read-only for a few days and check the plans it generates makes sense.
If you haven't discovered it already you'll need to switch off "EV part of house load" otherwise it will muck up the house consumption figures. I don't think this switch has been tested by anyone yet (we all have our Zappis seen as house load) so if you find it doing things it shouldn't (like stopping the house battery discharging when the car is charging, which isn't necessary in your setup) please add a comment to the EV integration issue and post logs so I can do fixes.
Hello,
Sorry if this is a stupid request or an obvious answer. Hopefully both and can be closed quickly! I'm trying to setup pv_opt on a HA green. I have got it installed but i'm not sure its launching correctly/at all - I have the attached error (and full logs:
Error while processing template: Template<template=(<h3><u>Cost Summary (GBP)</u></h3> | | Today | Tomorrow | Total | |:--|---:|---:|---:| |Base | {{'%8.2f' | format(state_attr('sensor.pvopt_base_cost','cost_today')| float)}} | {{'%0.2f' | format(state_attr('sensor.pvopt_base_cost','cost_tomorrow')| float)}} | {{'%0.2f' | format(states('sensor.pvopt_base_cost')| float)}} | |Optimised | {{'%8.2f' | format(state_attr('sensor.pvopt_opt_cost','cost_today')| float)}} | {{'%0.2f' | format(state_attr('sensor.pvopt_opt_cost','cost_tomorrow')| float)}} | {{'%0.2f' | format(states('sensor.pvopt_opt_cost')| float)}} | |<b>Cost Saving</b> | <b>{{'%8.2f' | format((state_attr('sensor.pvopt_base_cost','cost_today')| float-state_attr('sensor.pvopt_opt_cost','cost_today')| float) | round(2))}}</b> |<b>{{'%0.2f' | format((state_attr('sensor.pvopt_base_cost','cost_tomorrow')| float-state_attr('sensor.pvopt_opt_cost','cost_tomorrow')| float) | round(2))}} </b> |<b> {{'%0.2f' | format((states('sensor.pvopt_base_cost')| float - states('sensor.pvopt_opt_cost')| float) | round(2)) }}</b> | <h3><u>Optimisation Breakdown (GBP)</u></h3> | | Cost || |:--|:--|:--| {% set x = state_attr("sensor.pvopt_opt_cost","Summary")%}{%for y in x%}|{{y}}|{{('%0.2f' | format(x[y]['cost']))}}|{{x[y]['Selected']}}| {%endfor%} <h3><u>Charge Plan</u></h3> | Start | | | End ||| Power ||| Start SOC ||| End SOC | Hold SOC | |:-------|--|--|:---------|--|--|:--------:|--|--|:--------:|--|--|:----------:|:--|{% for a in state_attr('sensor.pvopt_charge_start', 'windows') %} {% set tf = '%d-%b %H:%M %Z'%} | {{as_local(as_datetime(a['start'])).strftime(tf)}} ||| {{as_local(as_datetime(a['end'])).strftime(tf)}} ||| {{a['forced'] | float | round(0)}}W ||| {{a['soc'] | float | round(1)}}% ||| {{a['soc_end'] | float | round(1)}}% | {{a['hold_soc']}} |{%endfor%}) renders=1034>
I had issues with Appdamon as the install location for pv_opt via hacs is in a different folder so had to move that. I now have it running, and pv_opt is recognised within Appdaemon, but I'm not sure its right. I moved the pv_opt install into /homeassistant/appdaemon/apps/pv_opt I then moved apps.yaml to the above /apps/ folder and added files like this:
hello_world: module: hello class: HelloWorld pv_opt: module: pvopt class: pvopt pvpy: module: pvpy class: pvpy solis: module: solis class: solis
But then in the appdaemon logs I have this on startup so I'm not sure if its trying to double load