Closed ruteclrp closed 1 year ago
Try:
additional_costs: >
{% if now().hour >= 0 and now().hour < 6 %}
{{ current_price + 0.210 | float }}
{% if now().hour >= 6 and now().hour < 17 %}
{{ current_price + 0.640 | float }}
{% if now().hour >= 17 and now().hour < 21 %}
{{ current_price + 1.910 | float }}
{% if now().hour >= 21 and now().hour < 24 %}
{{ current_price + 0.640 | float }}
{% endif %}
Thanks. When added to the configuration.yaml it returns this error: missed comma between flow collection entries (49:6) 46 | # The template price is in EUR, ... 47 | # For example: "{{ current_price ... 48 | additional_costs: > 49 | {% if now().hour >= 0 and now(). ... -----------^ 50 | {{ current_price + 0.210 | f ... 51 | {% if now().hour >= 6 and now(). ... Venlig hilsen L. Robert Pedersen +45 2048 4482 Sent from my iPhone
On 3 Jan 2023, at 21.45, Steffen Fredriksen @.***> wrote:
Try:
additional_costs: >
{% if now().hour >= 0 and now().hour < 6 %}
{{ current_price + 0.210 | float }}
{% if now().hour >= 6 and now().hour < 17 %}
{{ current_price + 0.640 | float }}
{% if now().hour >= 17 and now().hour < 21 %}
{{ current_price + 1.910 | float }}
{% if now().hour >= 21 and now().hour < 24 %}
{{ current_price + 0.640 | float }}
{% endif %}
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
Think I solved the issue - my lack of knowledge on syntax. Asked ChatGTP which returned:
It looks like there may be an issue with the way you have formatted your configuration. The error message "expected the node content, but found" usually indicates that there is a problem with the way a value is being defined in the configuration.
In this case, it looks like you are trying to use a Jinja template to define the value of the additional_costs key. However, it seems that the template is not being properly interpreted by Home Assistant.
There are a few things you could try to resolve this issue:
1) Make sure that you have correctly indented the lines of the template. In YAML, indentation is significant, and it is used to denote the structure of the document. Each level of indentation should use two spaces.
2) Make sure that you are using the correct syntax for the Jinja template. The template should start with {% and end with %}. Within the template, you can use Jinja control structures such as "if" and "elif" to specify different values based on certain conditions.
3) Make sure that you have correctly terminated the template. The template should end with a closing curly bracket and percentage sign, followed by a comma.
maybe you could share what solved your problem?
The code was right, the indentations not.
This is from by configuration.yaml
platform: nordpool '# Country/region to get the energy prices for. region: "DK2"
'# Override HA local currency used to fetch the prices from the API. currency: "DKK"
'# Add Value Added Taxes (VAT)? VAT: True
'# Energy price rounding precision. precision: 3
'# Display price in cents in stead of (for example) Euros. price_in_cents: false
'# Price displayed for MWh, kWh or Wh price_type: kWh
'# Template to specify additional cost to be added to the tariff.
'# The template price is in EUR, DKK, NOK or SEK (not in cents).
'# For example: "{{ current_price * 0.19 + 0.023 | float}}"
additional_costs: >
{% if now().hour >= 0 and now().hour < 6 %}
{{ 0.351 | float }}
{% elif now().hour >= 6 and now().hour < 17 %}
{{ 0.781 | float }}
{% elif now().hour >= 17 and now().hour < 21 %}
{{ 2.051 | float }}
{% elif now().hour >= 21 and now().hour < 24 %}
{{ 0.781 | float }}
{% endif %}
thanks. got is now. - what did you add to the tarifs? seems higher now?
We have just from starting this year had differentiated transport fees for electricity. There are 3 levels, very cheap during night and very expensive during evening peak hours. These differentiated transport costs themselves makes the battery I have running charge from grid very much worth while. Usually the raw electricity price just increases the net prices diff between night and evening peak.
jeps. det er jeg med på :-). mine batterier er på vej hjem men tariffen er 1,910 plus 11 ører til Energinet (plus moms) det giver 2,02. du har 2.051. (som sikkert er rigtigt) jeg kan bare ikke se hvor det extra kommer fra? jeg er ikke tal expert :-)
har du ellerede en beregning på besparelse i år efter de nye tariffer?
nettarif C er 1,91 kr/KWh Systemtarif er 0,068 kr/KWh Transmissionstarif er 0,073 kr/KWh Det skulle give 2,051 Kr/KWh Nettarif er med moms. Kan ikke helt gennemskue om de andre er det. Når jeg ser på prisen i diverse app's giver Watts 1,24 Min Strøm 1.31 Andel 1,30 Min udregning 1,235 Ingen tvivl om at jeg mangler lidt, ligesom Watts også gør. Problemet ligger vis i at visse af månedsafgifterne tillægges forskelligt afhængigt af elselskab. Når jeg kigger på forskellen ser den ud til at være rimelig konstant. Derfor har den heller ikke rigtig betydning for det jeg skal bruge den til - nemlig at regne ud hvor stor forskellen er mellem billigst og dyrest strøm indenfor samme døgn.
ja det er lidt ugennemsigtigt, men det får vi nok styr på senere :-). har du regnet på hvad du har sparet på batteridriften? det vil jeg gerne kunne aflæse i home assistant på et tidspunkt... altså uden at tage hensyn til indkøb osv..
Besparelse er svært at regne ud, men baseret på afgiftsforskellen bliver det minimum 25,5 pr døgn eller 765 pr måned. regner med at denne driftsform betaler sig i 6 måneder før solen giver så meget at jeg skal skifte mode på batteriet. Altså minimum 4600 pr år. Realistisk regner jeg med en gennemsnitsprisforskel på 2,5 kr/KWh eller knap 7000 pr år. Oplevede at priserne svingede 2 gange i døgnet i oktober så det kunne betale sig at køre 2 lade/aflade sekvenser hver dag - og det fordoblede jo gevinsten i den måned.
Lyder godt. jeg har ikke sol, og har bestilt batteri nok til 24 timers forbrug (15kW). håber det kommer til at køre.
Spændende. Hvordan har du tænkt dig at koble det op til husets installation?Skal du køre grid-tied eller off-grid når du forbruger?Hvad med tilladelse?Hvis grid-tied skal det vel godkendes som VE anlægVenlig hilsenL. Robert Pedersen+45 2048 4482Sent from my iPhoneOn 7 Jan 2023, at 22.43, Duckshousemacservice @.***> wrote: Lyder godt. jeg har ikke sol, og har bestilt batteri nok til 24 timers forbrug (15kW). håber det kommer til at køre.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
on grid men ikke som producent af el. så det burde ikke være nødvendigt med godkendelse hvis bare jeg bruger godkendt inverter. det er en deye 12kW. som er på positivlisten. det er i hvert fald hvad vi har kunnet læse os til. vi er et par stykker der laver samme system.
Closing as the user found the error on their side and all conversations after was off-topic
Im using the same code.
Get the same error.
missed comma between flow collection entries (45:6)
42 | # The template price is in EUR, ... 43 | # For example: "{{ current_price ... 44 | additional_costs: > 45 | {% if now().hour >= 0 and now(). ... -----------^ 46 | {{ 0.351 | float }}
What was the fix?
`sensor:
The code was right, the indentations not.
This is from by configuration.yaml
- platform: nordpool '# Country/region to get the energy prices for. region: "DK2" '# Override HA local currency used to fetch the prices from the API. currency: "DKK" '# Add Value Added Taxes (VAT)? VAT: True '# Energy price rounding precision. precision: 3 '# Display price in cents in stead of (for example) Euros. price_in_cents: false '# Price displayed for MWh, kWh or Wh price_type: kWh '# Template to specify additional cost to be added to the tariff. '# The template price is in EUR, DKK, NOK or SEK (not in cents). '# For example: "{{ current_price * 0.19 + 0.023 | float}}" additional_costs: > {% if now().hour >= 0 and now().hour < 6 %} {{ 0.351 | float }} {% elif now().hour >= 6 and now().hour < 17 %} {{ 0.781 | float }} {% elif now().hour >= 17 and now().hour < 21 %} {{ 2.051 | float }} {% elif now().hour >= 21 and now().hour < 24 %} {{ 0.781 | float }} {% endif %}
im not sure what you mean with the indentations was wrong. How did you fix that?
0.0.9 Version of the custom_component
2022.12.9 Homeassistant version
Configuration
Describe the bug
The syntax of the if statements is not accepted - claim some missing (,)
Unable to figure out what the reason is, but then, I am also not yet an avid HA nerd.