I can find neither SMF-get-sessionid nor _getTriggeredData in the posted code anywhere. Are you sure this error is coming from this code?
Thanx for your quick reply! In the expression above “rules” causes the error. Without it the script runs - after I defined the 3 neccessary items.
SMF-get-sessionid is the name of the skript in openhab
My big, big mistake was, that I thought the script could add the missing cookie to the Openhab Remote bridge to SMF. But the program is designed to work with the HTTP Binding! The thingUID points to the http thing, Have I mentioned, that I really like comments in scripts? ![]()
Now I’m fighting with the JSON output of the channels I have to define to pick up the values I get back from SMF,
The output is like that
link "http://karaf/rest/items/solarwattBattery_batteryflex_BatteryFlex_0BB113_batteryChannelGroup_batteryPower"
state "-668.3160 W"
stateDescription
pattern "%.2f %unit%"
readOnly true
options []
editable false
type "Number:Power"
name "solarwattBattery_batteryflex_BatteryFlex_0BB113_batteryChannelGroup_batteryPower"
label "Readonly Power"
tags []
groupNames []
The item definition is like that:
And the error in the log is this one:
[ofiles.JSonPathTransformationProfile] - Could not transform state ‘UNDEF’ with function ‘$.state’ and format ‘%s’
OMG…
The error should be self explanatory. In your screen shot the Item’s state is UNDEF. UNDEF isn’t JSON. You cannot extract any value from it.
The HTTP binding will set the Item’s state to UNDEF if the HTTP call fails for some reason.
Next problem:
from a http request I get back a json structure like that;
state "1771082595000|522.1043333333333 W"
stateDescription
pattern "%s"
readOnly true
options []
editable false
type "String"
name "kiwigrid_location_standard_eca7bb820c79_harmonized_power_consumed"
label "PowerConsumed"
tags []
groupNames []
With a JSONPATH:$.state in the thing I get
1771082595000|522.1043333333333 W
When I enter the simple ([0-9]*) followed by a .* in the Link/Item it delivers the expected value 1771082595000.
But what I need ist everything behind the |. I tried it with a regex in the item: ([^|]*$) (with .* in front of or behind the expression) which works fine on regex101.com!
But whatever I enter here: The result is always an empty item! I’m close to desperation…
Any ideas?
I couldn’t give up ![]()
Solution is
.*\|(.*\d).*
So now I’ll be able to rebuilt the access from openHAB to my Solarwatt Manager Flex using
- http binding
- regex addon
- js addon
- jsonpath addon
Thanx, Rich, for helping me!
I couldn’t give up ![]()
Solution is
.*\|(.*\d).*
So now I’ll be able to rebuilt the access from openHAB to my Solarwatt Manager Flex using
- http binding
- regex addon
- js addon
- jsonpath addon
Thanx, Rich, for helping me!
CONCLUSION: If anyone need a relatively detailed description on how to integrate a SOLARWATT Manager Flex (SMF) into openHAB with the http-binding please contact me via PM. Unfortunately it is only in german but due to the technical expressions it should easily been understand by anyone.
The removed the rest/items/ path - could that be? I get 404 with an exeption type:
| exceptionType | “javax.ws.rs.NotFoundException” |
|---|
Yes, they did! By the end of June with a new SMF Release. Maybe they removed it, maybe they hided it.
Solution until their next anti-customer-action:
Use these links in your http Binding:
http://smf-ip/rest/hems-configurator/energy-overview
http://smf-ip/rest/hems-configurator/power-indicator
You will receive json replies which you simply can parse.
For SMF a session-cookie with pwd is needed (nothing changed here)
For BatteryFlex no pwd is needed
Good luck!
Unfortunately I can not read the battery stage via http://MYIP/stat - it says: “Nothing matches the given URI”
the other two links are working but I only can read battery in and out… not Stage of Charge, no status.
Are there other REST links you found already?
Thanks
Ronald
No. And the Battery-Link works only for BatteryFlex Systems (not vor Vision). Or maybe there is another link useful?
