Ah gotcha, I wasn’t sure I can stuff all that information in there. Something I have not tried before.
I am trying to set up this fast switching but cannot get the new dashboard. /dashboard/view/xxxx to change on the tablet.
My Rule: javascript:postMessage({action:‘navigate’, route: { path: ‘dashboard/view/xxxxx’}}) (x=the new dashboard to display)
Currently, I am entering the “JavaScript post message Josh referenced in a sharptools rule using a virtual device and the custom FKB DTH with the loadURL command to change my home dashboard to another sharptools dashboard quickly, but no go. I can send other commands such as loadstarturl via sharptools rule but for the life of me, I can’t find where the error is. I can send a rule for the full sharptools url but slow, hence the fast switching.
On the tablet, I have the remote access active.
Any ideas why the new dashboard doesn’t load?
Can you share a screenshot of your rule so we can better understand how it’s configured?
Your example seems to be missing the leading slash on the path. And it might just be the community software formatting the message, but the quotes probably need to be straight quotes rather than curved.
- Straight:
'
- Curved:
’
I had to removed the image.
Try fixing the leading slash on the path and see if that helps:
javascript:postMessage({action:'navigate', route: { path: 'dashboard/view/xxxxx'}})
…should be…
javascript:postMessage({action:'navigate', route: { path: '/dashboard/view/xxxxx'}})
^
Note the leading slash
That was a no go unfortunately, though the screen sort of dims briefly as if the page is trying to load but it does not change.
Here’s my earlier screenshot.
Have you encoded the argument as @josh mentioned earlier in this thread? The url argument is sent to Fully’s API on your tablet as URL query parameter, so it needs to be encoded.
I did not encode the URL. I encoded and the compiled text URL takes me to the FKB web admin page not the sharptools dashboard.
My code truncated: 192.168.0.22:2323/?cmd=loadUrl&url=%20javascript%3ApostMessage%28%7Baction%3A%27navigate%27%2C%20route%3A%20%7Bpath%3A%20%27%2Fdashboard%2Fview%XXXXXXXXXXXXXXXXXX%27%7D%7D%29%20javascript%3ApostMessage%28%7Baction%3A%27navigate%27%2C%20route%3A%20%7Bpath%3A%20%27%2Fdashboard%2Fview%2Fs1vtXJkBW1OwPfHm9qNP%27%7D%7D%29&password=XXXX
@Michelle_Patterson, sorry if I confused you. You only need the following part to be encoded and filled in the argument field.
From this:
javascript:postMessage({action:‘navigate’, route: { path: ‘/dashboard/view/xHF4pBuWWBQFYu8h3nOc’}})
To this:
javascript%3ApostMessage%28%7Baction%3A%27navigate%27%2C%20route%3A%20%7B%20path%3A%20%27%2Fdashboard%2Fview%2FxHF4pBuWWBQFYu8h3nOc%27%7D%7D%29
You don’t need the FKB’s ip and cmd like below, The loadURL
command from the device handler will do this for you, and attach the filled argument as url
query parameter in the request to FKB.
Thank you so much, that resolved my issue.
I tried using this encoding in webcore but it didn’t work as listed above. Anyone know the correct formatting to send this URL via the custom FKB device handler?
Did it work somewhere else, but not WebCoRE?
Is this on Hubitat or SmartThings? I don’t recall needing the encoding when using the driver on Hubitat. I only needed it when manually calling the Fully Kiosk Browser API directly.
You guys are so fast to reply, I love it. I found an error in my piston and the same encoded url works. Thanks
Having a hard time with this… Triggering from Hubitat Rules…
dev:1762021-03-23 14:42:24.629 debug[sendCommandCallback] response.data: {"statustext":"Loading URL javascript:postMessage({action:‘navigate’, route: { path: ‘/dashboard/view/xxxxx’}}) ...","status":"OK"}
dev:1762021-03-23 14:42:24.625 debug[sendCommandCallback] response.data: {"statustext":"Screensaver stopped","status":"OK"}
dev:1762021-03-23 14:42:24.622 trace[sendCommandCallback] response.status: 200
dev:1762021-03-23 14:42:24.618 trace[sendCommandCallback] response.status: 200
dev:1762021-03-23 14:42:22.605 debug[sendCommandPost] [uri:http://192.168.1.76:2323/?type=json&password=yyyyy&cmd=loadURL&url=javascript%3ApostMessage%28%7Baction%3A%E2%80%98navigate%E2%80%99%2C+route%3A+%7B+path%3A+%E2%80%98%2Fdashboard%2Fview%2Fxxxxx%E2%80%99%7D%7D%29, requestContentType:application/json, contentType:application/json]
dev:1762021-03-23 14:42:22.601 trace[sendCommandPost] cmdDetails:cmd=loadURL&url=javascript%3ApostMessage%28%7Baction%3A%E2%80%98navigate%E2%80%99%2C+route%3A+%7B+path%3A+%E2%80%98%2Fdashboard%2Fview%2Fxxxxx%E2%80%99%7D%7D%29
dev:1762021-03-23 14:42:22.598 trace[loadURL] url:javascript:postMessage({action:‘navigate’, route: { path: ‘/dashboard/view/xxxxx’}})
dev:1762021-03-23 14:42:22.589 debug[sendCommandPost] [uri:http://192.168.1.76:2323/?type=json&password=yyyyy&cmd=stopScreensaver, requestContentType:application/json, contentType:application/json]
dev:1762021-03-23 14:42:22.586 trace[sendCommandPost] cmdDetails:cmd=stopScreensaver
dev:1762021-03-23 14:42:22.582 trace[stopScreensaver]
It says Status ok, but it doesn’t do the navigation. It’s on my main Sharptools dashboard running in FKB, and I turn off the screensaver before, so I’m not sure the problem…
I’m away from a device to test with at the moment, but I would double check the quotes. They look like curly quotes ‘’
rather than straight quotes ''
.
Yup, you got it! Thanks!
i have tried to use this fast postMessage methode in a rule using the fkb loadURL command, but nothing happens; however, it works fine (but slowly) when using the command with just the url; any idea what i am doing wrong? do i need to first install any javascript or postMessage stuff?
@Claus_Hansen, can you post the javascript postMessaeg
link you tried? My quick guess is if it was not url encoded as described in the earlier post.
thanks, had not understood the encoding part, now it works