New device type support?

Hi,

I’m testing this: [PROJECT] Google Photos integration for dashboard image slide-show - Custom Apps - Hubitat

…and now I’m in a part where I’m trying to add new tile to my SharpTools dashboard but I can’t.
Device type is: Google Photos Device

It seems that it can’t be chosen from any Sharptools device category so I’m thinking that this device type is probably not yet supported. Would it be big job to add? I’m suggesting that if this would work and users would be able to add image attribute tiles to SharpTools …then this feature request would not be needed anymore… Google Photos integration - #2 by JiiPee

Take a look at the Hubitat HTML Attribute Display custom tile.

1 Like

Do I understand this right. Device (Google photo) in hubitat with image attribute does not need to be find from hubitat’s device list at all?

The Hubitat HTML Attribute Display custom tile talks directly to Hubitat using the maker API, so you authorize it there.

The setup section in the linked thread has more details.

1 Like

Ok I managed to get it work…but not all the way.

This part:

  • Attribute - enter the name of the attribute that is stuffed with html

Should I just enter “image” as it is attribute I’m using? Now I get a photo which is not refreshing when photo in Google Photo Device changes. I need to refresh whole dashboard to get a photos that is shuffled.

EDIT: and just to be clear. If attribute should include html …where do I find it since I do not have a device to add as hero attribute?

From a quick glance at the driver, the image attribute seems like the right one.

Unlike the normal SharpTools tiles, the custom tile uses polling to get the updated states. Since the original use case for that tile was rendering custom weather layouts, the polling was set to every hour. I’m on dad duty this glorious Saturday (watching the kids), but when I’m back in the office I can add a refresh rate option to the tile.

In the meantime, as a quick fix you could change the tile to poll more frequently by updating the REFRESH_INTERVAL on line 47 in the custom tile:

:warning: Since this is polling the Hubitat servers, I would recommend not going any faster than every 5 minutes to be respectful of their resources.That would be:

var REFRESH_INTERVAL = 5 * 60 * 1000;

I just find this too and managed to change interval but …that 5min polling…that is way too much if point is to shuffle photos in screen. But I do understand that this would be wrong if it causes possible issues in Hubitat side. Damn…
Stupid question by the way. 5 x 60 x 1000 is 5 minutes in milliseconds. Why does it need to be marked like that x … x …

JavaScript intervals are in milliseconds. Instead of writing 300000 which isn’t intuitive for me to read, I tend to write it out as the components:

5   *   60   *   1000
^       ^        ^
Minutes Seconds  Millis
1 Like

Thanks Josh and good luck with the kids :slight_smile: Its evening here where I live and kids are soon sleeping. :sweat_smile:

1 Like

One more thing. I noticed that Google Photo App has two attributes: image and video. Is it possible to add second attribute “video” to custom tile and would it then be possible to play video in dashboard tile?

Would probably be a better question for the developer of the custom driver. :slight_smile:

The driver seems to get either an image *or* a video though, so it’s not completely clear to me why there would be a separate attribute as each call to get the next ‘photo’ could end up getting a photo or a video. That being said, I haven’t actually used this driver – just basing this off a quick read-through of their code.

Sorry I do not understand. If custom driver (Google photos app) offers two variables to use isn’t it completely Sharptools custom tile question? Variable changes from image to video depending if it is a image or video which is shuffled from album. Both video and image works when playing on Hubitat or hubitat’s own dashboard.

Now I’m adding one attribute (image) to sharptools custom tile settings:
image

My question was supposed to mean that…is there a way to add another attribute to sharptools custom tile settings and would that allow me to play videos too in custom tile.

Something like this:

image

Edit: and just wanted to add… that “i do not understand” means that I probably really do not understand English as well as I should and technical stuff like coding …way over my head…

Thanks for the clarification. I think we are getting closer to understanding each other. :smiley:

I believe we are both addressing a similar issue, but from different perspectives.

:warning: Edit: See discussion further down in the thread. Turns out there’s not a separate attribute.

Yes, since there is a separate attribute for video, you could certainly use it in a second tile. From what I understand though, you’re noticing the same thing as me that either the image attribute *or* the video attribute get updated when the ‘next photo’ is refreshed (but both retain their last value).

The ‘Hubitat HTML Attribute Display’ custom tile is intended to display HTML content from a *single* attribute…

My question is why is there not a *single* attribute in the device which displays the latest media resource (image or video). I see this as something that should be done in the driver – either replacing the video and image attribute with a single attribute, or adding an additional attribute that combines them (eg. maybe 'imageOrVideo' or 'media' or 'latestMedia' or something along those lines).

With Custom Tiles in SharpTools, you can theoretically code whatever you want. The Hubitat HTML Attribute Display tile is a general use tile intended for displaying HTML content from a single attribute. Someone with the right skills could modify the code and adapt for this driver-specific use case – for example, use the mediaType attribute to decide if you should display the image or video attribute… but that’s a very specific use case.

Hence my recommendation to keep driver-specific logic within the driver and make the request to the original driver author. :smiley:

1 Like

Thanks Josh! I think I now understand what you are saying here :slight_smile:

Actually just found this from hubitat community:

  • new attribute “mediaType” – values: photo or video
  • “image” attribute uses html <video> tag if the mediaType is video – will autoplay and loop in Hubitat Dashboard until the next image is loaded.

I’m not really sure should that “mediaType” attribute fix issue that I have. I tried mediaType but can’t get videos or images out anymore. Tile does not show anything. Image attribute still works.

Can you share a screenshot of the device details screen?

My apologies as I thought you were saying there were two separate attributes – one attribute called 'image' and one called 'video'. If I understand correctly, there’s actually just the one attribute called 'image' and it either contains an <img> or <video> tag depending on the content (and the mediaType attribute is updated accordingly).

Are you saying that when the ‘device’ is displaying a video, that it plays in the Hubitat dashboard, but doesn’t play in the custom tile?

yeah so I thought that it has video and image attributes but that is not the case. Pardon me.
If I got it right it has image and mediaType attributes. Image shows photos but videos do not play.

That’s why there is mediaType attribute which should tag video tag to image attribute so that autoplay would work. My tile shows photos and stillshot of video.

I installed the driver and videos played fine for me with the ‘Hubitat HTML Attribute Display’ custom tile linked above.

There were some quirks from that custom tile consider its original intended use-case of displaying custom weather tiles:

  • The photos were restricted to 80% width
  • The videos were unconstrained, so they were massive

I’ve created a custom tile that works specifically with this dkilgore90 Google Photos device type. You can import it using the following button:

image

It adds some additional features compared to the basic ‘Hubitat HTML Attribute Display’ custom tile:

  • Images and videos fill the full width of the tile
  • You can customize the scaling to either:
    • contain - scale the image down to fit
    • cover - scale the image to fit while also filling the space
    • fill - stretch the image to fit the space (distorts image)
  • Refresh Rate is exposed as an optional configuration setting
    • Ideally you would want to roughly match your Google Photos Refresh rate. (eg. set them both to 5 minutes or 60 minutes or whatever works best for you)
  • You can tap the tile to send the next() command
    • Since we have to poll for status update, the tile waits 1.5 seconds after successfully sending the command to try to get the new state
  • It’s not required to enter a Device ID.
    • The tile will try to find a device with the type ‘Google Photos Device’ which matches the device type dkilgore90 created
  • It’s not required to enter the attribute name as we always want the image attribute

That being said, if the videos weren’t working for you before, it wouldn’t surprise me if they don’t work with this version either since I didn’t change anything related to that. :wink:

Demo

https://imgur.com/YEQgvJG

1 Like

Well first of all. Big thanks once again @josh . Those additional settings are great and now that I set it as “cover” it looks way better than before. I’m not sure what you did here but videos started working. Like you said this shouldn’t affect the issue that I had but for some reason all videos are now working.
Really cool and I appreciate all you help and work!!! Mad respects!!!
My “google photos” feature requests is not needed anymore with this setup. :slight_smile:

1 Like

and… love this ability to change photos by tapping. Absolutely love it! :muscle:

2 Likes

Sometimes I get a blue error message in upper part of tile saying:

cannot read property attribute: “undefined”

Any idea is that Sharptools related or should I ask from the app side?