I gave that code a shot, it works great. I added this to the update method so I could get the right urls:
def updated() {
log.debug "away url: ${fullLocalApiServerUrl('away')}?access_token=${state.accessToken}"
log.debug "home url: ${fullLocalApiServerUrl('home')}?access_token=${state.accessToken}"
}
Here is what I get in the logs:
2018-03-15 16:12:33.795:debughome url: http://192.168.1.15/apps/api/776/home?access_token=2a16f329-7e13-4d62-b925-7682abdc7985
2018-03-15 16:12:33.790:debugaway url: http://192.168.1.15/apps/api/776/away?access_token=2a16f329-7e13-4d62-b925-7682abdc7985
here are the commands I used to invoke:
curl -X POST "http://192.168.1.15/apps/api/776/home?access_token=2a16f329-7e13-4d62-b925-7682abdc7985"
curl -X POST "http://192.168.1.15/apps/api/776/away?access_token=2a16f329-7e13-4d62-b925-7682abdc7985"
With the new version of the hub 1.0.3 (available today) you can also call it like this:
curl -H "Authorization: Bearer 2a16f329-7e13-4d62-b925-7682abdc7985" -X POST "http://192.168.1.15/apps/api/776/home"
curl -H "Authorization: Bearer 2a16f329-7e13-4d62-b925-7682abdc7985" -X POST "http://192.168.1.15/apps/api/776/away"