{"id":689,"date":"2022-04-17T10:45:01","date_gmt":"2022-04-17T08:45:01","guid":{"rendered":"https:\/\/www.cipv6.de\/worp\/?p=689"},"modified":"2024-12-16T10:33:19","modified_gmt":"2024-12-16T09:33:19","slug":"fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0","status":"publish","type":"post","link":"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/","title":{"rendered":"fix openhab error: Rule &#8216;[rulename]&#8217;: An error occurred during the script execution: index=0, size=0"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">My goal is to execute an python-script when the Battery-charge has reached 70%<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My rule was not executed, the error as shown above is seen in the log.<br>My faulty script:<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-background-color has-background\"><code lang=\"bash\" class=\"language-bash\">rule \"BYD 70\"\n\nwhen\n     Item KOSTALPLENTICOREPlus70WithBattery_BatteryCharge received update\n\n\n\nthen\n\tvar BYDBat = (KOSTALPLENTICOREPlus70WithBattery_BatteryCharge.state as Number).floatValue\n\n\tif ((KOSTALPLENTICOREPlus70WithBattery_BatteryCharge.state as Number).floatValue = 70.0) {\n\n\n\tsendTelegram(\"bot1\",\n            \"BYD hat &gt; 70  % Ladung \" + BYDBat)\n\texecuteCommandLine(\"python3 \/etc\/openhab2\/scripts\/BYDI.py\")\n\tlogDebug(\"logtest\", \"BYDBat = \" + BYDBat)\n        logDebug(\"logtest\", \"state = \" + KOSTALPLENTICOREPlus70WithBattery_BatteryCharge.state)\n}\n\nend<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Reason of the error: the if-statement is misleading, to check if the value is  equal it needs two &#8220;==&#8221;:<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-background-color has-background\"><code lang=\"bash\" class=\"language-bash\">\n\tif ((KOSTALPLENTICOREPlus70WithBattery_BatteryCharge.state as Number).floatValue <strong>==<\/strong> 70.0) {\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">working-code:<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-background-color has-background\"><code lang=\"bash\" class=\"language-bash\">rule \"BYD 70\"\n\nwhen\n     Item KOSTALPLENTICOREPlus70WithBattery_BatteryCharge received update\n\n\n\nthen\n\tvar BYDBat = (KOSTALPLENTICOREPlus70WithBattery_BatteryCharge.state as Number).floatValue\n\n\tif ((KOSTALPLENTICOREPlus70WithBattery_BatteryCharge.state as Number).floatValue == 70.0) {\n\n\n\tsendTelegram(\"bot1\",\n            \"BYD hat &gt; 70  % Ladung \" + BYDBat)\n\texecuteCommandLine(\"python3 \/etc\/openhab2\/scripts\/BYDI.py\")\n\tlogDebug(\"logtest\", \"BYDBat = \" + BYDBat)\n        logDebug(\"logtest\", \"state = \" + KOSTALPLENTICOREPlus70WithBattery_BatteryCharge.state)\n}\n\nend<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">to debug BYDBat\/KOSTALPLENTICOREPlus70WithBattery_BatteryCharge.state debugging needs to be enabled like shown at: <a href=\"https:\/\/www.cipv6.de\/worp\/index.php\/2019\/10\/23\/how-do-i-debug-tradfri-on-openhab\/\">https:\/\/www.cipv6.de\/worp\/index.php\/2019\/10\/23\/how-do-i-debug-tradfri-on-openhab\/<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-background-color has-background\"><code lang=\"bash\" class=\"language-bash\">openhab&gt; log:get org.eclipse.smarthome.model.script\nDEBUG\nopenhab&gt; log:set Info org.eclipse.smarthome.model.script\nopenhab&gt; log:get org.eclipse.smarthome.model.script\nINFO<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>My goal is to execute an python-script when the Battery-charge has reached 70% My rule was not executed, the error as shown above is seen in the log.My faulty script: Reason of the error: the if-statement is misleading, to check if the value is equal it needs two &#8220;==&#8221;: working-code: to debug BYDBat\/KOSTALPLENTICOREPlus70WithBattery_BatteryCharge.state debugging needs &hellip; <a href=\"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;fix openhab error: Rule &#8216;[rulename]&#8217;: An error occurred during the script execution: index=0, size=0&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[31,30,29,32,59],"class_list":["post-689","post","type-post","status-publish","format-standard","hentry","category-linux","tag-error","tag-fix","tag-openhab","tag-rule","tag-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>fix openhab error: Rule &#039;[rulename]&#039;: An error occurred during the script execution: index=0, size=0 - cipv6.de<\/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:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"fix openhab error: Rule &#039;[rulename]&#039;: An error occurred during the script execution: index=0, size=0 - cipv6.de\" \/>\n<meta property=\"og:description\" content=\"My goal is to execute an python-script when the Battery-charge has reached 70% My rule was not executed, the error as shown above is seen in the log.My faulty script: Reason of the error: the if-statement is misleading, to check if the value is equal it needs two &#8220;==&#8221;: working-code: to debug BYDBat\/KOSTALPLENTICOREPlus70WithBattery_BatteryCharge.state debugging needs &hellip; Continue reading &quot;fix openhab error: Rule &#8216;[rulename]&#8217;: An error occurred during the script execution: index=0, size=0&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/\" \/>\n<meta property=\"og:site_name\" content=\"cipv6.de\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-17T08:45:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-16T09:33:19+00:00\" \/>\n<meta name=\"author\" content=\"ugu5ma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"fix openhab error: Rule &#039;[rulename]&#039;: An error occurred during the script execution: index=0, size=0\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.cipv6.de\/worp\/wp-content\/uploads\/2022\/04\/CleanShot-2022-04-17-at-10.40.38@2x.png\" \/>\n<meta name=\"twitter:creator\" content=\"@ugu5ma\" \/>\n<meta name=\"twitter:site\" content=\"@ugu5ma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ugu5ma\" \/>\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:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2022\\\/04\\\/17\\\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2022\\\/04\\\/17\\\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\\\/\"},\"author\":{\"name\":\"ugu5ma\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"headline\":\"fix openhab error: Rule &#8216;[rulename]&#8217;: An error occurred during the script execution: index=0, size=0\",\"datePublished\":\"2022-04-17T08:45:01+00:00\",\"dateModified\":\"2024-12-16T09:33:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2022\\\/04\\\/17\\\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\\\/\"},\"wordCount\":86,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"keywords\":[\"error\",\"fix\",\"openhab\",\"rule\"],\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2022\\\/04\\\/17\\\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2022\\\/04\\\/17\\\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\\\/\",\"url\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2022\\\/04\\\/17\\\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\\\/\",\"name\":\"fix openhab error: Rule '[rulename]': An error occurred during the script execution: index=0, size=0 - cipv6.de\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#website\"},\"datePublished\":\"2022-04-17T08:45:01+00:00\",\"dateModified\":\"2024-12-16T09:33:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2022\\\/04\\\/17\\\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2022\\\/04\\\/17\\\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2022\\\/04\\\/17\\\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"fix openhab error: Rule &#8216;[rulename]&#8217;: An error occurred during the script execution: index=0, size=0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#website\",\"url\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/\",\"name\":\"cipv6.de\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\",\"name\":\"ugu5ma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"caption\":\"ugu5ma\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/cipv6.de\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"fix openhab error: Rule '[rulename]': An error occurred during the script execution: index=0, size=0 - cipv6.de","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:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/","og_locale":"en_US","og_type":"article","og_title":"fix openhab error: Rule '[rulename]': An error occurred during the script execution: index=0, size=0 - cipv6.de","og_description":"My goal is to execute an python-script when the Battery-charge has reached 70% My rule was not executed, the error as shown above is seen in the log.My faulty script: Reason of the error: the if-statement is misleading, to check if the value is equal it needs two &#8220;==&#8221;: working-code: to debug BYDBat\/KOSTALPLENTICOREPlus70WithBattery_BatteryCharge.state debugging needs &hellip; Continue reading \"fix openhab error: Rule &#8216;[rulename]&#8217;: An error occurred during the script execution: index=0, size=0\"","og_url":"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/","og_site_name":"cipv6.de","article_published_time":"2022-04-17T08:45:01+00:00","article_modified_time":"2024-12-16T09:33:19+00:00","author":"ugu5ma","twitter_card":"summary_large_image","twitter_title":"fix openhab error: Rule '[rulename]': An error occurred during the script execution: index=0, size=0","twitter_image":"https:\/\/www.cipv6.de\/worp\/wp-content\/uploads\/2022\/04\/CleanShot-2022-04-17-at-10.40.38@2x.png","twitter_creator":"@ugu5ma","twitter_site":"@ugu5ma","twitter_misc":{"Written by":"ugu5ma","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/#article","isPartOf":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/"},"author":{"name":"ugu5ma","@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"headline":"fix openhab error: Rule &#8216;[rulename]&#8217;: An error occurred during the script execution: index=0, size=0","datePublished":"2022-04-17T08:45:01+00:00","dateModified":"2024-12-16T09:33:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/"},"wordCount":86,"commentCount":0,"publisher":{"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"keywords":["error","fix","openhab","rule"],"articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/","url":"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/","name":"fix openhab error: Rule '[rulename]': An error occurred during the script execution: index=0, size=0 - cipv6.de","isPartOf":{"@id":"https:\/\/www.cipv6.de\/worp\/#website"},"datePublished":"2022-04-17T08:45:01+00:00","dateModified":"2024-12-16T09:33:19+00:00","breadcrumb":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2022\/04\/17\/fix-openhab-error-rule-rulename-an-error-occurred-during-the-script-execution-index0-size0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cipv6.de\/worp\/"},{"@type":"ListItem","position":2,"name":"fix openhab error: Rule &#8216;[rulename]&#8217;: An error occurred during the script execution: index=0, size=0"}]},{"@type":"WebSite","@id":"https:\/\/www.cipv6.de\/worp\/#website","url":"https:\/\/www.cipv6.de\/worp\/","name":"cipv6.de","description":"","publisher":{"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cipv6.de\/worp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d","name":"ugu5ma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","caption":"ugu5ma"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g"},"sameAs":["https:\/\/cipv6.de"]}]}},"_links":{"self":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts\/689","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/comments?post=689"}],"version-history":[{"count":0,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts\/689\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/media?parent=689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/categories?post=689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/tags?post=689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}