OK, I don't really have time to review your rule so I'll just present how I would do it. I'm just typing this in so there are likely some typos.
Time cron "0 */1 * * * ?"
val String meter_payload = executeCommandLine("/usr/src/sml_server", 5000)
val lines = meter_payload.split('\n')
val counterStr = meter_payload.get(0).split('#').get(1)
val consumptionStr = meter_payload.get(2).split('#').get(1)
Don't make it more complicated than it needs to be. If may feel right to set up a map and go through all of these complicated conversions and such but:
- The format and contents of the string returned by your script is unlikely to change over time
- You are unlikely to change which Item gets which value.
So all of that added complexity does nothing to actually save you work on down the line. So just keep it simple and hard code it. If you feel you must, add a comment to explain what you are doing.
You don't even need to split it into separate lines like I did but I think that little extra step helps make the code just a tad more self documenting.
Remember, we are not writing rules to be read and maintained by other developers. We are not writing rules that must be flexible to handle anything that you can think of to throw at it. So don't be afraid to hard code things and use other tricks (e.g. unroll for loops, switch statements, etc.) that makes the code simpler to read. Your future self will thank you.
Finally, I think your main problem is using primitives in the map without providing the hints it needs to deal with the primitive. This might work:
val Map<Integer, String> meter_map = newLinkedHashMap(1 -> 'Sensoren_Status_Strom', 5 -> 'Sensoren_Leist_Strom')