Dashboard tile - attribute actionable

Is there a way to make a custom attribute from a device actionable in the dashboard?

I would like my Roomba device tile I created in Roomba Scheduler to start/dock if clicked.

Looking for coding guidance.

Not so much coding, but there may be a roundabout way here?

In theory, it should be similar. Maybe add a link using Maker API as the overlaying tile?

Looking how to incorporate this into my app’s driver for all users.

@chuck.schwer @patrick any suggestions?

Ah no poblem.

1 Like

Attributes are states; they aren't actionable (on a Dashboard or elsewhere). What you can do (from a Dashboard or anywhere) is run a command. However, Dashboard doesn't support custom commands, so you'll have to use one of the commands the built-in Dashboard templates expose. The most logical of these to me would be the button template. To do this, you'll have to implement the PushableButton capability in your driver, then you can suggest users create a Dashboard tile using the Button template. If your device "exposes" only one button, it will be button 1 and you can tell users to fill in "1" when the button template asks what button number (pressing the Dashboard tile will generate a pushed event in your PushableButton driver for the button number specified in the Dashboard).

That is, of course, not the only option; you could use the Switch capability or someting else instead, then the user could just flick the switch on on the Dashboard, and your driver could interpret that as whatever you want. However, this might be confusing unless it's either clear to your users that it's either effectively a momentary switch (and will automatically turn off in a short time) or if you have a way to really monitor the status of whatever that switch does and turn it "off" whenever it's finished (when the Roomba stops vacuuming?) and provide a way for the user to manually do the same if they turn it off.

There is a way to get this to happen. I've done this for switches with an attribute. What you need to do is first create the attribute tile. Then you create the switch tile and put it directly over the attribute tile. Now, you will have to go in and modify the default colors for the switch template allowing for a large percentage of transparency to be able to see the attribute tile when the switch is on, but I do this for a few different devices.

By the way...the device created first will always be on the bottom....even if it is moved into position 2nd. That's just how the dashboard sorts them.

2 Likes

This is a great idea where the user could accomplish an on/off but nothing I could automagically create for them. I have been inspecting the html of a dashboard with a virtual switch and haven't reversed engineered how HE dashboards trigger the state to on/off yet. If I could figure that out I could then dynamically code this into the html string I am sending through the attribute.

@aaron Sorry, I don't have any suggestions for you. Hopefully someone can come up with an idea that works.

The dashboard sends a POST request to the app, like this:

POST: http://192.168.10.169/apps/api/227/dashboard/524/command
BODY: {"id":1482,"cmd":"on","secondary":""}

With no token or security at all?!?!? How can that be??

No, there is more in the header... The usual authentication bearer is in there

Ok....thanks for the quick reply. The WTF meter was raising fast but jets are now cooled. :slight_smile:

@dan.t

My hopes were high and then dashed.

Is there a way to post the event or do we need the security tokens?

I am not sure that you will be able to just inject something to make it all of the sudden work. The dashboard uses a quite complex javascript to handle all of this (app.js). In there is a method called "sendCommand" that builds the request with the appropriate headers etc. I don't have a good idea for you on how to inject something to the dashboard that could utilize that method, but I have to admit, I only looked for about 5 minutes.....

1 Like

FTFY

2 Likes