{"id":1146,"date":"2022-01-10T13:40:19","date_gmt":"2022-01-10T12:40:19","guid":{"rendered":"http:\/\/www.vatland.no\/?p=1146"},"modified":"2022-01-17T13:53:45","modified_gmt":"2022-01-17T12:53:45","slug":"list-nordpool-electric-prices-using-powershell","status":"publish","type":"post","link":"https:\/\/www.vatland.no\/index.php\/list-nordpool-electric-prices-using-powershell\/","title":{"rendered":"List NordPool electric prices using powershell."},"content":{"rendered":"\n<p>This is a small script using nordpoolgroup api to get todays electric prices for Kr.sand &#8211; Norway. This is the same API as their webpage uses. All the urls and parameters can be found using developermode in the browser. This code is only to demonstrate that it can be done. It all started when i first saw the Homeassistant integration on github .<a href=\"https:\/\/github.com\/custom-components\/nordpool\" target=\"_blank\" rel=\"noreferrer noopener\" title=\"https:\/\/github.com\/custom-components\/nordpool\">https:\/\/github.com\/custom-components\/nordpool<\/a><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\n$today=Get-Date -Format &quot;d-M-yyyy&quot;\n$url=&quot;https:\/\/www.nordpoolgroup.com\/api\/marketdata\/page\/23&quot; #23 = Hourly ,24 = Daily, 25 = Weekly, 26 = Monthly, 27 = Yearly\n\n$url+=&quot;?currency=,NOK,NOK,EUR&amp;endDate=$today&quot;\n$response=Invoke-RestMethod -Uri $url\n$prices=@()\nforeach ($row in $response.data.rows){ \n    $localrow= $row.Columns | Where-Object {($_.name -like &quot;Kr.sand&quot;)} \n if($localrow.IsValid){\n  &#x5B;float]$cost=((($localrow&#x5B;0].value).tostring()).Replace(&#039; &#039;,&#039;&#039;)).replace(&#039;,&#039;,&#039;.&#039;)\n  &#x5B;datetime]$datetime=$row.StartTime\n    Write-Output &quot;$($datetime) - \u00f8re\/kWh ink mva $(&#x5B;math]::round(($cost\/10 * 1.25),2))&quot;\n    $prices+=&#x5B;math]::round(($cost * 1.25),2)\n    }\n}\n\n$prices|Measure-Object -Average -Maximum -Minimum\n\n<\/pre><\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a small script using nordpoolgroup api to get todays electric prices for Kr.sand &#8211; Norway. This is the same API as their webpage uses. All the urls and parameters can be found using developermode in the browser. This code is only to demonstrate that it can be done. It all started when i &hellip; <a href=\"https:\/\/www.vatland.no\/index.php\/list-nordpool-electric-prices-using-powershell\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">List NordPool electric prices using powershell.<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":false,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[84,59,109],"class_list":["post-1146","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-api","tag-powershell","tag-restmethod"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"jetpack-related-posts":[{"id":804,"url":"https:\/\/www.vatland.no\/index.php\/use-powershell-to-get-leakedcredentials-from-azure-using-graph\/","url_meta":{"origin":1146,"position":0},"title":"Use Powershell to get LeakedCredentials from Azure using Graph","author":"Atle","date":"November 1, 2018","format":false,"excerpt":"Leaked credentials listed from Azure using powershell and Microsoft Graph\u00a0We need one Azure AD Premium X license to get this log. Would it be nice to list all leakedcredentials using powershell?(or riskysignins or identiyriskevents). All of this could be achieved using powershell and REST api at Microsoft Graph. I have\u2026","rel":"","context":"In \"Powershell\"","block_context":{"text":"Powershell","link":"https:\/\/www.vatland.no\/index.php\/tag\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.vatland.no\/wp-content\/uploads\/2018\/11\/Leaked.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.vatland.no\/wp-content\/uploads\/2018\/11\/Leaked.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.vatland.no\/wp-content\/uploads\/2018\/11\/Leaked.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":911,"url":"https:\/\/www.vatland.no\/index.php\/use-powershell-to-get-external-ip-address\/","url_meta":{"origin":1146,"position":1},"title":"Use powershell to get external IP address","author":"Atle","date":"September 23, 2019","format":false,"excerpt":"How can you get your external IP address from powershell? I use a simple script to query an external public web service. The service I'm using is hosted by ipinfo.io . I have created a small function that is placed in my powershell library. All my modules are loaded by\u2026","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/www.vatland.no\/index.php\/category\/development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":899,"url":"https:\/\/www.vatland.no\/index.php\/csp-access-to-tenants-using-powershell-part-2\/","url_meta":{"origin":1146,"position":2},"title":"CSP access to tenants using powershell. Part 2","author":"Atle","date":"September 20, 2019","format":false,"excerpt":"In part 1 we created the Azure Enterprise App for Partnercenter and used this information to connect using powershell and connect-partnercenter. Now we will use this to connect to one of our customers tenants. First we will use AZ module and connect-azaccount. We will use the AZ module and the\u2026","rel":"","context":"In &quot;Azure&quot;","block_context":{"text":"Azure","link":"https:\/\/www.vatland.no\/index.php\/category\/azure\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":875,"url":"https:\/\/www.vatland.no\/index.php\/csp-access-to-tenants-using-powershell-part-1\/","url_meta":{"origin":1146,"position":3},"title":"CSP access to tenants using powershell. Part 1","author":"Atle","date":"September 18, 2019","format":false,"excerpt":"A short explanation of how to access customer tenant using a CSP tenant SPN credential connectiong to AzureAD and AZ. Have been struggling for a while to manage all our customers tenants using powershell scripts. It can be complicated to organize all the credentials, tenant domain, tenant id's password expiry.\u2026","rel":"","context":"In &quot;Azure&quot;","block_context":{"text":"Azure","link":"https:\/\/www.vatland.no\/index.php\/category\/azure\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":902,"url":"https:\/\/www.vatland.no\/index.php\/csp-access-to-tenants-using-powershell-part-3\/","url_meta":{"origin":1146,"position":4},"title":"CSP access to tenants using powershell. Part 3","author":"Atle","date":"September 23, 2019","format":false,"excerpt":"In this part 3 of CSP and powershell I will show how you can connect to azureAD of a customer tenant using your CSP app credentials and refreshtoken. This is almost the same procedure as we use to connect to az. We will start with the same variables as in\u2026","rel":"","context":"In &quot;Azure&quot;","block_context":{"text":"Azure","link":"https:\/\/www.vatland.no\/index.php\/category\/azure\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":957,"url":"https:\/\/www.vatland.no\/index.php\/hash-tables-in-powershell\/","url_meta":{"origin":1146,"position":5},"title":"Hash tables in powershell","author":"Atle","date":"March 23, 2020","format":false,"excerpt":"We all have the need to store data in some kind of arrays. I use hashtables a lot. Preferred use is as a lookup table, I can use 'contains' instead of looping through each item or reference an object by name instead of index number. Lookup table for licenses is\u2026","rel":"","context":"In &quot;CSP&quot;","block_context":{"text":"CSP","link":"https:\/\/www.vatland.no\/index.php\/category\/csp\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/posts\/1146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/comments?post=1146"}],"version-history":[{"count":9,"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/posts\/1146\/revisions"}],"predecessor-version":[{"id":1159,"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/posts\/1146\/revisions\/1159"}],"wp:attachment":[{"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/media?parent=1146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/categories?post=1146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/tags?post=1146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}