rlindner / node-red-contrib-sma-webconnect

Node-RED node to query the web interface of SMA inverters
MIT License
13 stars 9 forks source link

Avoid TypeError when an invalid DeviceClassId is used #38

Closed tgloekler closed 7 months ago

tgloekler commented 7 months ago

This fixes a crash of node-red that I have seen today with my SMA Tripower8 SE device. Apparently, the value[config.id] was not iterable in one use of this function. I could not verify the final results, since my device is not yet connected to the public grid at this time (all values are still 0).

rlindner commented 7 months ago

Hey, thanks for your contribution!

The crash happens because the Tripower Smart Energy is a different device class. See the table I've just added to the Readme: https://github.com/rlindner/node-red-contrib-sma-webconnect#example-input-payload. So if you're using a custom config you need to use the id "9" for it. You receive 0 values, because that's the initial value for each reading and the parsing of the values just fails.

I've also added a new preset for the Smart Energy models: https://github.com/rlindner/node-red-contrib-sma-webconnect/blob/master/device-presets/sunny_tripower_smart_energy.json

tgloekler commented 7 months ago

 Vielen Dank auf jeden Fall für die praktische SMA-Interface Komponente, Herr Lindner!Bei mir funktioniert jetzt alles, allerdings hat mein WR das Feature, dass einige Arraywerte wie die DC-String-Power eine ID 1 statt der 9 haben.Die lese ich dann halt mit einer 2. Custom- configuration aus.Frohes Programmieren weiterhin!Mit freundlichen Grüßen,Tilman GlöklerVon meinem iPhone gesendetAm 13.01.2024 um 14:45 schrieb Roland Lindner @.***>: Hey, thanks for your contribution! The crash happens because the Tripower Smart Energy is a different device class. See the table I've just added to the Readme: https://github.com/rlindner/node-red-contrib-sma-webconnect#example-input-payload. So if you're using a custom config you need to use the id "9" for it. You receive 0 values, because that's the initial value for each reading and the parsing of the values just fails. I've also added a new preset for the Smart Energy models: https://github.com/rlindner/node-red-contrib-sma-webconnect/blob/master/device-presets/sunny_tripower_smart_energy.json

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>