I have solar panels. Every time they have produced 1000KwH, I get money for this from the government. I always have to pass this on via a specific website my.fluvius.be.
I have created an automation for this, which notify me by email.
The e-mail contains the total electricity produced, which I then
enter manually in my.fluvius.be.
Once this is done, I have to enter this same number in a helper in Home Assistant (input_number.number_doorgegeven_groene_meterstand).
I would also like to automate the latter, but I donāt know howā¦ Ideal would be a button in the e-mail, which would update the helper with the correct value when clickedā¦ but is this possible?
So hereās the automation I already have:
alias: Groenestroomcertificaat aanvragen
description: ''
trigger:
- platform: time
at: '06:00'
condition:
- condition: template
value_template: >-
{% set i = states('input_number.number_doorgegeven_groene_meterstand') |
int %} {% set i = (i / 1000) | int %} {% set i = (i * 1000) | int %} {{
(states('sensor.energy_produced_total_zonnepanelen_kwh') | int - i | int)
> 1000 }}
action:
- service: notify.gmail
data:
title: Groenestroomcertificaat aanvragen
message: >-
Meterstand : {{ states('sensor.energy_produced_total_zonnepanelen_kwh')
| int }} (https://mijn.fluvius.be)
mode: single
alias: Groenestroomcertificaat aanvragen
description: ''
trigger:
- platform: time
at: '06:00'
condition:
- condition: template
value_template: >-
{% set i = states('input_number.number_doorgegeven_groene_meterstand') |
int %} {% set i = (i / 1000) | int %} {% set i = (i * 1000) | int %} {{
(states('sensor.energy_produced_total_zonnepanelen_kwh') | int - i | int)
> 1000 }}
action:
- service: input_number.set_value
target:
entity_id: input_number.number_doorgegeven_groene_meterstand
data:
value: "{{ states('sensor.energy_produced_total_zonnepanelen_kwh') }}"
- service: notify.gmail
data:
title: Groenestroomcertificaat aanvragen
message: >-
Meterstand : {{ states('sensor.energy_produced_total_zonnepanelen_kwh')
| int }} (https://mijn.fluvius.be)
mode: single
Something along the lines of this? Why push a button, when you can do that via automation.
And if you need or want a button, just write a seperate automation, where you set the value on the click of a button in your dashboard. Or did I misunderstood what you want to achieve?
EDIT: added the missing quotation marks around the value template
āActionable notificationsā are great and I use regularly, but in this case too dangerous that I accidentally delete the notification without having previously entered the data at fluvius (the e-mail stays nicely in the inbox).
Iām currently going for Patrickās solution and update the helper at the same time as sending the email. I first wanted to do it with an intermediate step, because it once happened that the fluvius site didnāt workā¦but now that I think about it, the mail stays in my mailbox so it should work like this.
Can you set the number on that page (fluvius) automatically? I mean, is there an api or something to do this?
You could insert something in your automation to set that value, wait a bit and check if the value is set. After that you put the number in your input_number and send out a āOK, all doneā mail.
Welcome back! Sorry, my bad, I missed the quotation marks around the template lineā¦
This line value: {{ states('sensor.energy_produced_total_zonnepanelen_kwh') }}
has to be escaped by quotation marks value: "{{ states('sensor.energy_produced_total_zonnepanelen_kwh') }}"