Sorry for misleading you, this canāt work without translation in a rule. The WeMo binding sends the information in DateTime form.
Let me think about it a bit more.
.sitemap Text item=S02D001_nUptime label="Uptime [%s]"
With this in place I get the uptime reported as for example ā9 days 13:43ā.
I choose the format to be similar to that being reported by the System Info binding. Obviously, you can tweak the JS code to format it any way you like.
If you want/need your uptime item in openHAB to be of type DateTime, then I guess this should be possible too - although I have not tried it.
Hi guys, just trying to borrow this code to show the uptime of my Homie devicesā¦
I dontāt really know what Iām doing but created a āuptime.jsā file in the ātransformā folder of openhab and then setup my item the same as yoursā¦
No joy thoughā¦ I get massive errors in the openhab log with stuff likeā¦
26:2 Invalid return statement
Any pointers?
UPDATE : Hmmm looks like I had copied the JS script and missed the first line Works perfectly nowā¦
I have no experience with Wemo devices, but from the documentation (the Wiki) it looks like the Wemo binding does not support transformations, so I donāt think you can use the script in the way shown for the MQTT binding.
You best or only (?) option may be to implement a rule to convert from your Wemo item (in seconds) to a Text item (the time string) and try to re-write the script in the rule language in some way.
rule "Squeezebox WC - convert seconds to mm:ss"
when
Item Squeezeplayer_EG_WC_duration received update
then
Squeezeplayer_EG_WC_duration_converted.postUpdate(Squeezeplayer_EG_WC_duration)
end
Any idea? I only get small second-amounts to my number item, only few minutes or maybe sometimes 1 hour, but never as long as a day. But i think the script has to work with mabe only 200 seconds as well?
Your script is named as mmss.js and it is inside transform-folder of openhab.
Javascript Transformation is installed. Other js-scripts work without any problem.