{"id":202,"date":"2020-06-14T14:57:00","date_gmt":"2020-06-14T16:57:00","guid":{"rendered":"https:\/\/thegreydiamond.de\/?p=202"},"modified":"2021-09-24T07:57:05","modified_gmt":"2021-09-24T05:57:05","slug":"openhab-zufaellige-verzoegerung-jitter","status":"publish","type":"post","link":"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/","title":{"rendered":"OpenHAB: Zuf\u00e4llige Verz\u00f6gerung (Jitter)"},"content":{"rendered":"\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/www.openhab.org\/\" target=\"_blank\">OpenHAB<\/a> ist eine Quellen offene Hausautomationssoftware. In diesem Artikel erkl\u00e4re ich kurz, wie es m\u00f6glich ist Aktionen mit einer zuf\u00e4lligen Verz\u00f6gerung auszuf\u00fchren. Dieses Konzept nennt man auch Jitter.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ziel<\/h3>\n\n\n\n<p>Mein Ziel ist es, ein Ger\u00e4t mit einer zuf\u00e4lligen Verz\u00f6gerung einzuschalten und dabei OpenHAB-Regeln zu nutzen. Es war von Anfang an klar, dass man den GUI Regel Editor von OpenHAB daf\u00fcr nicht nutzen kann.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Die L\u00f6sung<\/h3>\n\n\n\n<p>Mit ein wenig Java-Verst\u00e4ndnis und ein wenig lesen, kam ich auf die folgende L\u00f6sung:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"java\" class=\"language-java line-numbers\">rule \"LampeVerzoegertAn\"\nwhen\n\tTime cron \"0 54 20 1\/1 * ? *\"\nthen\n        var int randomTime = (new java.util.Random).nextInt(20,125)\n\t    logInfo(\"org.openhab\",\"Setting random lights timer to \" + randomTime + \"seconds.\")\n\t    tRandomLights = createTimer(now.plusSeconds(randomTime)) [|\n                MeineLampe.sendCommand(ON)\n            ]\nend<\/code><\/pre>\n\n\n\n<p>Im <code>when<\/code>-Block besagt die Zeile <code>Time cron \"0 54 20 1\/1 * ? *\"<\/code>, dass es sich um eine Zeitbasierte Regel handelt, welche um 20:54 ausgef\u00fchrt wird. Das hei\u00dft, dass das Ger\u00e4t fr\u00fchestens um 20:54 eingeschaltet wird. In der Zeile <code>var int randomTime = (new java.util.Random).nextInt(20,125)<\/code> definieren wir die Variable <code>randomTime<\/code> des Types <code>int<\/code> (also eine Ganzzahl). In den Klammern wird der kleinste m\u00f6gliche Wert (in diesem Fall 20 Sekunden) und der gr\u00f6\u00dfte (l\u00e4ngste) Wert angegeben(in diesem Fall 125 Sekunden, etwa zwei Minuten). Als n\u00e4chsten wird eine Logausgabe erzeugt. <code>tRandomLights = createTimer(now.plusSeconds(randomTime)) [|<\/code>, erzeugt einen neuen Timer mit der Verz\u00f6gerung von <code>randomTime<\/code>. Nach dem Klammerblock <code>[|<\/code> wird der  passende Code eingegeben. In diesem Fall Schalte ich das Item <span style=\"color:#af0003\" class=\"has-inline-color\">(Aufpassen, nicht das Ger\u00e4t!)<\/span> ein. <code>MeineLampe<\/code> muss nat\u00fcrlich angepasst werden. Zuletzt wird der Block mit einer weiteren eckigen Klammer geschlossen. <\/p>\n\n\n\n<p>Mit diesem Code habe ich erfolgreich eine Leuchte zuf\u00e4llig angeschaltet.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenHAB ist eine Quellen offene Hausautomationssoftware. In diesem Artikel erkl\u00e4re ich kurz, wie es m\u00f6glich ist Aktionen mit einer zuf\u00e4lligen Verz\u00f6gerung auszuf\u00fchren. Dieses Konzept nennt man auch Jitter. Ziel Mein Ziel ist es, ein Ger\u00e4t mit einer zuf\u00e4lligen Verz\u00f6gerung einzuschalten und dabei OpenHAB-Regeln zu nutzen. Es war von Anfang an klar, dass man den GUI [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-202","post","type-post","status-publish","format-standard","hentry","category-uncategorized","post-preview"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>OpenHAB: Zuf\u00e4llige Verz\u00f6gerung (Jitter) &#8211; Thegreydiamond<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"OpenHAB: Zuf\u00e4llige Verz\u00f6gerung (Jitter) &#8211; Thegreydiamond\" \/>\n<meta property=\"og:description\" content=\"OpenHAB ist eine Quellen offene Hausautomationssoftware. In diesem Artikel erkl\u00e4re ich kurz, wie es m\u00f6glich ist Aktionen mit einer zuf\u00e4lligen Verz\u00f6gerung auszuf\u00fchren. Dieses Konzept nennt man auch Jitter. Ziel Mein Ziel ist es, ein Ger\u00e4t mit einer zuf\u00e4lligen Verz\u00f6gerung einzuschalten und dabei OpenHAB-Regeln zu nutzen. Es war von Anfang an klar, dass man den GUI [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/\" \/>\n<meta property=\"og:site_name\" content=\"Thegreydiamond\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-14T16:57:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-24T05:57:05+00:00\" \/>\n<meta name=\"author\" content=\"TheGreydiamond\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@thegreydiamond2\" \/>\n<meta name=\"twitter:site\" content=\"@thegreydiamond2\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TheGreydiamond\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/2020\\\/06\\\/14\\\/openhab-zufaellige-verzoegerung-jitter\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/2020\\\/06\\\/14\\\/openhab-zufaellige-verzoegerung-jitter\\\/\"},\"author\":{\"name\":\"TheGreydiamond\",\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/#\\\/schema\\\/person\\\/a7ba7a2ca50e4001f3f8f852c079910d\"},\"headline\":\"OpenHAB: Zuf\u00e4llige Verz\u00f6gerung (Jitter)\",\"datePublished\":\"2020-06-14T16:57:00+00:00\",\"dateModified\":\"2021-09-24T05:57:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/2020\\\/06\\\/14\\\/openhab-zufaellige-verzoegerung-jitter\\\/\"},\"wordCount\":230,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/#organization\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/2020\\\/06\\\/14\\\/openhab-zufaellige-verzoegerung-jitter\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/2020\\\/06\\\/14\\\/openhab-zufaellige-verzoegerung-jitter\\\/\",\"url\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/2020\\\/06\\\/14\\\/openhab-zufaellige-verzoegerung-jitter\\\/\",\"name\":\"OpenHAB: Zuf\u00e4llige Verz\u00f6gerung (Jitter) &#8211; Thegreydiamond\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/#website\"},\"datePublished\":\"2020-06-14T16:57:00+00:00\",\"dateModified\":\"2021-09-24T05:57:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/2020\\\/06\\\/14\\\/openhab-zufaellige-verzoegerung-jitter\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/2020\\\/06\\\/14\\\/openhab-zufaellige-verzoegerung-jitter\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/2020\\\/06\\\/14\\\/openhab-zufaellige-verzoegerung-jitter\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"OpenHAB: Zuf\u00e4llige Verz\u00f6gerung (Jitter)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/\",\"name\":\"Thegreydiamond\",\"description\":\"TheGreydiamonds Blog\",\"publisher\":{\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/#organization\",\"name\":\"TheGreydiamond\",\"url\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/logoVersuch2.png\",\"contentUrl\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/logoVersuch2.png\",\"width\":1000,\"height\":1000,\"caption\":\"TheGreydiamond\"},\"image\":{\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/thegreydiamond2\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thegreydiamond.de\\\/blog\\\/#\\\/schema\\\/person\\\/a7ba7a2ca50e4001f3f8f852c079910d\",\"name\":\"TheGreydiamond\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/55ee91221a0c102f9e4fa464a2edf06cc82724dc4f1299c99818b23e45801a75?s=96&d=mm&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/55ee91221a0c102f9e4fa464a2edf06cc82724dc4f1299c99818b23e45801a75?s=96&d=mm&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/55ee91221a0c102f9e4fa464a2edf06cc82724dc4f1299c99818b23e45801a75?s=96&d=mm&r=pg\",\"caption\":\"TheGreydiamond\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"OpenHAB: Zuf\u00e4llige Verz\u00f6gerung (Jitter) &#8211; Thegreydiamond","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/","og_locale":"en_US","og_type":"article","og_title":"OpenHAB: Zuf\u00e4llige Verz\u00f6gerung (Jitter) &#8211; Thegreydiamond","og_description":"OpenHAB ist eine Quellen offene Hausautomationssoftware. In diesem Artikel erkl\u00e4re ich kurz, wie es m\u00f6glich ist Aktionen mit einer zuf\u00e4lligen Verz\u00f6gerung auszuf\u00fchren. Dieses Konzept nennt man auch Jitter. Ziel Mein Ziel ist es, ein Ger\u00e4t mit einer zuf\u00e4lligen Verz\u00f6gerung einzuschalten und dabei OpenHAB-Regeln zu nutzen. Es war von Anfang an klar, dass man den GUI [&hellip;]","og_url":"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/","og_site_name":"Thegreydiamond","article_published_time":"2020-06-14T16:57:00+00:00","article_modified_time":"2021-09-24T05:57:05+00:00","author":"TheGreydiamond","twitter_card":"summary_large_image","twitter_creator":"@thegreydiamond2","twitter_site":"@thegreydiamond2","twitter_misc":{"Written by":"TheGreydiamond","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/#article","isPartOf":{"@id":"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/"},"author":{"name":"TheGreydiamond","@id":"https:\/\/thegreydiamond.de\/blog\/#\/schema\/person\/a7ba7a2ca50e4001f3f8f852c079910d"},"headline":"OpenHAB: Zuf\u00e4llige Verz\u00f6gerung (Jitter)","datePublished":"2020-06-14T16:57:00+00:00","dateModified":"2021-09-24T05:57:05+00:00","mainEntityOfPage":{"@id":"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/"},"wordCount":230,"commentCount":0,"publisher":{"@id":"https:\/\/thegreydiamond.de\/blog\/#organization"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/","url":"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/","name":"OpenHAB: Zuf\u00e4llige Verz\u00f6gerung (Jitter) &#8211; Thegreydiamond","isPartOf":{"@id":"https:\/\/thegreydiamond.de\/blog\/#website"},"datePublished":"2020-06-14T16:57:00+00:00","dateModified":"2021-09-24T05:57:05+00:00","breadcrumb":{"@id":"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/thegreydiamond.de\/blog\/2020\/06\/14\/openhab-zufaellige-verzoegerung-jitter\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thegreydiamond.de\/blog\/"},{"@type":"ListItem","position":2,"name":"OpenHAB: Zuf\u00e4llige Verz\u00f6gerung (Jitter)"}]},{"@type":"WebSite","@id":"https:\/\/thegreydiamond.de\/blog\/#website","url":"https:\/\/thegreydiamond.de\/blog\/","name":"Thegreydiamond","description":"TheGreydiamonds Blog","publisher":{"@id":"https:\/\/thegreydiamond.de\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thegreydiamond.de\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/thegreydiamond.de\/blog\/#organization","name":"TheGreydiamond","url":"https:\/\/thegreydiamond.de\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/thegreydiamond.de\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/thegreydiamond.de\/blog\/wp-content\/uploads\/2021\/09\/logoVersuch2.png","contentUrl":"https:\/\/thegreydiamond.de\/blog\/wp-content\/uploads\/2021\/09\/logoVersuch2.png","width":1000,"height":1000,"caption":"TheGreydiamond"},"image":{"@id":"https:\/\/thegreydiamond.de\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/thegreydiamond2"]},{"@type":"Person","@id":"https:\/\/thegreydiamond.de\/blog\/#\/schema\/person\/a7ba7a2ca50e4001f3f8f852c079910d","name":"TheGreydiamond","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/55ee91221a0c102f9e4fa464a2edf06cc82724dc4f1299c99818b23e45801a75?s=96&d=mm&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/55ee91221a0c102f9e4fa464a2edf06cc82724dc4f1299c99818b23e45801a75?s=96&d=mm&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/55ee91221a0c102f9e4fa464a2edf06cc82724dc4f1299c99818b23e45801a75?s=96&d=mm&r=pg","caption":"TheGreydiamond"}}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-image":false},"uagb_author_info":{"display_name":"TheGreydiamond","author_link":"https:\/\/thegreydiamond.de\/blog\/author\/thegreydiamond\/"},"uagb_comment_info":0,"uagb_excerpt":"OpenHAB ist eine Quellen offene Hausautomationssoftware. In diesem Artikel erkl\u00e4re ich kurz, wie es m\u00f6glich ist Aktionen mit einer zuf\u00e4lligen Verz\u00f6gerung auszuf\u00fchren. Dieses Konzept nennt man auch Jitter. Ziel Mein Ziel ist es, ein Ger\u00e4t mit einer zuf\u00e4lligen Verz\u00f6gerung einzuschalten und dabei OpenHAB-Regeln zu nutzen. Es war von Anfang an klar, dass man den GUI&hellip;","_links":{"self":[{"href":"https:\/\/thegreydiamond.de\/blog\/wp-json\/wp\/v2\/posts\/202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thegreydiamond.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thegreydiamond.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thegreydiamond.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thegreydiamond.de\/blog\/wp-json\/wp\/v2\/comments?post=202"}],"version-history":[{"count":0,"href":"https:\/\/thegreydiamond.de\/blog\/wp-json\/wp\/v2\/posts\/202\/revisions"}],"wp:attachment":[{"href":"https:\/\/thegreydiamond.de\/blog\/wp-json\/wp\/v2\/media?parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thegreydiamond.de\/blog\/wp-json\/wp\/v2\/categories?post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thegreydiamond.de\/blog\/wp-json\/wp\/v2\/tags?post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}