This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dependency: https://github.com/custom-components/nordpool | |
blueprint: | |
name: Nord Pool top X cheapest hours | |
description: Set up automation based on which hours of the day are the cheapest or most expensive. | |
domain: automation | |
input: | |
prices: | |
name: Nord Pool | |
description: Price sensor. | |
selector: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generate all possible alphabetical combinations of given strings | |
* | |
* @param array $strings - Strings to combine | |
* @param array $combinationArray - for internal use only | |
* @param int $start - for internal use only | |
* @param string $prefix - for internal use only | |
* @return array | |
*/ | |
function generateCombinations($strings, &$combinationArray = array(), $start = 0, $prefix = "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Validate host name | |
* | |
* @link http://stackoverflow.com/questions/1755144/how-to-validate-domain-name-in-php | |
* @param string $host | |
* @return bool | |
*/ | |
function isValidHostName($host) | |
{ | |
return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $host) //valid chars check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert various relative urls to absolute | |
* | |
* @author Jan-Petter Gundersen (europe.jpg@gmail.com) | |
* @param $url - url to convert | |
* @param $base - parent url | |
* @return string - absolute url | |
*/ | |
function url_absolute($url, $base) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* URL encoder according to RFC 3986 | |
* Returns a string containing the encoded URL with disallowed characters converted to their percentage encodings. | |
* @link http://publicmind.in/blog/url-encoding/ | |
* | |
* @param $url | |
* @return string | |
*/ | |
function encode_url($url) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL); | |
ini_set('display_errors', 1); | |
date_default_timezone_set('Europe/Oslo'); | |
setlocale(LC_TIME, 'nb_NO.UTF-8'); | |
function astro_api_sunrise($parameters) | |
{ | |
$debug = false; |