littleyoda / Home-Assistant-Tripower-X-MQTT

Script which reads out the current measured values of an inverter of the SMA Tripower x (STP XX-50) series and makes them available via MQTT Home Assistant.
The Unlicense
10 stars 3 forks source link

ExitAfter functionality is broken #5

Open X-Coder opened 1 year ago

X-Coder commented 1 year ago

Thank you for your project.

Today I tested it without enabling ExitAfter. But after some time I did not get any updates. So I tried to enable ExitAfter/cronjob.

One of the last commits, which added threading, broke the functionality of ExitAfter because the cfg variable does now only contain device option keys inside the updateTripower function.

https://github.com/littleyoda/Home-Assistant-Tripower-X-MQTT/blob/47ce3db582ec143b016d9920e9b5fb1bbce9de02/sma2mqtt.py#L217 https://github.com/littleyoda/Home-Assistant-Tripower-X-MQTT/blob/47ce3db582ec143b016d9920e9b5fb1bbce9de02/sma2mqtt.py#L219

cfg["ExitAfter"] is outside of cfg["Devices"], so it will be always None https://github.com/littleyoda/Home-Assistant-Tripower-X-MQTT/blob/47ce3db582ec143b016d9920e9b5fb1bbce9de02/sma2mqtt.py#L105

I already fixed it for my self, by giving updateTripower additional a new complete cfg argument instead of only the device part of yaml options. Its not nice, but works for me.