{"id":1843,"date":"2012-08-31T21:15:26","date_gmt":"2012-08-31T21:15:26","guid":{"rendered":"http:\/\/www.perytons.com\/?p=1843"},"modified":"2015-08-12T21:22:42","modified_gmt":"2015-08-12T21:22:42","slug":"how-to-use-open-source-rule-on-zigbee-home-automation-attributes","status":"publish","type":"post","link":"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/","title":{"rendered":"How to use Open Source Rule on ZigBee Home Automation Attributes"},"content":{"rendered":"<p>Hello everyone,<\/p>\n<p>We were recently asked how an Open Source Rule can address a case of repeating fields such as ZigBee Home Automation Attributes.<\/p>\n<p>A &#8216;normal&#8217; field in a message appears only once.<\/p>\n<p>The Network Layer Frame Type appears only once in a message.<\/p>\n<p>Therefore in an Open Source Rule we can access this field by using:<\/p>\n<p>packet.Field(&#8220;NwlHeaderFctlFrameType&#8221;).Value (or any other desired property of the field such as meaning, hint etc.).<\/p>\n<p>However, some fields may be included in a message more than once.<\/p>\n<p>For example, the following message is ZigBee Home Automation Shade Cluster &#8211; Read Attribute Response.<\/p>\n<p>It holds 3 attributes: Physical Closed Limit (PCL), Motor Step Size (MSS) and Closed Limit (CL).<\/p>\n<p>Assume that we want to see if a message contains the Closed Limit attribute, and if it does, see what its value is.<\/p>\n<p>Using the packet.Field(&#8220;ProfileCmdAttributeId&#8221;).Meaning will not work in this case, because this variable can hold only one out of the three attributes.<\/p>\n<p>In this case what we need to do is the following:<\/p>\n<p>The variable packet.Field(&#8220;ProfileCmdAttributeId&#8221;).Meanings hold a list of three elements (for this example) with the values &#8220;PCL&#8221;, &#8220;MSS&#8221; and &#8220;CL&#8221;.<\/p>\n<p>We should add this into a List&amp;lt;string&amp;gt; variable,<\/p>\n<p>List&amp;lt;string&amp;gt; attributeIds = packet.Field( &#8220;ProfileCmdAttributeId&#8221;).Meanings;<\/p>\n<p>we can also store all attributes values in another list<\/p>\n<p>List&amp;lt;long&amp;gt; attributeValues = packet.Field(&#8220;ProfileCmdAttributeDataValue).Values;<\/p>\n<p>And see if any of its elements contain the attribute we are looking for:<\/p>\n<p>if (attributeIds .Contains(&#8220;CL&#8221;))<\/p>\n<p>If it does, we need to find the relevant attribute number:<\/p>\n<p>int value = (int)attributeValues[attributeIds.IndexOf(&#8220;CL&#8221;)];<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello everyone, We were recently asked how an Open Source Rule can address a case of repeating fields such as ZigBee Home Automation Attributes. A &#8216;normal&#8217; field in a message appears only once. The Network Layer Frame Type appears only once in a message. Therefore in an Open Source Rule we can access this field [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-1843","post","type-post","status-publish","format-standard","hentry","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to use Open Source Rule on ZigBee Home Automation Attributes - Perytons<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use Open Source Rule on ZigBee Home Automation Attributes - Perytons\" \/>\n<meta property=\"og:description\" content=\"Hello everyone, We were recently asked how an Open Source Rule can address a case of repeating fields such as ZigBee Home Automation Attributes. A &#8216;normal&#8217; field in a message appears only once. The Network Layer Frame Type appears only once in a message. Therefore in an Open Source Rule we can access this field [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/\" \/>\n<meta property=\"og:site_name\" content=\"Perytons\" \/>\n<meta property=\"article:published_time\" content=\"2012-08-31T21:15:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-08-12T21:22:42+00:00\" \/>\n<meta name=\"author\" content=\"a67b7A091\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"a67b7A091\" \/>\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\":\"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/\"},\"author\":{\"name\":\"a67b7A091\",\"@id\":\"https:\/\/www.perytons.com\/#\/schema\/person\/0ab73193a2f239cbea4ba0aea9ce6bbb\"},\"headline\":\"How to use Open Source Rule on ZigBee Home Automation Attributes\",\"datePublished\":\"2012-08-31T21:15:26+00:00\",\"dateModified\":\"2015-08-12T21:22:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/\"},\"wordCount\":288,\"publisher\":{\"@id\":\"https:\/\/www.perytons.com\/#organization\"},\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/\",\"url\":\"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/\",\"name\":\"How to use Open Source Rule on ZigBee Home Automation Attributes - Perytons\",\"isPartOf\":{\"@id\":\"https:\/\/www.perytons.com\/#website\"},\"datePublished\":\"2012-08-31T21:15:26+00:00\",\"dateModified\":\"2015-08-12T21:22:42+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.perytons.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use Open Source Rule on ZigBee Home Automation Attributes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.perytons.com\/#website\",\"url\":\"https:\/\/www.perytons.com\/\",\"name\":\"Perytons\",\"description\":\"Perytons Website\",\"publisher\":{\"@id\":\"https:\/\/www.perytons.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.perytons.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.perytons.com\/#organization\",\"name\":\"Perytons\",\"url\":\"https:\/\/www.perytons.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.perytons.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/www.perytons.com\/wp-content\/uploads\/2015\/07\/logo-Perytons-shadow1.png\",\"contentUrl\":\"http:\/\/www.perytons.com\/wp-content\/uploads\/2015\/07\/logo-Perytons-shadow1.png\",\"width\":250,\"height\":121,\"caption\":\"Perytons\"},\"image\":{\"@id\":\"https:\/\/www.perytons.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.perytons.com\/#\/schema\/person\/0ab73193a2f239cbea4ba0aea9ce6bbb\",\"name\":\"a67b7A091\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.perytons.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/983f80199088904102091db1a185c4bd1d69dea0cc58fb56f2e124b4bfb1af24?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/983f80199088904102091db1a185c4bd1d69dea0cc58fb56f2e124b4bfb1af24?s=96&d=mm&r=g\",\"caption\":\"a67b7A091\"},\"url\":\"http:\/\/www.perytons.com\/index.php\/author\/a67b7a091\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use Open Source Rule on ZigBee Home Automation Attributes - Perytons","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":"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/","og_locale":"en_US","og_type":"article","og_title":"How to use Open Source Rule on ZigBee Home Automation Attributes - Perytons","og_description":"Hello everyone, We were recently asked how an Open Source Rule can address a case of repeating fields such as ZigBee Home Automation Attributes. A &#8216;normal&#8217; field in a message appears only once. The Network Layer Frame Type appears only once in a message. Therefore in an Open Source Rule we can access this field [&hellip;]","og_url":"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/","og_site_name":"Perytons","article_published_time":"2012-08-31T21:15:26+00:00","article_modified_time":"2015-08-12T21:22:42+00:00","author":"a67b7A091","twitter_card":"summary_large_image","twitter_misc":{"Written by":"a67b7A091","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/#article","isPartOf":{"@id":"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/"},"author":{"name":"a67b7A091","@id":"https:\/\/www.perytons.com\/#\/schema\/person\/0ab73193a2f239cbea4ba0aea9ce6bbb"},"headline":"How to use Open Source Rule on ZigBee Home Automation Attributes","datePublished":"2012-08-31T21:15:26+00:00","dateModified":"2015-08-12T21:22:42+00:00","mainEntityOfPage":{"@id":"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/"},"wordCount":288,"publisher":{"@id":"https:\/\/www.perytons.com\/#organization"},"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/","url":"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/","name":"How to use Open Source Rule on ZigBee Home Automation Attributes - Perytons","isPartOf":{"@id":"https:\/\/www.perytons.com\/#website"},"datePublished":"2012-08-31T21:15:26+00:00","dateModified":"2015-08-12T21:22:42+00:00","breadcrumb":{"@id":"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.perytons.com\/index.php\/2012\/08\/31\/how-to-use-open-source-rule-on-zigbee-home-automation-attributes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.perytons.com\/"},{"@type":"ListItem","position":2,"name":"How to use Open Source Rule on ZigBee Home Automation Attributes"}]},{"@type":"WebSite","@id":"https:\/\/www.perytons.com\/#website","url":"https:\/\/www.perytons.com\/","name":"Perytons","description":"Perytons Website","publisher":{"@id":"https:\/\/www.perytons.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.perytons.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.perytons.com\/#organization","name":"Perytons","url":"https:\/\/www.perytons.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.perytons.com\/#\/schema\/logo\/image\/","url":"http:\/\/www.perytons.com\/wp-content\/uploads\/2015\/07\/logo-Perytons-shadow1.png","contentUrl":"http:\/\/www.perytons.com\/wp-content\/uploads\/2015\/07\/logo-Perytons-shadow1.png","width":250,"height":121,"caption":"Perytons"},"image":{"@id":"https:\/\/www.perytons.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.perytons.com\/#\/schema\/person\/0ab73193a2f239cbea4ba0aea9ce6bbb","name":"a67b7A091","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.perytons.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/983f80199088904102091db1a185c4bd1d69dea0cc58fb56f2e124b4bfb1af24?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/983f80199088904102091db1a185c4bd1d69dea0cc58fb56f2e124b4bfb1af24?s=96&d=mm&r=g","caption":"a67b7A091"},"url":"http:\/\/www.perytons.com\/index.php\/author\/a67b7a091\/"}]}},"_links":{"self":[{"href":"http:\/\/www.perytons.com\/index.php\/wp-json\/wp\/v2\/posts\/1843","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.perytons.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.perytons.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.perytons.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.perytons.com\/index.php\/wp-json\/wp\/v2\/comments?post=1843"}],"version-history":[{"count":1,"href":"http:\/\/www.perytons.com\/index.php\/wp-json\/wp\/v2\/posts\/1843\/revisions"}],"predecessor-version":[{"id":1844,"href":"http:\/\/www.perytons.com\/index.php\/wp-json\/wp\/v2\/posts\/1843\/revisions\/1844"}],"wp:attachment":[{"href":"http:\/\/www.perytons.com\/index.php\/wp-json\/wp\/v2\/media?parent=1843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.perytons.com\/index.php\/wp-json\/wp\/v2\/categories?post=1843"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.perytons.com\/index.php\/wp-json\/wp\/v2\/tags?post=1843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}