-
Notifications
You must be signed in to change notification settings - Fork 3
Setup for writing values #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
idm_update_pv_values:
alias: Update Photovoltaik values to IDM Headpump
sequence:
- service: idm_heatpump.set_power
target:
entity_id: [ID FOR Aktueller PV-Überschuss]
data:
value: {{ states("sensor.wp_aktueller_pv_uberschuss") }}
- service: idm_heatpump.set_power
target:
entity_id: [ID FOR Aktueller PV-Produktion]
data:
value: {{ states("sensor.pv_aktuelle_produktion") }}
mode: single @geryyyyyy I think this is the replacement for the config from #10 (comment). You have to replace the For testing you can also go to the "Developer Tools" page in Home Assistant and on the "Services" tab select the service from this integration (search for |
@geryyyyyy Are there any errors with more information in the Home Assistant logs? (under Settings -> System -> Logs) Just guessing from the config above, I'd say both "PV aktuelle Produktion" and "WP aktueller PV Überschuss" are formatted as text, but the service expects a number. I think this config may work: template:
- sensor:
- name: "PV aktuelle Produktion"
unique_id: "idm_aktuelle_pv_produktion"
unit_of_measurement: "kW"
state: >
{{ states('sensor.pv_power')|float / 1000 if has_value('sensor.pv_power') else 0.0 }}
state_class: measurement
device_class: power
icon: mdi:solar-power
- name: "WP aktueller PV Überschuss"
unique_id: "idm_aktueller_pv_ueberschuss"
unit_of_measurement: "kW"
state: >
{{ [0, states('sensor.meter_active_power_total')|float / 1000] | max if has_value('sensor.pv_power') and has_value('sensor.meter_active_power_total') else 0.0 }}
state_class: measurement
device_class: power
icon: mdi:solar-power
|
Thank you for the modified yaml. Unfortunately the service is still not working with the sensor data.
Sorry for not checking this earlier. There are indeed errors, which seem to root all to the same source: sensor_addresses.py line 142
It is failing in this assert check. I am not sure how the variable types 'dict' and 'int' are handled in HA, or how i can adapt it according to work with the service. |
A negative value could be interpreted as "consuming more than producing" (i.e. deficit). Whether that happens is unclear, but better to keep the option open.
I just updated the PR. Please download and try again. The service call will still fail, but I added some logging, so I can figure out where this Once you updated, enable debug logging for the integration. Then wait until the error happens again, stop debug logging and post the logs as a file (or just post the new "Calling set_power with value ..." line from the logs). |
Here is the log. In the service section I use this code in yaml view.
However, if i switch into UI and back into yaml view, it looks like this.
|
Ah okay, I think you need quotes around the template: service: idm_heatpump.set_power
data:
target: sensor.idm_warmepumpe_aktueller_pv_produktion
value: "{{ states('sensor.pv_aktuelle_produktion') }}" Or do the multi-line string trick that many Home Assistant examples use: service: idm_heatpump.set_power
data:
target: sensor.idm_warmepumpe_aktueller_pv_produktion
value: >
{{ states('sensor.pv_aktuelle_produktion') }} YAML is sometimes weird... |
Great, this is working now for the produktion. Now i tried to do the same with uberschuss, but it seems there is a different problem here.
Error in same line, but stating 'NoneType'.
Debug File here. |
Small error because I now allow negative values for the "Überschuss" in case the heat pump has some use for that. Should be fixed with the latest update of the PR. |
Great, now I can execute it without any errors. To summarize:
I will test and monitor the script tomorrow. |
That means the left side of I suspect the issue is the way you implemented the fallback to
I think, because the whole template is a string the
The
|
@geryyyyyy If you have any further issues, please create a new issue. |
Adds a some basic setup for writing values back to the heat pump.
Testing this PR
If you want to test this PR there are two options:
idm_heatpump
directory into<config_dir>/custom_components/idm_heatpump
of your existing Home Assistant instance (replacing existing files). Then restart Home Assistant to activate the new version.I would recommend the first approach since it keeps your main Home Assistant instance in a clean and working state.