diff --git a/html_main/index.html b/html_main/index.html index 1a07b38..1609867 100644 --- a/html_main/index.html +++ b/html_main/index.html @@ -36,6 +36,9 @@
Device ID: {{ item.deviceID }}
+
Powered On: {{ item.poweredOn }}
+
Charging: {{ item.isCharging }}
+
Battery: {{ item.battery }}
Last Seen: {{ item.lastSeen }}
POCSAG RSSI: -{{ item.rssi }}dBm
GPS Position:
diff --git a/types/connectors/LoRaWANConnector.js b/types/connectors/LoRaWANConnector.js
index 1aa3bbf..48bbad6 100644
--- a/types/connectors/LoRaWANConnector.js
+++ b/types/connectors/LoRaWANConnector.js
@@ -25,7 +25,7 @@ class LoRaWANConnector extends Connector {
   async onMQTTMessage(topic, message) {
     //if (topic.indexOf('/up') > -1) return
     const json = JSON.parse(Buffer.from(message).toString('utf-8'))
-    console.log(topic, json)
+    console.log(topic)
     if (!!json.uplink_message) { // TTN v3
       this.connectorRegistry.events.emit('response', {
         ...json.uplink_message.decoded_payload,
diff --git a/types/devices/BirdySlim.js b/types/devices/BirdySlim.js
index ecc206c..6e0dd16 100644
--- a/types/devices/BirdySlim.js
+++ b/types/devices/BirdySlim.js
@@ -23,8 +23,11 @@ class BirdySlim extends PagerDevice {
             const stateSet = {
                 lastSeen: data.date
             }
-            // If we have a Battery Measurement, we should store it
+            // If we have a Battery Measurement or other Power Events, we should store it
             if (!!data.battery) stateSet.battery = data.battery/1e1
+            if (data.hasOwnProperty('isCharging')) stateSet.isCharging = data.isCharging
+            if (data.hasOwnProperty('poweredOn')) stateSet.poweredOn = data.poweredOn
+    
             // the same if we have an rssi measurement
             if (!!data.rssi) stateSet.rssi = data.rssi
             // and if we have the 3 components of a GPS Block
@@ -34,6 +37,7 @@ class BirdySlim extends PagerDevice {
                 longitude: data.longitude,
             }
             stateSet.lastLoRaPacket = data.metadata
+            console.log(data, stateSet)
             /*if (!!data.metadata && !!data.metadata.uplink_message.rx_metadata) {
                 const rx_metadata = data.metadata.uplink_message.rx_metadata
                 
@@ -61,12 +65,12 @@ class BirdySlim extends PagerDevice {
                         })
                     }
                     break;
-                    case 'sos':
-                        stateSet.sos = {
-                            sos: data.sos,
-                            date: data.date,
-                        }
-                    break;
+                case 'sos':
+                    stateSet.sos = {
+                        sos: data.sos,
+                        date: data.date,
+                    }
+                break;
             }
             require('../DeviceRegistry').stateSet(this.name, data.device_id, stateSet) 
             return true