{"id":52,"date":"2021-03-14T21:49:01","date_gmt":"2021-03-14T21:49:01","guid":{"rendered":"https:\/\/www.roblsmith.co.uk\/blog\/?p=52"},"modified":"2022-06-20T14:27:20","modified_gmt":"2022-06-20T14:27:20","slug":"hey-alexa-what-bin-do-i-need-to-take-out-building-an-alexa-skill-with-data-from-mbrocouncil","status":"publish","type":"post","link":"https:\/\/roblsmith.co.uk\/blog\/2021\/03\/hey-alexa-what-bin-do-i-need-to-take-out-building-an-alexa-skill-with-data-from-mbrocouncil\/","title":{"rendered":"&#8220;Hey Alexa, what bin do I need to take out?&#8221; &#8211; building an Alexa skill with data from @MbroCouncil"},"content":{"rendered":"<p>I don&#8217;t know about you, but I can never remember which bin I need to take out.<\/p>\n<p>Is it the blue one? Have the green ones resumed? Anyone else stuck theirs out yet? Who knows&#8230;.<\/p>\n<p>Now, I could print off a calendar, but what&#8217;s a printer? Even then the printer I have is an old mono-chrome laser printer made in the mid 1990s&#8230; So, not particularly good when it comes to the coloured boxes. <em>And yes, surprisingly, it still works, just.\u00a0<\/em><\/p>\n<p>Now Middlesbrough Council don&#8217;t provide any sort of API to pull data from, which would have made this 10x easier. <a href=\"https:\/\/data.yorkopendata.org\/dataset\/waste-collection-lookup\/resource\/18e9eaaf-3fac-41cb-b43f-9ff815956600\">Unlike York<\/a>.<\/p>\n<p>A while back I tweeted about this<\/p>\n<blockquote class=\"twitter-tweet\">\n<p dir=\"ltr\" lang=\"en\">Sick of remembering which bin I need to take out. Given the lack of API by <a href=\"https:\/\/twitter.com\/MbroCouncil?ref_src=twsrc%5Etfw\">@MbroCouncil<\/a>, I&#8217;ll just write my own <a href=\"https:\/\/t.co\/wVAyVWG8AK\">pic.twitter.com\/wVAyVWG8AK<\/a><\/p>\n<p>\u2014 Rob McLaren-Smith (@robsmithy1) <a href=\"https:\/\/twitter.com\/robsmithy1\/status\/1329931780321923074?ref_src=twsrc%5Etfw\">November 20, 2020<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<p>So did (at the end of last year)&#8230;<\/p>\n<p>The only thing they have as a data source is a PDF download, or an ICAL formatted calendar. They do also have a form which shows the next 5 collections, but I couldn&#8217;t work out the calls to make &#8211; or how to create the initial session. Plan B it was.<\/p>\n<p>So using their ICAL, I was able to scrape the data based on which calendar area you passed through.<\/p>\n<p>I did end up making an improvement on my MK-I website too, which works OKish, it&#8217;s just a tad janky on mobile sometimes. But hey, I&#8217;m predominately a backend coder.<\/p>\n<figure id=\"attachment_56\" aria-describedby=\"caption-attachment-56\" style=\"width: 1908px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" class=\"wp-image-56 size-full\" src=\"http:\/\/www.roblsmith.co.uk\/blog\/wp-content\/uploads\/2021\/03\/mbcbins.png\" alt=\"\" width=\"1908\" height=\"847\" srcset=\"https:\/\/roblsmith.co.uk\/blog\/wp-content\/uploads\/2021\/03\/mbcbins.png 1908w, https:\/\/roblsmith.co.uk\/blog\/wp-content\/uploads\/2021\/03\/mbcbins-300x133.png 300w, https:\/\/roblsmith.co.uk\/blog\/wp-content\/uploads\/2021\/03\/mbcbins-1024x455.png 1024w, https:\/\/roblsmith.co.uk\/blog\/wp-content\/uploads\/2021\/03\/mbcbins-151x67.png 151w, https:\/\/roblsmith.co.uk\/blog\/wp-content\/uploads\/2021\/03\/mbcbins-768x341.png 768w, https:\/\/roblsmith.co.uk\/blog\/wp-content\/uploads\/2021\/03\/mbcbins-1536x682.png 1536w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption id=\"caption-attachment-56\" class=\"wp-caption-text\">Next bin collection on my website<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>So the next logical step had to be creating an Alexa Skill&#8230;<\/p>\n<p><em><span style=\"color: #808080;\">Don&#8217;t worry I&#8217;ve cut the &#8220;Hey Alexa&#8221; out of the video.<\/span><\/em><\/p>\n<p><iframe loading=\"lazy\" title=\"Alexa, when is my next bin collection?\" width=\"525\" height=\"295\" src=\"https:\/\/www.youtube.com\/embed\/0iOHyzmSKTI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>Quite nifty yeah?<\/p>\n<p>The next step is making it flexible, at the minute the GET request is hardcoded to my area&#8217;s bin timetable, but I&#8217;ve already got ideas on how I can extend this and not have to worry about storing emails&#8230;<\/p>\n<p>I&#8217;ll get round to tidying up my code for this and making it look less embarrassing, with a follow up on how to knock together a simple (and maybe useful) Amazon Alexa Skill.<\/p>\n<p>Until then&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I don&#8217;t know about you, but I can never remember which bin I need to take out. Is it the blue one? Have the green ones resumed? Anyone else stuck theirs out yet? Who knows&#8230;. Now, I could print off a calendar, but what&#8217;s a printer? Even then the printer I have is an old&#8230;<\/p>\n","protected":false},"author":3,"featured_media":53,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"spay_email":""},"categories":[8],"tags":[14,15],"jetpack_featured_media_url":"https:\/\/roblsmith.co.uk\/blog\/wp-content\/uploads\/2022\/06\/lexa.png","_links":{"self":[{"href":"https:\/\/roblsmith.co.uk\/blog\/wp-json\/wp\/v2\/posts\/52"}],"collection":[{"href":"https:\/\/roblsmith.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/roblsmith.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/roblsmith.co.uk\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/roblsmith.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=52"}],"version-history":[{"count":3,"href":"https:\/\/roblsmith.co.uk\/blog\/wp-json\/wp\/v2\/posts\/52\/revisions"}],"predecessor-version":[{"id":58,"href":"https:\/\/roblsmith.co.uk\/blog\/wp-json\/wp\/v2\/posts\/52\/revisions\/58"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/roblsmith.co.uk\/blog\/wp-json\/wp\/v2\/media\/53"}],"wp:attachment":[{"href":"https:\/\/roblsmith.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/roblsmith.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/roblsmith.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}