added more devicestats

master
cheetah 4 years ago
parent 7a06b578de
commit b6849baa4c

@ -36,6 +36,9 @@
<td :colspan="headers.length">
<section v-if="item.deviceType == 'birdyslim'">
<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.rssi">POCSAG RSSI: -{{ item.rssi }}dBm</pre>
<pre v-if="!!item.gps">GPS Position:

@ -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,

@ -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

Loading…
Cancel
Save