Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
|
domotique:jeedom:scripts [2019/04/26 18:22] François d'Arundel créée |
domotique:jeedom:scripts [2019/04/26 22:53] (Version actuelle) François d'Arundel |
||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| ===== Mes scripts ===== | ===== Mes scripts ===== | ||
| - | Donne moi la température | + | **__Donne |
| Ce script permet de donner la température d'une ville si elle est renseignée. La première lettre du nom de la ville doit être en majuscule. | Ce script permet de donner la température d'une ville si elle est renseignée. La première lettre du nom de la ville doit être en majuscule. | ||
| Script | Script | ||
| + | |||
| + | < | ||
| + | // Variables | ||
| + | $messageTemperature = " | ||
| + | $scenario-> | ||
| + | $action = " | ||
| + | $town = " | ||
| + | $value_temperature = " | ||
| + | $object = " | ||
| + | $cmd = " | ||
| + | |||
| + | |||
| + | // Get tags todo from interaction | ||
| + | $action = $scenario-> | ||
| + | $action = ucfirst(strtolower($action)); | ||
| + | |||
| + | // Get tags town from interaction. If town's name contain ' delete it. This part is according with your nomenclature town's name | ||
| + | $town = $scenario-> | ||
| + | if (strpos($town, | ||
| + | $pos = strpos($town, | ||
| + | $town = ucfirst(substr($town, | ||
| + | else { | ||
| + | $town = ucfirst(strtolower($town)); | ||
| + | |||
| + | // Get value of $action from $town | ||
| + | $object = "# | ||
| + | $cmd = cmd:: | ||
| + | if (gettype($cmd) == " | ||
| + | |||
| + | // Make return message | ||
| + | if (is_numeric($value_temperature)) { $messageTemperature = " | ||
| + | |||
| + | $scenario-> | ||
| + | </ | ||
| + | |||
| + | |||