{"id":3998,"date":"2023-02-17T13:17:54","date_gmt":"2023-02-17T13:17:54","guid":{"rendered":"https:\/\/lora.vsb.cz\/?page_id=3998"},"modified":"2024-12-15T09:20:42","modified_gmt":"2024-12-15T09:20:42","slug":"cayenne-lpp-encoder-in-python","status":"publish","type":"page","link":"https:\/\/lora.vsb.cz\/index.php\/cayenne-lpp-encoder-in-python\/","title":{"rendered":"Cayenne LPP encoder in Python"},"content":{"rendered":"<table style=\"height: 66px;\" width=\"356\">\n<tbody>\n<tr>\n<td style=\"text-align: left; min-width: 100px;\" width=\"10%\"><strong>TTN version:<\/strong><\/td>\n<td><strong><span style=\"color: #008000;\">TTNv3 \/ TTS SANDBOX<\/span><\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left; min-width: 100px;\" width=\"10%\"><strong>Last revision:<\/strong><\/td>\n<td>December 14, 2024<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>The Cayenne Low Power Payload (LPP)<\/strong> provides a convenient and easy way to send data over LPWAN networks such as LoRaWAN. The Cayenne LPP is compliant with the payload size restriction, which can be lowered down to 11 bytes, and allows the device to send multiple sensor data at one time. Cayenne LPP has several specific functions for some types of data, such as humidity, temperature, pressure, GPS and more.<\/p>\n<p>More information can be found in the<strong>\u00a0<a href=\"https:\/\/docs.mydevices.com\/docs\/lorawan\/cayenne-lpp\" target=\"_blank\" rel=\"noopener\">Cayenne LPP documentation<\/a><\/strong>.<\/p>\n<p>&nbsp;<\/p>\n<h5><strong>Download and example <\/strong><strong>usage <\/strong><\/h5>\n<ol>\n<li>Download as ZIP this <strong><a href=\"https:\/\/github.com\/OndrejKnebl\/CayenneLPP\" target=\"_blank\" rel=\"noopener\">CayenneLPP<\/a><\/strong>.<\/li>\n<li>There is an <strong>example.py<\/strong> in the CayenneLPP folder that you can use.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h5><strong>Example usage in your script<\/strong><\/h5>\n<ol>\n<li>Import downloaded cayenneLPP.py to your script:\n<pre>import src.cayenneLPP as cayenneLPP<\/pre>\n<\/li>\n<li>Create lpp array:\n<pre>lpp = []<\/pre>\n<\/li>\n<li>Append your data to the array (for example add temperature 25.5 \u00b0C to channel 1):\n<pre>lpp.append([1, \"addTemperature\", 25.5])<\/pre>\n<\/li>\n<li>Call the <strong><em>cayenneLPP.encodeCayenneLPP(lpp)<\/em><\/strong> function, where <strong><em>lpp<\/em><\/strong> is array with your data. The function returns encoded data:\n<pre>payload = cayenneLPP.encodeCayenneLPP(lpp)<\/pre>\n<\/li>\n<li>The whole code will look like this:\n<pre>import src.cayenneLPP as cayenneLPP\r\n\r\nlpp = []\r\nlpp.append([1, \"addTemperature\", 25.5])\r\n\r\npayload = cayenneLPP.encodeCayenneLPP(lpp)\r\nprint(payload)<\/pre>\n<\/li>\n<li>The printed output (payload) will look like this:\n<pre>016700ff<\/pre>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h5><strong>Data types<\/strong><\/h5>\n<p>All data types can be found in this <strong><a href=\"https:\/\/github.com\/OndrejKnebl\/CayenneLPP#data-types-1\" target=\"_blank\" rel=\"noopener\">table<\/a><\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TTN version: TTNv3 \/ TTS SANDBOX Last revision: December 14, 2024 The Cayenne Low Power Payload (LPP) provides a convenient and easy way to send data over LPWAN networks such as LoRaWAN. The Cayenne LPP is compliant with the payload size restriction, which can be lowered down to 11 bytes, and allows the device to [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3998","page","type-page","status-publish","hentry","post"],"_links":{"self":[{"href":"https:\/\/lora.vsb.cz\/index.php\/wp-json\/wp\/v2\/pages\/3998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lora.vsb.cz\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lora.vsb.cz\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lora.vsb.cz\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/lora.vsb.cz\/index.php\/wp-json\/wp\/v2\/comments?post=3998"}],"version-history":[{"count":37,"href":"https:\/\/lora.vsb.cz\/index.php\/wp-json\/wp\/v2\/pages\/3998\/revisions"}],"predecessor-version":[{"id":8412,"href":"https:\/\/lora.vsb.cz\/index.php\/wp-json\/wp\/v2\/pages\/3998\/revisions\/8412"}],"wp:attachment":[{"href":"https:\/\/lora.vsb.cz\/index.php\/wp-json\/wp\/v2\/media?parent=3998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}