added more devicestats

master
cheetah 4 years ago
parent 7a06b578de
commit b6849baa4c

@ -36,6 +36,9 @@
<td :colspan="headers.length"> <td :colspan="headers.length">
<section v-if="item.deviceType == 'birdyslim'"> <section v-if="item.deviceType == 'birdyslim'">
<pre>Device ID: {{ item.deviceID }}</pre> <pre>Device ID: {{ item.deviceID }}</pre>
<pre v-if="!!item.poweredOn">Powered On: {{ item.poweredOn }}</pre>
<pre v-if="!!item.isCharging">Charging: {{ item.isCharging }}</pre>
<pre v-if="!!item.battery">Battery: {{ item.battery }}</pre>
<pre v-if="!!item.lastSeen">Last Seen: {{ item.lastSeen }}</pre> <pre v-if="!!item.lastSeen">Last Seen: {{ item.lastSeen }}</pre>
<pre v-if="!!item.rssi">POCSAG RSSI: -{{ item.rssi }}dBm</pre> <pre v-if="!!item.rssi">POCSAG RSSI: -{{ item.rssi }}dBm</pre>
<pre v-if="!!item.gps">GPS Position: <pre v-if="!!item.gps">GPS Position:

@ -25,7 +25,7 @@ class LoRaWANConnector extends Connector {
async onMQTTMessage(topic, message) { async onMQTTMessage(topic, message) {
//if (topic.indexOf('/up') > -1) return //if (topic.indexOf('/up') > -1) return
const json = JSON.parse(Buffer.from(message).toString('utf-8')) const json = JSON.parse(Buffer.from(message).toString('utf-8'))
console.log(topic, json) console.log(topic)
if (!!json.uplink_message) { // TTN v3 if (!!json.uplink_message) { // TTN v3
this.connectorRegistry.events.emit('response', { this.connectorRegistry.events.emit('response', {
...json.uplink_message.decoded_payload, ...json.uplink_message.decoded_payload,

@ -23,8 +23,11 @@ class BirdySlim extends PagerDevice {
const stateSet = { const stateSet = {
lastSeen: data.date 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.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 // the same if we have an rssi measurement
if (!!data.rssi) stateSet.rssi = data.rssi if (!!data.rssi) stateSet.rssi = data.rssi
// and if we have the 3 components of a GPS Block // and if we have the 3 components of a GPS Block
@ -34,6 +37,7 @@ class BirdySlim extends PagerDevice {
longitude: data.longitude, longitude: data.longitude,
} }
stateSet.lastLoRaPacket = data.metadata stateSet.lastLoRaPacket = data.metadata
console.log(data, stateSet)
/*if (!!data.metadata && !!data.metadata.uplink_message.rx_metadata) { /*if (!!data.metadata && !!data.metadata.uplink_message.rx_metadata) {
const rx_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; break;
case 'sos': case 'sos':
stateSet.sos = { stateSet.sos = {
sos: data.sos, sos: data.sos,
date: data.date, date: data.date,
} }
break; break;
} }
require('../DeviceRegistry').stateSet(this.name, data.device_id, stateSet) require('../DeviceRegistry').stateSet(this.name, data.device_id, stateSet)
return true return true

Loading…
Cancel
Save