[patch] 47_OBIS.pm - Fix warning when device type none

Begonnen von dennisk, 29 November 2023, 11:51:04

Vorheriges Thema - Nächstes Thema

dennisk

Since a recent change, where the module 47_OBIS.pm has no device type configured and just echoes the processed input, I have a warning in the log during initialization:
PERL WARNING: Use of uninitialized value in numeric gt (>) at /usr/share/fhem/FHEM/47_OBIS.pm line 643.The anonymized raw definition is:
defmod obis OBIS none
attr obis stateFormat {sprintf("%.0f kWh", (ReadingsVal($name,"total_consumption",0) / 1000) )}

setstate obis 23337 kWh
setstate obis 2023-11-29 11:42:12 ManufID XXX
setstate obis 2023-11-29 11:42:12 PublicKey xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xx
setstate obis 2023-11-29 11:42:12 Serial xx-xx-xx-xx-xx-xx-xx-xx-xx-xx
setstate obis 2023-11-29 11:42:12 power 1234.5
setstate obis 2023-11-29 11:42:12 total_consumption 123456789.5
setstate obis 2023-11-29 11:42:12 total_consumption_Ch1 123456789.5
setstate obis 2023-11-29 11:42:12 total_consumption_Ch2 0


Attached patch file fixes the warning in my installation. However, as I do not have any other SML devices, I cannot test, if the patch has any side effects for other configurations.
I hope, I have understood the code correctly and have proposed an appropriate fix. If there are any remarks or questions, please ask.

dennisk

Just wanted to ask again, if this small patch could be incorporated, or if there are any questions or if I should change something?

Thanks and best

dennisk

It seems, that my first approach was wrong and the message reappeared. Now another try, which seems to work so far - at least the message does not appear (again) after a restart. I uploaded a modified patch file.

dennisk

So far, after some further restarts, the warning is gone. The module is also working as expected. So, I would like to ask again, if this small patch can be integrated? @gvzdus?
thanks and best

dennisk

Weiß jemand, was mit gvzdus los ist? Hier reagiert er nicht, auf PMs auch nicht.