{"id":208,"date":"2021-11-30T22:08:34","date_gmt":"2021-11-30T22:08:34","guid":{"rendered":"https:\/\/saveawatthour.com\/?page_id=208"},"modified":"2021-12-05T09:46:21","modified_gmt":"2021-12-05T09:46:21","slug":"for-developers","status":"publish","type":"page","link":"https:\/\/saveawatthour.com\/index.php\/for-developers\/","title":{"rendered":"For Developers"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">REST API &#8211; daily energy savings recommendations<\/h2>\n\n\n\n<p>In 2014, while working as a postdoc researcher at University of Southern California, part of the Smart Grid Regional Demonstration Project in Los Angeles, I designed and published a Google app for providing advices to the general public on simple actions they could take to reduce their energy consumption. Recently, while working on an update I decided to provide a <strong>public API to enable developers to integrate these advises in their own applications<\/strong>. I admit the idea also came while teaching my undergrad students Azure fundamentals. As a result, I implemented by using Azure Functions the following API that everyone can try out.<\/p>\n\n\n\n<p>The API is still in beta phase.<\/p>\n\n\n\n<p>REST API: <a href=\"https:\/\/saveawatthour.azurewebsites.net\/api\/recommendactions\">https:\/\/saveawatthour.azurewebsites.net\/api\/recommendactions<\/a><\/p>\n\n\n\n<p>The API accepts the following parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>q<\/strong> &#8211; the location name as a string or the GPS coordinates as <em>latitude,longitude<\/em> pair in decimal values<\/li><li><strong>tz <\/strong>&#8211; location time zone as an integer<\/li><li><strong>appliances <\/strong>&#8211; one or more appliances as a comma separated list: AC, ELECTRIC_HEATER, LIGHTS, REFRIGERATOR, ELECTRIC_STOVE, MICROWAVE, DISH_WASHER, WASHING_MACHINE<\/li><\/ul>\n\n\n\n<p>Two parameters are mandatory: q and tz.<\/p>\n\n\n\n<p>The call <strong>returns a JSON<\/strong> with a list of actions containing<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>action &#8211; action name as a string<\/li><li>startDateTime &#8211; start date and time of the action. Time is UTC<\/li><li>endDateTime &#8211; end date and time of the action. time is UTC<\/li><li>heatIndex &#8211; the calculated temperature in Celsius degrees taking into account the humidity. Integer value<\/li><li>text &#8211; a call for action text as a string<\/li><\/ul>\n\n\n\n<p><strong>Example<\/strong>: <\/p>\n\n\n\n<p>Call: <a href=\"https:\/\/saveawatthour.azurewebsites.net\/api\/recommendactions?q=Nottingham&amp;tz=0&amp;appliances=REFRIGERATOR,LIGHTS,AC,ELECTRIC_HEATER\">https:\/\/saveawatthour.azurewebsites.net\/api\/recommendactions?q=Nottingham&amp;tz=0&amp;appliances=REFRIGERATOR,LIGHTS,AC,ELECTRIC_HEATER<\/a> <\/p>\n\n\n\n<p>Response:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{\n\n    \"actions\":[\n        {\n            \"startDateTime\":\"Fri Dec 03 18:00:00 UTC 2021\",\n            \"heatIndex\":4,\n            \"action\":\"DECREASE_SET_POINT\",\n            \"text\":\"It's chilly outside! Get a warm sweater and save by lowering the thermostat setpoint!\",\n            \"endDateTime\":\"Fri Dec 03 22:00:00 UTC 2021\"\n        },\n        {\n            \"startDateTime\":\"Sat Dec 04 06:00:00 UTC 2021\",\n            \"heatIndex\":5,\n            \"action\":\"DECREASE_SET_POINT\",\n            \"text\":\"It's chilly outside! Get a warm sweater and save by lowering the thermostat setpoint!\",\n            \"endDateTime\":\"Sat Dec 04 15:00:00 UTC 2021\"\n        },\n        {\n            \"startDateTime\":\"Fri Dec 03 23:00:00 UTC 2021\",\n            \"heatIndex\":3,\n            \"action\":\"DECREASE_SET_POINT_NIGHT\",\n            \"text\":\"Sleep time! Save by decreasing the thermostat setpoint by a few degrees!\",\n            \"endDateTime\":\"Sat Dec 04 05:00:00 UTC 2021\"\n        },\n        {\n            \"startDateTime\":\"Fri Dec 03 18:00:00 UTC 2021\",\n            \"heatIndex\":4,\n            \"action\":\"USE_ANY_KITCHEN_AND_LAUNDRY_SERIALIZED\",\n            \"text\":\"Low billing hours! Save and reduce grid stress by not using appliances simultaneously!\",\n            \"endDateTime\":\"Fri Dec 03 22:00:00 UTC 2021\"\n        },\n        {\n            \"startDateTime\":\"Sat Dec 04 07:00:00 UTC 2021\",\n            \"heatIndex\":5,\n            \"action\":\"USE_ANY_KITCHEN_AND_LAUNDRY_SERIALIZED\",\n            \"text\":\"Low billing hours! Save and reduce grid stress by not using appliances simultaneously!\",\n            \"endDateTime\":\"Sat Dec 04 15:00:00 UTC 2021\"\n        }\n    ]\n\n}<\/pre>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style1 like-208 jlk' href='javascript:void(0)' data-task='like' data-post_id='208' data-nonce='482cc63e30' rel='nofollow'><img class='wti-pixel' src='https:\/\/saveawatthour.com\/wp-content\/plugins\/wti-like-post\/images\/pixel.gif' title='Like' \/><span class='lc-208 lc'>0<\/span><\/a><\/div><\/div> <div class='status-208 status align-left'><\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>REST API &#8211; daily energy savings recommendations In 2014, while working as a postdoc researcher at University of Southern California, part of the Smart Grid Regional Demonstration Project in Los Angeles, I designed and published a Google app for providing advices to the general public on simple actions they could take to reduce their energy [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-208","page","type-page","status-publish","hentry"],"aioseo_notices":[],"guten_post_layout_featured_media_urls":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"guten_post_layout_landscape_large":false,"guten_post_layout_portrait_large":false,"guten_post_layout_square_large":false,"guten_post_layout_landscape":false,"guten_post_layout_portrait":false,"guten_post_layout_square":false,"vw-blog-magazine-homepage-thumb":false},"_links":{"self":[{"href":"https:\/\/saveawatthour.com\/index.php\/wp-json\/wp\/v2\/pages\/208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/saveawatthour.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/saveawatthour.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/saveawatthour.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/saveawatthour.com\/index.php\/wp-json\/wp\/v2\/comments?post=208"}],"version-history":[{"count":9,"href":"https:\/\/saveawatthour.com\/index.php\/wp-json\/wp\/v2\/pages\/208\/revisions"}],"predecessor-version":[{"id":225,"href":"https:\/\/saveawatthour.com\/index.php\/wp-json\/wp\/v2\/pages\/208\/revisions\/225"}],"wp:attachment":[{"href":"https:\/\/saveawatthour.com\/index.php\/wp-json\/wp\/v2\/media?parent=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}