Pass value from custom smartapp to webcore


#1

whats a clean way of doing this?

thanks!


#2

I don’t know how to use it but @ady624 wrote a connector that might be what you need.


#3

@eibyer thank you, this is great!

@ady624 this does not seem to execute the piston …

webCoRE_execute('ID from dashboard piston URL', [name: variableName, value: variableValue, unit: variableUnit])

i do have webCoRE_init() call in my initialize() method.

thank you.


#4

@eibyer this is not working yet, but i am sure it will since housepanel is using it … so probably something i am doing wrong.

but, you really saved me a bunch of time … i was literally working in another window on hacking up location events to webcore to get similar results since this morning. :slight_smile:

thanks a bunch! :smile:


#5

You’re welcome… Adrian made it easier for devs to integrate with WC for sure!


#6

Make sure the id starts and ends with :


#7

yes, tried both ways … webcore_list() does not seem to be returning anything …

EDIT: so this prints null

log.debug "webcore list: ${webCoRE_list()}"

8:53:58 PM: debug webcore list: null


#8

the event subscription shows up, but doesnt seem to be receiving any events … though the rest of my subscriptions are working fine

thanks.


#9

sending a location event does execute the piston, so a step forward:

sendLocationEvent([name:'ID from dashboard piston URL', value:app.label, isStateChange:true, displayed:true, data:[:]])


#10

Whatever you put into data should be available to the piston via $args…


#11

yep, it is. passing in variables from the smartapp for the piston to save values in global variables which then get used by various other pistons for various tasks or displaying to tiles.

a secondary benefit, dont need to go editing pistons everytime i needed to adjust a handful of variables.

next steps:

  1. look at the structure of the variable event to see if webcore can set the variable for me without even using a piston
  2. find a low overhead way to send variable values from piston to smartapp

thanks.


#12

seems like this should be the event that updates global variables but publishing one of these does not seem to update the variable, so need to dig more as time permits.

sendLocationEvent([name: handle(), value: $variableName, isStateChange: true, displayed: false, linkText: '${handle()} global variable $variableName changed', descriptionText: '${handle()} global variable $variableName changed', data: [id: $pistonID, name: handle(), event: 'variable', variable: [name:${handle()}, oldValue:$variableOldValue, value:$variableValue, type:$variableType]]])


#13

@ady624 this used to work, but since the last update this does not seem to be working any more. now put a log statement in there to check if the piston is even getting executed.

thanks!


#14

so, its working for some of the piston executions but not for every call to execute the piston. will look some more as time permits.

thanks!