home-assistant-goodwe-inverter icon indicating copy to clipboard operation
home-assistant-goodwe-inverter copied to clipboard

Data output when inverter is waiting or offline

Open djoenez opened this issue 3 years ago • 10 comments

Hello, Thanks alot for this code! It works perfect.

I had a question, now when my inverter does not have enough V/A it will just go to waiting mode, but the Goodwe_PPV will not output any number anymore when it is polled. Could this be catched by the code? (maybe a if time before/after then output 0 if system is offline?) or output zeros when no data can be pulled?

djoenez avatar Dec 08 '21 16:12 djoenez

I narrowed it down some more, is it possible to (in sensor.py) add an if statement that if inverter is not in "working" mode, PPV actual will be set to 0?

djoenez avatar Dec 09 '21 09:12 djoenez

I'm not sure I understand what you wish to achieve. I assume the sensors report themselves as Unavailable when your inverter goes to sleep mode (and does not respond to udp packets anymore).

mletenay avatar Dec 12 '21 15:12 mletenay

Thanks for responding. The issue i'm trying to solve is that my graphs mess up when my inverters become unavailable. I could use the fill zero option (in grafana). But then also when i do not get any data from my inverters, i get large dips (Which are not actually there).

So What i would like to have is an option that if the inverters is not in working mode that the script itself just pushes a 0 value. so that during the night there is 0 output, instead of "null" output.

djoenez avatar Dec 13 '21 07:12 djoenez

I have the same request! The possibility to report a zero value will give less headache and prettier looking graphs.

tuomaz avatar Dec 17 '21 12:12 tuomaz

For integration it would be nonsense as it really is unavailable. Just make sensor in configuration.yaml and make this sensor read value and in 'unavailable' present zero or whatever you need.

darek-margas avatar Jan 01 '22 12:01 darek-margas

Hello Darek-Margas,

I do see that the implementation would be nonsense from a technical perspective. From a functional perspective atleast i see the use. But:

You describe a code piece in configuration.yaml that would read the sensor value and have an if statement that if it is unavailable the data should be 0. Could you help me with such a code piece?

djoenez avatar Jan 05 '22 08:01 djoenez

You describe a code piece in configuration.yaml that would read the sensor value and have an if statement that if it is unavailable the data should be 0. Could you help me with such a code piece?

There is number of ways. One example from my config:

power_consumption: value_template: "{% if is_state_attr('sensor.pvoutput', 'power_consumption', 'NaN') %}0{% else %}{{ state_attr('sensor.pvoutput', 'power_consumption') }}{% endif %}" friendly_name: "Using" unit_of_measurement: "W" device_class: power When you replace NaN by anything you get and make matching sensors it will do. Another method which I used to do exactly opposite is like that:

pv_temperature: unit_of_measurement: '°C' friendly_name: "Inverter temperature" device_class: temperature value_template: >- {% set mytemp = state_attr('sensor.inverter_goodwe_miranda', 'tempperature') | float(0) %} {%- if mytemp > 0 -%} {{ mytemp }} {%- else -%} unavailable {%- endif -%} just write it in opposite way - else 0 and matching sensors.

Or if you want to keep range and outside make 0:

pv_voltage: unit_of_measurement: 'V' friendly_name: "Inverter AC Voltage" device_class: voltage value_template: >- {% set myvac1 = state_attr('sensor.inverter_goodwe_miranda', 'vac1') | float(0) %} {%- if myvac1 >= 180 and myvac1 <= 280 -%} {{ myvac1 }} {%- else -%} unavailable {%- endif -%}

And so on...

darek-margas avatar Jan 05 '22 08:01 darek-margas

Hello Darek Margas,

Thanks for replying. I'll implement it once I have some time.

Op wo 5 jan. 2022 om 09:45 schreef Darek Margas @.***>:

You describe a code piece in configuration.yaml that would read the sensor value and have an if statement that if it is unavailable the data should be 0. Could you help me with such a code piece?

There is number of ways. One example from my config:

power_consumption: value_template: "{% if is_state_attr('sensor.pvoutput', 'power_consumption', 'NaN') %}0{% else %}{{ state_attr('sensor.pvoutput', 'power_consumption') }}{% endif %}" friendly_name: "Using" unit_of_measurement: "W" device_class: power When you replace NaN by anuthing you get and make matching sensors it will do. Another method which I used to do exactly opposite is like that:

pv_temperature: unit_of_measurement: '°C' friendly_name: "Inverter temperature" device_class: temperature value_template: >- {% set mytemp = state_attr('sensor.inverter_goodwe_miranda', 'tempperature') | float(0) %} {%- if mytemp > 0 -%} {{ mytemp }} {%- else -%} unavailable {%- endif -%} just write it in opposite way - else 0 and matching sensors.

Or if you want to keep range and outside make 0:

pv_voltage: unit_of_measurement: 'V' friendly_name: "Inverter AC Voltage" device_class: voltage value_template: >- {% set myvac1 = state_attr('sensor.inverter_goodwe_miranda', 'vac1') | float(0) %} {%- if myvac1 >= 180 and myvac1 <= 280 -%} {{ myvac1 }} {%- else -%} unavailable {%- endif -%}

And so on...

— Reply to this email directly, view it on GitHub https://github.com/mletenay/home-assistant-goodwe-inverter/issues/93#issuecomment-1005488515, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALNG3EAE4F5KIWBRZFVEHMTUUQAJXANCNFSM5JUGFQJA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

--

Jeroen van den Brink T: +31644660766 Vesperplein 2 5057EN Berkel-Enschot

djoenez avatar Jan 09 '22 09:01 djoenez

If there is a way to make the sensor "Total PV Generation" keep its value even if the inverter goes offline it would be nice. That value is actually not nosense, total pv generation is still the same even if the sun is currently not shining. I guess many people want to show that value in a dashboard (myself included). I haven't looked into HA component development and maybe it is not possible to fix this in an easy way. I can see some potential pitfalls if for example the HA instance is restarted when the inverter is offline...

tuomaz avatar Jan 20 '22 07:01 tuomaz

https://github.com/home-assistant/core/issues/66596

mletenay avatar Feb 18 '22 13:02 mletenay