ALTUI : New Features Suggestions

ok , trying with http://forum.micasaverde.com/index.php/topic,33308.msg244983.html#msg244983

Very cool. Seems good to me so far for settings with up/down. I have an older unit and so I don’t do a lot of button pushing on it for fear it will break on me but cool temp up/down is good. Drop downs look great. Fantastic work.

Hi amg0,

it seems your implementation of api.getDeviceState works a bit different. On native UI7 it returns a Boolean false when the variable does not exists, yours seems to return a null. Can you align with Vera’s flavour?

Cheers Rene

[quote=“reneboer, post:23, topic:188330”]Hi amg0,

it seems your implementation of api.getDeviceState works a bit different. On native UI7 it returns a Boolean false when the variable does not exists, yours seems to return a null. Can you align with Vera’s flavour?

Cheers Rene[/quote]

I will. Just a question, how do they differentiate from a non existent variable and one truly containing false or “false”?

[quote=“amg0, post:24, topic:188330”][quote=“reneboer, post:23, topic:188330”]Hi amg0,

it seems your implementation of api.getDeviceState works a bit different. On native UI7 it returns a Boolean false when the variable does not exists, yours seems to return a null. Can you align with Vera’s flavour?

Cheers Rene[/quote]

I will. Just a question, how do they differentiate from a non existent variable and one truly containing false or “false”?[/quote]
Hi amg0,

Welcome back, hope your vacation was as good as mine :smiley:

It think variables that exist are always stored as a string so would return that. Looking at the Vera js code they do a return !1 on error.

Using this I get an empty string on UI7 but value ‘null’ in AltUI.

var res = api.getDeviceState(deviceID, sid, varID); if (res !== false) { return res; } else { return '';

Cheers Rene

Ok thx… Easy fix for me. Will do when I am back. ( still out:-) )

Envoy? de mon iPad en utilisant Tapatalk

EDIT: in V 0.67.646

not sure if possible, but would be nice to see when the last time a devices stats were updated, would help trouble shoot if device working or not

example is a temperature device, if it was last updated a month ago, it would show an issue

[quote=“amg0, post:19, topic:188330”][quote=“Aaron, post:18, topic:188330”]Virtual devices : Buttons for On/Off
PLEG devices : Buttons for Arm/Bypass
EVL3 devices: Buttons for ‘Arm Mode’
Thermostat devices : Buttons for temp change Up/Down & Fan modes - On/Auto/Cycle[/quote]

Anybody wants to do some of that ? it is not that hard to add a small display plugin into ALTUI and I can incorporate it in the distribution after.
otherwise, could you confirm the device type for EVL3 or virtual devices ?
regarding thermostat, maybe we have a pb of real estate , any idea / diagram on how it could look like ?
thx ![/quote]

device types…

EVL3 Panel
urn:schemas-micasaverde-com:device:EVL3VistaAlarmPanel:1

EVL Partition
urn:schemas-micasaverde-com:device:AlarmPartition:2

Virtual
urn:schemas-upnp-org:device:VSwitch:1

[quote=“JS007, post:27, topic:188330”]not sure if possible, but would be nice to see when the last time a devices stats were updated, would help trouble shoot if device working or not

example is a temperature device, if it was last updated a month ago, it would show an issue[/quote]

understood but does anybody know if there is a standard way to detect when a device receives an update ?
ALTUI does it on a variable using the history button ( cf screen shot ), but that is only for the changes that are currently recorded in the log( so you depend a bit on when the last log recycle happened ).
I am not aware of a globally available ‘lastupdate’ variable or something like that on a device although some do have one.

Although kind of crude, you could go to MISC/DEBUG and see the variable search command and put “LastUpdate” in it, at least this could show all devices that have a LastUpdate variable and the value of it.

I could display this lastupdate when it exists on the device control panel pages if that is the only & best way we have

that may work, I just looked and all the ones I checked had no dates in them, maybe it just rebooted, will try again later

The system itself obviously knows, because it uses that information when you do a HTTP id=user_data request with a DataVersion parameter, in order to give you only the devices which have changed since your last query. I looked for where it might be held when implementing openLuup, but could not find it anywhere so had to hide it away internally myself as well.

However, this suggests the approach of ALTUI simply keeping an internal table (one entry per device) with a timestamp of when it last received any variable information for that device from the user_data request.

The system itself obviously knows, because it uses that information when you do a HTTP id=user_data request with a DataVersion parameter, in order to give you only the devices which have changed since your last query. I looked for where it might be held when implementing openLuup, but could not find it anywhere so had to hide it away internally myself as well.

However, this suggests the approach of ALTUI simply keeping an internal table (one entry per device) with a timestamp of when it last received any variable information for that device from the user_data request.[/quote]

hummm, thinking about this, ALTUI does maintain a device table and has ALTUI specific info per devices ( like the altuiid of a device). but ALTUI is a client side web app, it is not persistent and not running all time like a deamon or a serve so I think it would not be a reliable way to know if a device got updated or not because you would loose all info when ALTUI is not running.

I do not see much alternatives other than some kind of heuristics on the VERA device level like looking at the “LastUpdate” variable or other things ( like spying the set variables in the logs … )

I never imagined a scenario where someone was NOT running ALTUI continuously :o

However, whilst it could be true that the client is not always running, the ALTUI plugin certainly is. So I’m wondering if the plugin itself could gather this information and pass it to the client? A loop-back call with [tt]luup.inet.wget[/tt] to 127.0.0.1 with a status request every minute or so, should not be too burdensome and can gather the data you need into a very compressed format for passing to the client.

I never imagined a scenario where someone was NOT running ALTUI continuously :o

However, whilst it could be true that the client is not always running, the ALTUI plugin certainly is. So I’m wondering if the plugin itself could gather this information and pass it to the client? A loop-back call with [tt]luup.inet.wget[/tt] to 127.0.0.1 with a status request every minute or so, should not be too burdensome and can gather the data you need into a very compressed format for passing to the client.[/quote]

Conceptually yes…
however that would either require to move the payload of the engine data request loop inside VERA instead of on the client side and it will start to make ALTUI a backend vera CPU consuming app which I still want to avoid at this point so I respect the prime directive : maximum use of the client side power and no extra server side load on vera box other that what UIx would do. Maybe in the future I do some laser focused variable_watch or things like that, also when VERA is a more powerful hardware; but I do not really wish to go in the direction of the server side engine polling for the short term.

Hopefully the fallback solutions would be ok for now for that particular need.

OK, understood. But I prototyped it anyway. Here a bit of code you can run (once) in Test Lua.

local json = require "dkjson"

local devs  = {}
local DataVersion = ''

function status_watcher ()
  luup.call_delay ("status_watcher", 60)
  local url = "http://127.0.0.1:3480/data_request?id=status&DataVersion=" .. DataVersion
  local ok, s = luup.inet.wget (url)
  local info, msg = json.decode (s)
  local now = os.time ()
  if info and info.devices then
    DataVersion = info.DataVersion
    for _,d in pairs (info.devices) do
      devs[tonumber(d.id) or ''] = now    -- update time
    end
  end
end

function status_server ()
  local i = {}
  for d in pairs(devs) do i[#i+1] = d end
  table.sort (i, function (a,b) return devs[a] < devs[b] end)
  local t = {}
  for j,d in ipairs (i) do
    local name = (luup.devices[d] or {}).description or '?'
    t[j] = ("%s [%d] %s"): format (os.date ("%Y-%m-%d %H:%M:%S",devs[d]), d, name)
  end
  return table.concat (t, '\n'), "text/plain"
end

luup.register_handler ("status_server", "devtime")

status_watcher ()
status_server ()

-----

And then issue the request (after a few minutes):

http://<VeraIP>:3480/data_request?id=lr_devtime

and get back a list (newest first)

2015-09-01 18:45:07 [46] RGBW White
2015-09-01 18:45:07 [42] RGBW Extra
2015-09-01 18:45:07 [64] RGB controller device
2015-09-01 18:45:07 [41] RGBW Master
2015-09-01 18:45:07 [45] RGBW Blue
2015-09-01 18:44:51 [5] Event Watcher
2015-09-01 18:42:51 [47] Data Yours for UI7
2015-09-01 18:42:51 [14] Rain - Rain
2015-09-01 18:42:51 [6] Netatmo
2015-09-01 18:42:51 [68] Guest - CO2
2015-09-01 18:42:51 [25] Indoor - Pressure
2015-09-01 18:42:51 [71] Indoor - Noise
2015-09-01 18:41:08 [43] RGBW Red
2015-09-01 18:41:08 [44] RGBW Green
2015-09-01 18:41:08 [49] Graph
2015-09-01 18:41:08 [51] Dash
2015-09-01 18:41:08 [33] Door Sensor
2015-09-01 18:41:08 [74] Arduino Node 1
2015-09-01 18:41:08 [75] Arduino Light 0 (1)
2015-09-01 18:41:08 [69] GardenRoom - CO2
2015-09-01 18:41:08 [50] Cache
2015-09-01 18:41:08 [73] Arduino Gateway
2015-09-01 18:41:08 [63] Watcher
2015-09-01 18:41:08 [72] Indoor - CO2
2015-09-01 18:41:08 [56] ALTUI
2015-09-01 18:41:08 [31] Outdoor - MaxTemp
2015-09-01 18:41:08 [29] Outdoor - MinTemp
2015-09-01 18:41:08 [76] Rain - SumRain24
2015-09-01 18:41:08 [8] Garage - Temperature
2015-09-01 18:41:08 [9] Studio - Humidity
2015-09-01 18:41:08 [10] Studio - Pressure
2015-09-01 18:41:08 [11] Studio - Temperature
2015-09-01 18:41:08 [7] Garage - Humidity
2015-09-01 18:41:08 [3] Edge MiniMote
2015-09-01 18:41:08 [4] TKB Switch
2015-09-01 18:41:08 [2] _Scene Controller
2015-09-01 18:41:08 [30] Outdoor - DewPoint
2015-09-01 18:41:08 [12] Studio - Noise
2015-09-01 18:41:08 [15] Guest - Humidity
2015-09-01 18:41:08 [21] GardenRoom - Temperature
2015-09-01 18:41:08 [23] Indoor - Humidity
2015-09-01 18:41:08 [24] Indoor - Temperature
2015-09-01 18:41:08 [13] Studio - CO2
2015-09-01 18:41:08 [20] GardenRoom - Humidity
2015-09-01 18:41:08 [18] Outdoor - Humidity
2015-09-01 18:41:08 [19] Outdoor - Temperature
2015-09-01 18:41:08 [16] Guest - Temperature
2015-09-01 18:41:08 [1] ZWave

Save it for later, perhaps!

PS: or maybe @JS007 can use it anyway!

thanks, that worked easy enough

all my devices show updates in the last minute or so, now I just need a device to stop updating, will take a battery out of a device and wait 10 min see what results are

edit : the door device I took the battery out of still shows updating even with no battery in it

[quote=“JS007, post:36, topic:188330”]thanks, that worked easy enough

all my devices show updates in the last minute or so, now I just need a device to stop updating, will take a battery out of a device and wait 10 min see what results are

edit : the door device I took the battery out of still shows updating even with no battery in it[/quote]

see V 0.67.646, I show a couple of variable in device control panel page ( if they exists ). it could help but not garanteed to work for 100% of devices.

Hi,

When you run code on the vera you can get the last changed value from the standard luup.variable_get. That returns the value and last update timestamp. I did read that the timestamp is updated each time the variable is written, even with the same value so it may not be 100% accurate at all times.

But this is not ALTUI related what so ever, so may not help you.

Cheers Rene

Hi,

Keep up the good Work.

It would be cool if the web page had the posiblity to be fullscreen on Ios devices

I have used these meta in top of some of my websites:

regards Jens

[quote=“dalhoj, post:39, topic:188330”]Hi,

Keep up the good Work.

It would be cool if the web page had the posiblity to be fullscreen on Ios devices

I have used these meta in top of some of my websites:

regards Jens[/quote]
i did not know that was possible. its cool, it is in the next version. it seems that it only works when the user first save the page as an icon on its home page, and then ipad opens it in full screen mode. do you confirm that is the expected behavior ?