diff --git a/thermokon/Thumbs.db b/thermokon/Thumbs.db new file mode 100644 index 0000000000..a5d6886bb8 Binary files /dev/null and b/thermokon/Thumbs.db differ diff --git a/thermokon/dpa-lrw.jpg b/thermokon/dpa-lrw.jpg new file mode 100644 index 0000000000..84dd2879e0 Binary files /dev/null and b/thermokon/dpa-lrw.jpg differ diff --git a/thermokon/dpa-lrw.yaml b/thermokon/dpa-lrw.yaml new file mode 100644 index 0000000000..13173ee8d2 --- /dev/null +++ b/thermokon/dpa-lrw.yaml @@ -0,0 +1,48 @@ +name: DPA+ LRW +description: Differential Pressure and Volume Flow Sensor + +# Hardware versions (optional, use when you have revisions) +hardwareVersions: + - version: '1.0' + numeric: 1 + +# Firmware versions (at least one is mandatory) +firmwareVersions: + - # Firmware version + version: '1.0' + numeric: 1 + # Corresponding hardware versions (optional) + hardwareVersions: + - '1.0' + + # LoRaWAN Device Profiles per region + # Supported regions are EU863-870, US902-928, AU915-928, AS923, CN779-787, EU433, CN470-510, KR920-923, IN865-867, + # RU864-870 + profiles: + EU863-870: + # Optional identifier of the vendor of the profile. When you specify the vendorID, the profile is loaded from + # the vendorID's folder. This allows you to reuse profiles from module or LoRaWAN end device stack vendors. + # If vendorID is empty, the current vendor ID is used. In this example, the vendorID is the current vendor ID, + # which is verbose. + vendorID: thermokon + # Identifier of the profile (lowercase, alphanumeric with dashes, max 36 characters) + id: thermokon-2-profile + lorawanCertified: false + codec: thermokon-codec +# Sensors that this device features (optional) +# Valid values are: +# 4-20 ma, accelerometer, altitude, analog input, auxiliary, barometer, battery, button, bvoc, co, co2, conductivity, +# current, digital input, dissolved oxygen, distance, dust, energy, gps, gyroscope, h2s, humidity, iaq, level, light, +# lightning, link, magnetometer, moisture, motion, no, no2, o3, particulate matter, ph, pir, pm2.5, pm10, potentiometer, +# power, precipitation, pressure, proximity, pulse count, pulse frequency, radar, rainfall, rssi, smart valve, snr, so2, +# solar radiation, sound, strain, surface temperature, temperature, tilt, time, tvoc, uv, vapor pressure, velocity, +# vibration, voltage, water potential, water, weight, wifi ssid, wind direction, wind speed. +sensors: + - pressure + +# Product and data sheet URLs (optional) +productURL: https://www.thermokon.de/direct/en-gb?path=%2F1%2F2%2F20&filter_show=1&q=&limit=18&filter_articles=&sbscf%3Asbscf1%2Fattr%2F8470[]=thermokon%3A%2F%2F{r%3D0%2Cb%3D0%2Cl%3Den_UK}%2F1%2F7%2F8%2F338%2F339%2F8470%2F10570 + +# Photos +photos: + main: dpa-lrw.jpg \ No newline at end of file diff --git a/thermokon/index.yaml b/thermokon/index.yaml new file mode 100644 index 0000000000..5e2696352c --- /dev/null +++ b/thermokon/index.yaml @@ -0,0 +1,7 @@ +endDevices: + # Unique identifier of the end device (lowercase, alphanumeric with dashes, max 36 characters) + - mcs-lrw #Multi Compact Sensor + - dpa-lrw #Differential Pressure Sensor + - novos-3-lrw #Room Sensor - Room Operating Unit + - ls02-lrw #Lekage Sensor + - thanos-evo-lrw #Full Touch Room Operating Unit diff --git a/thermokon/ls02-lrw.jpg b/thermokon/ls02-lrw.jpg new file mode 100644 index 0000000000..779ff5bf87 Binary files /dev/null and b/thermokon/ls02-lrw.jpg differ diff --git a/vendor/thermokon/thanos-evo-lrw.yaml b/thermokon/ls02-lrw.yaml similarity index 66% rename from vendor/thermokon/thanos-evo-lrw.yaml rename to thermokon/ls02-lrw.yaml index b740a2ba6c..5034cedc13 100644 --- a/vendor/thermokon/thanos-evo-lrw.yaml +++ b/thermokon/ls02-lrw.yaml @@ -1,5 +1,5 @@ -name: Thanos Evo LRW -description: Full Touch Room Operating Unit for Controlling with optional wired BMS connection +name: LS02+ LRW +description: Lekage detection sensor with relay output # Hardware versions (optional, use when you have revisions) hardwareVersions: @@ -15,7 +15,7 @@ firmwareVersions: hardwareVersions: - '1.0' - # LoRaWAN Device Profiles per region + # LoRaWAN Device Profiles per region # Supported regions are EU863-870, US902-928, AU915-928, AS923, CN779-787, EU433, CN470-510, KR920-923, IN865-867, # RU864-870 profiles: @@ -26,6 +26,15 @@ firmwareVersions: # which is verbose. vendorID: thermokon # Identifier of the profile (lowercase, alphanumeric with dashes, max 36 characters) - id: thermokon-1-profile + id: thermokon-2-profile lorawanCertified: false - codec: thermokon-codec-ext + codec: thermokon-codec +sensors: + - lekage + - humidity +# Product and data sheet URLs (optional) +productURL: https://www.thermokon.de/direct/en-gb?path=%2F1%2F2%2F20&filter_show=1&q=&limit=18&filter_articles=&sbscf%3Asbscf1%2Fattr%2F8470[]=thermokon%3A%2F%2F{r%3D0%2Cb%3D0%2Cl%3Den_UK}%2F1%2F7%2F8%2F338%2F339%2F8470%2F10570 + +# Photos +photos: + main: ls02-lrw.jpg \ No newline at end of file diff --git a/thermokon/mcs-lrw.jpg b/thermokon/mcs-lrw.jpg new file mode 100644 index 0000000000..92efc1e186 Binary files /dev/null and b/thermokon/mcs-lrw.jpg differ diff --git a/thermokon/mcs-lrw.yaml b/thermokon/mcs-lrw.yaml new file mode 100644 index 0000000000..9cc5f7a5c6 --- /dev/null +++ b/thermokon/mcs-lrw.yaml @@ -0,0 +1,53 @@ +name: MCS LRW +description: Indoor Multicompact Sensor + +# Hardware versions (optional, use when you have revisions) +hardwareVersions: + - version: '1.0' + numeric: 1 + +# Firmware versions (at least one is mandatory) +firmwareVersions: + - # Firmware version + version: '1' + numeric: 1 + # Corresponding hardware versions (optional) + hardwareVersions: + - '1.0' + + # LoRaWAN Device Profiles per region + # Supported regions are EU863-870, US902-928, AU915-928, AS923, CN779-787, EU433, CN470-510, KR920-923, IN865-867, + # RU864-870 + profiles: + EU863-870: + # Optional identifier of the vendor of the profile. When you specify the vendorID, the profile is loaded from + # the vendorID's folder. This allows you to reuse profiles from module or LoRaWAN end device stack vendors. + # If vendorID is empty, the current vendor ID is used. In this example, the vendorID is the current vendor ID, + # which is verbose. + vendorID: thermokon + # Identifier of the profile (lowercase, alphanumeric with dashes, max 36 characters) + id: thermokon-1-profile + lorawanCertified: false + codec: thermokon-codec +# Sensors that this device features (optional) +# Valid values are: +# 4-20 ma, accelerometer, altitude, analog input, auxiliary, barometer, battery, button, bvoc, co, co2, conductivity, +# current, digital input, dissolved oxygen, distance, dust, energy, gps, gyroscope, h2s, humidity, iaq, level, light, +# lightning, link, magnetometer, moisture, motion, no, no2, o3, particulate matter, ph, pir, pm2.5, pm10, potentiometer, +# power, precipitation, pressure, proximity, pulse count, pulse frequency, radar, rainfall, rssi, smart valve, snr, so2, +# solar radiation, sound, strain, surface temperature, temperature, tilt, time, tvoc, uv, vapor pressure, velocity, +# vibration, voltage, water potential, water, weight, wifi ssid, wind direction, wind speed. +sensors: + - battery + - digital input + - motion + - humidity + - temperature + - light + +# Product and data sheet URLs (optional) +productURL: https://www.thermokon.de/direct/en-gb?path=%2F1%2F2%2F20&filter_show=1&q=&limit=18&filter_articles=&sbscf%3Asbscf1%2Fattr%2F8470[]=thermokon%3A%2F%2F{r%3D0%2Cb%3D0%2Cl%3Den_UK}%2F1%2F7%2F8%2F338%2F339%2F8470%2F10570 + +# Photos +photos: + main: mcs-lrw.jpg \ No newline at end of file diff --git a/thermokon/novos-3-lrw.jpg b/thermokon/novos-3-lrw.jpg new file mode 100644 index 0000000000..97875240ea Binary files /dev/null and b/thermokon/novos-3-lrw.jpg differ diff --git a/thermokon/novos-3-lrw.yaml b/thermokon/novos-3-lrw.yaml new file mode 100644 index 0000000000..8aa2014b97 --- /dev/null +++ b/thermokon/novos-3-lrw.yaml @@ -0,0 +1,52 @@ +name: NOVOS 3 LRW +description: Indoor Multifunctional Room Sensor and Operating Unit + +# Hardware versions (optional, use when you have revisions) +hardwareVersions: + - version: '1.0' + numeric: 1 + +# Firmware versions (at least one is mandatory) +firmwareVersions: + - # Firmware version + version: '1.0' + numeric: 1 + # Corresponding hardware versions (optional) + hardwareVersions: + - '1.0' + + # LoRaWAN Device Profiles per region + # Supported regions are EU863-870, US902-928, AU915-928, AS923, CN779-787, EU433, CN470-510, KR920-923, IN865-867, + # RU864-870 + profiles: + EU863-870: + # Optional identifier of the vendor of the profile. When you specify the vendorID, the profile is loaded from + # the vendorID's folder. This allows you to reuse profiles from module or LoRaWAN end device stack vendors. + # If vendorID is empty, the current vendor ID is used. In this example, the vendorID is the current vendor ID, + # which is verbose. + vendorID: thermokon + # Identifier of the profile (lowercase, alphanumeric with dashes, max 36 characters) + id: thermokon-1-profile + lorawanCertified: false + codec: thermokon-codec +# Sensors that this device features (optional) +# Valid values are: +# 4-20 ma, accelerometer, altitude, analog input, auxiliary, barometer, battery, button, bvoc, co, co2, conductivity, +# current, digital input, dissolved oxygen, distance, dust, energy, gps, gyroscope, h2s, humidity, iaq, level, light, +# lightning, link, magnetometer, moisture, motion, no, no2, o3, particulate matter, ph, pir, pm2.5, pm10, potentiometer, +# power, precipitation, pressure, proximity, pulse count, pulse frequency, radar, rainfall, rssi, smart valve, snr, so2, +# solar radiation, sound, strain, surface temperature, temperature, tilt, time, tvoc, uv, vapor pressure, velocity, +# vibration, voltage, water potential, water, weight, wifi ssid, wind direction, wind speed. +sensors: + - battery + - temperature + - co2 + - humidity + - potentiometer + +# Product and data sheet URLs (optional) +productURL: https://www.thermokon.de/direct/en-gb?path=%2F1%2F2%2F20&filter_show=1&q=&limit=18&filter_articles=&sbscf%3Asbscf1%2Fattr%2F8470[]=thermokon%3A%2F%2F{r%3D0%2Cb%3D0%2Cl%3Den_UK}%2F1%2F7%2F8%2F338%2F339%2F8470%2F10570 + +# Photos +photos: + main: novos-3-lrw.jpg \ No newline at end of file diff --git a/vendor/thermokon/thanos-evo-lrw.jpg b/thermokon/thanos-evo-lrw.jpg similarity index 100% rename from vendor/thermokon/thanos-evo-lrw.jpg rename to thermokon/thanos-evo-lrw.jpg diff --git a/thermokon/thanos-evo-lrw.yaml b/thermokon/thanos-evo-lrw.yaml new file mode 100644 index 0000000000..d30b98e5e0 --- /dev/null +++ b/thermokon/thanos-evo-lrw.yaml @@ -0,0 +1,50 @@ +name: Thanos Evo LRW +description: Full Touch Room Operating Unit for Controlling with optional wired BMS connection + +# Hardware versions (optional, use when you have revisions) +hardwareVersions: + - version: '1.0' + numeric: 1 + +# Firmware versions (at least one is mandatory) +firmwareVersions: + - # Firmware version + version: '1.0' + numeric: 1 + # Corresponding hardware versions (optional) + hardwareVersions: + - '1.0' + + # LoRaWAN Device Profiles per region + # Supported regions are EU863-870, US902-928, AU915-928, AS923, CN779-787, EU433, CN470-510, KR920-923, IN865-867, + # RU864-870 + profiles: + EU863-870: + # Optional identifier of the vendor of the profile. When you specify the vendorID, the profile is loaded from + # the vendorID's folder. This allows you to reuse profiles from module or LoRaWAN end device stack vendors. + # If vendorID is empty, the current vendor ID is used. In this example, the vendorID is the current vendor ID, + # which is verbose. + vendorID: thermokon + # Identifier of the profile (lowercase, alphanumeric with dashes, max 36 characters) + id: thermokon-1-profile + lorawanCertified: false + codec: thermokon-codec-ext +# Sensors that this device features (optional) +# Valid values are: +# 4-20 ma, accelerometer, altitude, analog input, auxiliary, barometer, battery, button, bvoc, co, co2, conductivity, +# current, digital input, dissolved oxygen, distance, dust, energy, gps, gyroscope, h2s, humidity, iaq, level, light, +# lightning, link, magnetometer, moisture, motion, no, no2, o3, particulate matter, ph, pir, pm2.5, pm10, potentiometer, +# power, precipitation, pressure, proximity, pulse count, pulse frequency, radar, rainfall, rssi, smart valve, snr, so2, +# solar radiation, sound, strain, surface temperature, temperature, tilt, time, tvoc, uv, vapor pressure, velocity, +# vibration, voltage, water potential, water, weight, wifi ssid, wind direction, wind speed. +sensors: + - temperature + - humidity + - co2 + - tvoc +# Product and data sheet URLs (optional) +productURL: https://www.thermokon.de/direct/en-gb?path=%2F1%2F2%2F20&filter_show=1&q=&limit=18&filter_articles=&sbscf%3Asbscf1%2Fattr%2F8470[]=thermokon%3A%2F%2F{r%3D0%2Cb%3D0%2Cl%3Den_UK}%2F1%2F7%2F8%2F338%2F339%2F8470%2F10570 + +# Photos +photos: + main: thanos-evo-lrw.jpg \ No newline at end of file diff --git a/thermokon/thermokon-1-profile.yaml b/thermokon/thermokon-1-profile.yaml new file mode 100644 index 0000000000..aa2819b567 --- /dev/null +++ b/thermokon/thermokon-1-profile.yaml @@ -0,0 +1,52 @@ +# Vendor profile ID, can be freely issued by the vendor +# This vendor profile ID is also used on the QR code for LoRaWAN devices, see +# https://lora-alliance.org/sites/default/files/2020-10/LoRa_Alliance_Vendor_ID_for_QR_Code.pdf +vendorProfileID: 923 + +# LoRaWAN MAC version: 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4 or 1.1 +macVersion: 1.0.4 +# LoRaWAN Regional Parameters version. Values depend on the LoRaWAN version: +# 1.0: TS001-1.0 +# 1.0.1: TS001-1.0.1 +# 1.0.2: RP001-1.0.2 or RP001-1.0.2-RevB +# 1.0.3: RP001-1.0.3-RevA +# 1.0.4: RP002-1.0.0 or RP002-1.0.1 +# 1.1: RP001-1.1-RevA or RP001-1.1-RevB +regionalParametersVersion: RP002-1.0.1 + +# Whether the end device supports join (OTAA) or not (ABP) +supportsJoin: true +# If your device is an ABP device (supportsJoin is false), uncomment the following fields: +# RX1 delay +#rx1Delay: 5 +# RX1 data rate offset +#rx1DataRateOffset: 0 +# RX2 data rate index +#rx2DataRateIndex: 0 +# RX2 frequency (MHz) +#rx2Frequency: 869.525 +# Factory preset frequencies (MHz) +#factoryPresetFrequencies: [868.1, 868.3, 868.5, 867.1, 867.3, 867.5, 867.7, 867.9] + +# Maximum EIRP +maxEIRP: 16 +# Whether the end device supports 32-bit frame counters +supports32bitFCnt: true + +# Whether the end device supports class B +supportsClassB: false +# If your device supports class B, uncomment the following fields: +# Maximum delay for the end device to answer a MAC request or confirmed downlink frame (seconds) +#classBTimeout: 60 +# Ping slot period (seconds) +#pingSlotPeriod: 128 +# Ping slot data rate index +#pingSlotDataRateIndex: 0 +# Ping slot frequency (MHz). Set to 0 if the band supports ping slot frequency hopping. +#pingSlotFrequency: 869.525 + +# Whether the end device supports class C +supportsClassC: false +# If your device supports class C, uncomment the following fields: +# Maximum delay for the end device to answer a MAC request or confirmed downlink frame (seconds) +#classCTimeout: 60 diff --git a/thermokon/thermokon-2-profile.yaml b/thermokon/thermokon-2-profile.yaml new file mode 100644 index 0000000000..847d80a93c --- /dev/null +++ b/thermokon/thermokon-2-profile.yaml @@ -0,0 +1,52 @@ +# Vendor profile ID, can be freely issued by the vendor +# This vendor profile ID is also used on the QR code for LoRaWAN devices, see +# https://lora-alliance.org/sites/default/files/2020-10/LoRa_Alliance_Vendor_ID_for_QR_Code.pdf +vendorProfileID: 923 + +# LoRaWAN MAC version: 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4 or 1.1 +macVersion: 1.0.2 +# LoRaWAN Regional Parameters version. Values depend on the LoRaWAN version: +# 1.0: TS001-1.0 +# 1.0.1: TS001-1.0.1 +# 1.0.2: RP001-1.0.2 or RP001-1.0.2-RevB +# 1.0.3: RP001-1.0.3-RevA +# 1.0.4: RP002-1.0.0 or RP002-1.0.1 +# 1.1: RP001-1.1-RevA or RP001-1.1-RevB +regionalParametersVersion: RP001-1.0.2-RevB + +# Whether the end device supports join (OTAA) or not (ABP) +supportsJoin: true +# If your device is an ABP device (supportsJoin is false), uncomment the following fields: +# RX1 delay +#rx1Delay: 5 +# RX1 data rate offset +#rx1DataRateOffset: 0 +# RX2 data rate index +#rx2DataRateIndex: 0 +# RX2 frequency (MHz) +#rx2Frequency: 869.525 +# Factory preset frequencies (MHz) +#factoryPresetFrequencies: [868.1, 868.3, 868.5, 867.1, 867.3, 867.5, 867.7, 867.9] + +# Maximum EIRP +maxEIRP: 16 +# Whether the end device supports 32-bit frame counters +supports32bitFCnt: true + +# Whether the end device supports class B +supportsClassB: false +# If your device supports class B, uncomment the following fields: +# Maximum delay for the end device to answer a MAC request or confirmed downlink frame (seconds) +#classBTimeout: 60 +# Ping slot period (seconds) +#pingSlotPeriod: 128 +# Ping slot data rate index +#pingSlotDataRateIndex: 0 +# Ping slot frequency (MHz). Set to 0 if the band supports ping slot frequency hopping. +#pingSlotFrequency: 869.525 + +# Whether the end device supports class C +supportsClassC: false +# If your device supports class C, uncomment the following fields: +# Maximum delay for the end device to answer a MAC request or confirmed downlink frame (seconds) +#classCTimeout: 60 diff --git a/thermokon/thermokon-codec-ext.js b/thermokon/thermokon-codec-ext.js new file mode 100644 index 0000000000..21f2848bcc --- /dev/null +++ b/thermokon/thermokon-codec-ext.js @@ -0,0 +1,323 @@ +var LPP_PARSER = 0x0000; +var LPP_DUMMY = 0x0001; +var LPP_TEMP = 0x0010; +var LPP_RHUM = 0x0011; +var LPP_CO2 = 0x0012; +var LPP_VOC = 0x0013; +var LPP_ATM_P = 0x0030; +var LPP_VISIBLE_LIGHT = 0x0040; +var LPP_OCCU0 = 0x0041; +var LPP_REED0 = 0x0050; +var LPP_VBAT = 0x0054; +var LPP_SETPOINT = 0x0063; +var LPP_VBAT_HI_RES = 0x8540; +var LPP_OCCU1 = 0x9410; +var LPP_REED1 = 0x9500; +var LPP_ENCODER = 0x9630; +var LPP_DEV_KEY = 0xC000; +var LPP_CMD = 0xC100; +var LPP_LEARN = 0xC103; +var LPP_BAT_TYPE = 0xC105; +var LPP_HEARTBEAT = 0xC106; +var LPP_MEAS_INTERVAL = 0xC108; +var LPP_CNT_MEAS = 0xC10A; +var LPP_BIN_LATENCY = 0xC10B; +var LPP_TLF_MODE = 0xC120; +var LPP_TLF_ONTIME = 0xC121; +var LPP_TLF_INTERVAL_0 = 0xC123; +var LPP_TLF_INTERVAL_1 = 0xC125; +var LPP_TLF_INTERVAL_2 = 0xC127; +var LPP_TLF_INTERVAL_3 = 0xC129; +var LPP_TLF_INTERVAL_4 = 0xC12B; +var LPP_TLF_INTERVAL_5 = 0xC12D; +var LPP_LED_MODE = 0xC134; +var LPP_LED_ONTIME = 0xC135; +var LPP_LED_INTERVAL_0 = 0xC136; +var LPP_LED_INTERVAL_1 = 0xC137; +var LPP_LED_INTERVAL_2 = 0xC138; +var LPP_LED_INTERVAL_3 = 0xC139; +var LPP_FORCED_UPLINK = 0xC230; +var LPP_EO_CHIP_ID = 0xC402; +var LPP_EO_BASE_ID = 0xC404; + +function u16_to_s16(u16) { + var s16 = u16&0xFFFF; + if (0x8000 & s16){s16 = - (0x010000 - s16);} + return s16; +} +function u8_to_s8(u8) { + var s8=u8&0xFF; + if (0x80 & s8) {s8 = - (0x0100 - s8);} + return s8; +} + +function DecodeLPPPayload(data) { + var obj = {}; + var dummy_cnt = 0; + + for(i=0;i> 1; + break; + case LPP_REED0: + obj.REED0_STATE = data[i] & 0x01; + obj.REED0_CNT = data[i] >> 1; + break; + case LPP_VBAT: + obj.VBAT = data[i] / (1.0/20); + break; + case LPP_SETPOINT: + obj.SETPOINT = data[i] / 1; + break; + case LPP_VBAT_HI_RES: + obj.VBAT_HI_RES = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_OCCU1: + obj.OCCU1 = data[i] / 1; + break; + case LPP_REED1: + obj.REED1 = data[i] / 1; + break; + case LPP_ENCODER: + obj.ENCODER_DIR = data[i] & 0x01; + obj.ENCODER_VAL = data[i] >> 1; + break; + case LPP_DEV_KEY: + obj.DEV_KEY = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_CMD: + obj.CMD = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LEARN: + obj.LEARN = data[i] / 1; + break; + case LPP_BAT_TYPE: + obj.BAT_TYPE = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_HEARTBEAT: + obj.HEARTBEAT = (data[i]<<8 | data[i+1]) / (1.0/60000); + i++; + break; + case LPP_MEAS_INTERVAL: + obj.MEAS_INTERVAL = (data[i]<<8 | data[i+1]) / (1.0/1000); + i++; + break; + case LPP_CNT_MEAS: + obj.CNT_MEAS = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_BIN_LATENCY: + obj.BIN_LATENCY = (data[i]<<8 | data[i+1]) / (1.0/1000); + i++; + break; + case LPP_TLF_MODE: + obj.TLF_MODE = data[i] / 1; + break; + case LPP_TLF_ONTIME: + obj.TLF_ONTIME = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_0: + obj.TLF_INTERVAL_0 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_1: + obj.TLF_INTERVAL_1 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_2: + obj.TLF_INTERVAL_2 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_3: + obj.TLF_INTERVAL_3 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_4: + obj.TLF_INTERVAL_4 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_5: + obj.TLF_INTERVAL_5 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LED_MODE: + obj.LED_MODE = data[i] / 1; + break; + case LPP_LED_ONTIME: + obj.LED_ONTIME = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LED_INTERVAL_0: + obj.LED_INTERVAL_0 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LED_INTERVAL_1: + obj.LED_INTERVAL_1 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LED_INTERVAL_2: + obj.LED_INTERVAL_2 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LED_INTERVAL_3: + obj.LED_INTERVAL_3 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_FORCED_UPLINK: + obj.FORCED_UPLINK = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_EO_CHIP_ID: + obj.EO_CHIP_ID = (data[i]<<24 | data[i+1]<<16 | data[i+2]<<8 | data[i+3]) / 1; + i+=3; + break; + case LPP_EO_BASE_ID: + obj.EO_BASE_ID = (data[i]<<24 | data[i+1]<<16 | data[i+2]<<8 | data[i+3]) / 1; + i+=3; + break; + default: //somthing is wrong with data + i = data.length; + break; + } + } + return obj; +} + +var HR_OCCU = 100; +var HR_ECO = 101; +var HR_SETPOINT = 103; +var HR_FAN = 104; + +var HR_LIGHT_SCENE = 199; +var HR_LIGHT1 = 200; +var HR_LIGHT2 = 201; +var HR_SHUTTER1 = 300; +var HR_SLAT1 = 301; +var HR_SHUTTER2 = 302; +var HR_SLAT2 = 303; + +var HR_TEMP = 500; +var HR_RHUM = 501; +var HR_CO2 = 505; +var HR_VOC = 506; + + +function DecodeHR(data) { + var obj = {}; + var dummy_cnt = 0; + + for(i=0;i> 1; + break; + case LPP_REED0: + obj.REED0_STATE = data[i] & 0x01; + obj.REED0_CNT = data[i] >> 1; + break; + case LPP_CONDENSATION: + obj.CONDENSATION_STATE = (data[i] >>> 7); + obj.CONDENSATION_RAW = (u16_to_s16(data[i] << 8 | data[i+1]) / 1)&0x0FFF; + i++; + break; + case LPP_VBAT: + obj.VBAT = data[i] / (1.0/20); + break; + case LPP_SETPOINT: + obj.SETPOINT = data[i] / 1; + break; + case LPP_VBAT_HI_RES: + obj.VBAT_HI_RES = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_OCCU1: + obj.OCCU1_STATE = data[i] & 0x01; + obj.OCCU1_CNT = data[i] >> 1; + break; + case LPP_REED1: + obj.REED1_STATE = data[i] & 0x01; + obj.REED1_CNT = data[i] >> 1; + break; + case LPP_CONDENSATION_RAW: + obj.CONDENSATION_RAW = u16_to_s16(data[i] << 8 | data[i+1]) / 1; + i++; + break; + case LPP_DEV_KEY: + obj.DEV_KEY = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_CMD: + obj.CMD = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LEARN: + obj.LEARN = data[i] / 1; + break; + case LPP_BAT_TYPE: + obj.BAT_TYPE = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_HEARTBEAT: + obj.HEARTBEAT = (data[i]<<8 | data[i+1]) / (1.0/60000); + i++; + break; + case LPP_MEAS_INTERVAL: + obj.MEAS_INTERVAL = (data[i]<<8 | data[i+1]) / (1.0/1000); + i++; + break; + case LPP_CNT_MEAS: + obj.CNT_MEAS = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_BIN_LATENCY: + obj.BIN_LATENCY = (data[i]<<8 | data[i+1]) / (1.0/1000); + i++; + break; + case LPP_TLF_MODE: + obj.TLF_MODE = data[i] / 1; + break; + case LPP_TLF_ONTIME: + obj.TLF_ONTIME = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_0: + obj.TLF_INTERVAL_0 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_1: + obj.TLF_INTERVAL_1 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_2: + obj.TLF_INTERVAL_2 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_3: + obj.TLF_INTERVAL_3 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_4: + obj.TLF_INTERVAL_4 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_TLF_INTERVAL_5: + obj.TLF_INTERVAL_5 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LED_MODE: + obj.LED_MODE = data[i] / 1; + break; + case LPP_LED_ONTIME: + obj.LED_ONTIME = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LED_INTERVAL_0: + obj.LED_INTERVAL_0 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LED_INTERVAL_1: + obj.LED_INTERVAL_1 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LED_INTERVAL_2: + obj.LED_INTERVAL_2 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_LED_INTERVAL_3: + obj.LED_INTERVAL_3 = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + case LPP_FORCED_UPLINK: + obj.FORCED_UPLINK = (data[i]<<8 | data[i+1]) / 1; + i++; + break; + default: //somthing is wrong with data + i = data.length; + break; + } + } + return obj; +} + +function decodeUplink(input) { + var warnings = []; + warnings.push(); + var data = DecodeLPPPayload(input.bytes); + return {data,warnings}; +} diff --git a/thermokon/thermokon-codec.yaml b/thermokon/thermokon-codec.yaml new file mode 100644 index 0000000000..2a39c57dad --- /dev/null +++ b/thermokon/thermokon-codec.yaml @@ -0,0 +1,4 @@ +# Uplink decoder decodes binary data uplink into a JSON object (optional) +# For documentation on writing encoders and decoders, see: https://thethingsstack.io/integrations/payload-formatters/javascript/ +uplinkDecoder: + fileName: thermokon-codec.js