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!


#15

Sorry to revive this topic but this is the closest I could find to what I am trying to achieve. I am trying to create a smart sprinkler and have found a smartapp that does the scheduling (which I thinned down) and created a piston to control my separate zones but want to pass a integer for the time to run each zone.

I have tried looking through this thread and others but am not quite versed enough to complete what I want to doā€¦Can anyone tell me what I need to put into my smartapp and/or piston to transfer a value from the smartapp to the piston? Or is there a step by step guide anywhere?

I want to pass five separate integers from my smartapp to the piston. Such as:
zone1 = 10
zone2 = 18
zone3 = 25
ā€¦

Hopefully that makes sense, if anyone can help that would be great!


#16

If your smart app can make webcall, you can call the pistonā€™s external url and pass the zone info you want in the formatā€¦

http://pistonurl/?zone1=10&zone2=18 (and so on)

In your piston, you can access those passed values as

$args.zone1, $args.zone2 etc..


#17

I honestly have no idea about webcall. I will look into that more or if you know where I can find out more about it I would appreciate it. The other lines are exactly what I was looking for. Now to try and make it work. Thank you!


#18

if it helpsā€¦here is the smartapp so far.

definition(
name: ā€œSmart Sprinkler Timerā€,
namespace: ā€œbryulyā€,
author: ā€œbryulyā€,
description: ā€œSmartApp to create schedules for Smart Sprinkler in WebCoreā€,
version: ā€œ1.0.0ā€,
iconUrl: ā€œhttps://s3.amazonaws.com/smartapp-icons/Meta/water_moisture.pngā€,
iconX2Url: ā€œhttps://s3.amazonaws.com/smartapp-icons/Meta/[email protected]ā€
)

preferences {

page(name: "sprinklerPage", title: "Sprinkler Controller Setup", nextPage: "schedulePage", uninstall: true) {

    section("Zone Times...") {
        input "zone1", "string", title: "Zone 1 Time", description: "minutes", multiple: false, required: false
        input "zone2", "string", title: "Zone 2 Time", description: "minutes", multiple: false, required: false
        input "zone3", "string", title: "Zone 3 Time", description: "minutes", multiple: false, required: false
        input "zone4", "string", title: "Zone 4 Time", description: "minutes", multiple: false, required: false
        input "zone5", "string", title: "Zone 5 Time", description: "minutes", multiple: false, required: false
        input "zone6", "string", title: "Zone 6 Time", description: "minutes", multiple: false, required: false
        input "zone7", "string", title: "Zone 7 Time", description: "minutes", multiple: false, required: false
        input "zone8", "string", title: "Zone 8 Time", description: "minutes", multiple: false, required: false
     
    }

}
page(name: "schedulePage", title: "Create An Irrigation Schedule",  install: true) { 
    
    section("Minimum interval between waterings...") {
        input "days", "number", title: "Days:", description: "minimum # days between watering", defaultValue: "1", required: false
    }

    section("Start watering at what time...") {
        input name: "waterTimeOne",  type: "time", required: true, title: "Turn them on at:"
    
    }
}

}

// Scheduling
def scheduling() {
schedule(waterTimeOne, ā€œwaterTimeOneStartā€)

}

def waterTimeOneStart() {
state.currentTimerIx = 0
scheduleCheck()
}

def anyZoneTimes() {
return zone1 || zone2 || zone3 || zone4 || zone5 || zone6 || zone7 || zone8
}


#19

Have you considered doing it all in webCoRE?


#20

I have done it all in webcore for now. Still working through some of it, as it seems my piston might have an issue somewhere in the logic. I really just donā€™t like having to sign into webcore on my phone or a computer and then edit all of the time variables. It is much easier (in my opinion) to edit in the smart app interface through smartthings. I currently like webcore for all of the ā€œbackgroundā€ effort that doesnā€™t have to be modified with any regularity.

Have to edit my postā€¦something about limiting new users to only 3 replies in the same topic.

@eibyer,
I have been looking into the URL optionā€¦seems like there is a lot to go through and my programming is limited. I will see what I can do. As for the pistonURL how do you find that?