I figured out a way to find all the keys for the 'event' object

120 views
Skip to first unread message

Peter VanDerWal

unread,
Oct 23, 2023, 3:43:03 AM10/23/23
to Routix
The keys change depending on the type of tile and which handler you are in, so rather than posting all the different combination of keys,  I figure I'll just post the code

First create the desired type of tile, it doesn't need any data (no nme, no subscription, etc)
Then in either the 'ON RECEIVE' or 'ON DISPLAY' handler put the following:

if (!event.data){ event.data = {}; }
event.data['keys'] = Object.keys(event);

then in the 'ON TAP' handler put the following:

event.preventDefault = true;
app.publish('event/keys', event.data['keys], false, 0);

Then on your server, etc subscribe to the topic 'event/keys'
(for example mosquitto_sub -v -t event/# )

Finally tap on the tile in MQTT Dash and it will publish all the keys

For example when looking at "ON DISPLAY" in a RANGE/Progress tile I get:

event/keys setName,getClass,wait,getName,data,activity,notifyAll,setProgress,blink,setProgressColor,getProgress,notify,setLastActivityString,getBlink,getLastActivityString,lastActivityString,hashCode,tile,setBlink,text,class,getData,getTile,getLastPayload,getProgressColor,getActivity,setData,getText,lastPayload,progressColor,metric,equals,name,progress,getSecondsSinceLastActivity,toString,getMetric,setText,secondsSinceLastActivity

Hope this helps a few of you out there.
Reply all
Reply to author
Forward
0 new messages