Smartly with google calendar events

Is there a way to have google calendar events on the dashboard similar to Dakboard or sharptools?

3 Likes

Since smartly is mainly HE based, not cloud based. The answer is no, but yes?

VERY Rough (I did it just for you!) For some reason the Agenda view gives me an error ATM.


HOW TO:

First you need a iFrame URL for the google calendar. Navigate to you calendar and click into the settings sections. In there look for the calendar you want to add and click the down arrow to show more details, find and click Integrate calendar then the ‘Customize’ button.

In the customize section make any adjustments you want and then copy the iFrame URL at the top (where it says Embed code)

Stick with me your almost there!! Next you need a iframe driver. I found one here by @doug since I’ve ‘modified’ (change display names to iFrame) it please use the one listed below.

preferences {
        input("src", "text", title: "iFrame Url",  required: true)
    }
metadata {
    definition (name: "iFrame", namespace: "srp", author: "srp") {
        capability "Switch"
        attribute "myFrame", "text"
    }
}
def on() {
    sendEvent(name: "switch", value: "on")
    sendEvent(name: "myFrame", value: "<div style='height: 100%; width: 100%'><iframe src='${src}' style='height: 100%; width:100%; border: none;'></iframe><div>")
}
def off() {
    sendEvent(name: "switch", value: "off")
}
def installed() {
    on()
}

After coping that code to your “Driver Code” section of HE you can now create a Virtual switch that will be your “device” from the dashboard. The settings should look like this.

Before pasting be sure to remove the (thanks @Navat604 for the assist :raised_hands: )

<iframe src="       and         scrolling="no"></iframe> 

from the beginning and end of the iFrame URL, then paste it into your virtual switch make sure you toggle the switch off/on. After doing so you should see your calendar in the device page.

Go to your dashboard and add the device as an attribute tile.

All done!! sorta :wink: In order to update the calendar be sure to setup a rule to turn the switch off/on. My guess it that is the only way to update the calendar (might happen on refresh too, try it and LMK).

If I have any mistake here, please excuse me. I do not use this function and just set it up, so I could post this. Please post corrections if needed and I’ll happily update.

Enjoy!

5 Likes

Very nice. Thanks for your help. It works beautifully.
One minor adjustment for me is to also remove scrolling=“no” as well otherwise I will get Error 500 message.

1 Like

Thank you!! I will add that, I couldn’t figure out where the 500 error was coming from.

Also stay tuned we are working on improving the iFrame support in smartly to make it awesome!

If anyone has iFrame related improvement requests, feel free to add them here until I get an ‘official’ thread up

1 Like

Perhaps one nice option would be some kind of config interface to easily embed Grafana dashboards inside a tile. Not sure how much could be in Smartly, but just a thought. I have made some relatively good notes on my own setup on the HE Community, but a purpose built solution for the embedding with different display options would be nice.

There are some other relatively common things that people like to embed, such as weather and alike, but there are also some fairly mature options for some of those…

This is probably stepping outside your iFrame enhancement, but I have often thought it would be nice to see some representation of forums such as the HE Community and, of course, the Oh-La LABS Community, in a dashboard. It might just be the top 4-5 posts, or simply the users avatar with the indication of any messages or notifications. From what I have researched myself, there is an embed option in the Discourse admin side of things, which would lend itself to an iFrame, but you can also get the raw JSON by simply calling the page itself, you just need to do all the formatting to present it. This last option would also allow for combining posts / status info from multiple forums.

Just a few ideas…

1 Like

Tried this today and i get the error 500 . I deleted what you guys mentioned and still get the error?

I do not use this normally, but I just fussed with it for a bit and I’m getting the same error unless I make the calendar public. Not a suggestion just troubleshooting. Maybe a permission issue since the hub is not authenticated?

@Navat604 are you having issues with your as well?