Trying to display some counter values from a PLEG action in a push message out of VeraAlerts.
This one works for a Time counter:
Aircon Total Time - {String.format(%4.2f, {((xAircon_RunTime)/3600)} )} Hours
Have failed totally to get an increment counter to display at all. Tried a few variations
Aircon Starts - {String.format(%2.0f,{(xAircon_Starts)})}
Aircon Starts - {(xAircon_Starts)}
None work… probably missing something obvious. Anyone able to point me in the right direction?
I am trying to do something similar - take 3 counter values and place them in 3 containers using the Multistring device.
From what I can see, I probably need a LUA statement to get the data from the counter, manipulate it (converts seconds to hours), and then place that result in the container. The other 2 are more simple - take the integer and place it in the container.
From what I have seen, the LUA will be something like this:
local Blower = luup.variable_get(THE PLEG COUNTER)
Blowerhr = blower/3600
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”, “Variable1”,blowerhr, 198)
Without studying the LUA bible here: Programming in Lua (first edition), I am trying to find some posted examples and so far this is where I am.
The solution that worked for me was actually:
Aircon Starts - {(xAircon_Starts)}
Which was something that I originally tried, but forgot to reload the luup engine before testing. :-[
+1 Works great for the raw number.
{(xBlower_Time/3600)} gives me hours.
Reading up on LUA, I cannot find how to round this “67.791349708236” to “68”.