Skip to content

Commit

Permalink
location lat and lon remooved
Browse files Browse the repository at this point in the history
  • Loading branch information
BenAhrdt committed Mar 25, 2024
1 parent e940b85 commit 26ae43f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ For now there is documentation in English here: https://wiki.hafenmeister.de
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**
* (BenAhrdt) lat & lon for location of sensors

### 1.0.1 (2024-03-25)
* (BenAhrdt) support 2's complement

Expand Down
19 changes: 2 additions & 17 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,21 +361,6 @@ class Lorawan extends utils.Adapter {
}
}
}
// Get lon and lat for location of device
if(options && options.withLocation){
changeInfo.lat = 0;
changeInfo.lon = 0;
const myLat = `${changeInfo?.objectStartDirectory}.${this.messagehandler?.directoryhandler.reachableSubfolders.uplinkDecoded}.lat`;
const deviceLat = await this.getStateAsync(myLat);
if(deviceLat){
changeInfo.lat = deviceLat.val;
}
const myLon = `${changeInfo?.objectStartDirectory}.${this.messagehandler?.directoryhandler.reachableSubfolders.uplinkDecoded}.lon`;
const deviceLon = await this.getStateAsync(myLon);
if(deviceLon){
changeInfo.lon = deviceLon.val;
}
}
}
this.log.silly(`changeinfo is ${JSON.stringify(changeInfo)}.`);
return changeInfo;
Expand All @@ -400,7 +385,7 @@ class Lorawan extends utils.Adapter {
for(const adapterObject of Object.values(adapterObjects)){
if(adapterObject.type === "device"){
if(adapterObject._id.indexOf(deviceUI) !== -1){
changeInfo = await this.getChangeInfo(`${adapterObject._id}.${subId}`,{withLocation:true});
changeInfo = await this.getChangeInfo(`${adapterObject._id}.${subId}`);
break;
}
}
Expand All @@ -425,7 +410,7 @@ class Lorawan extends utils.Adapter {
if(obj.message.deviceEUI){
const changeInfo = await this.getChangeInfoFromDeviceEUI(obj.message.deviceEUI,`${this.messagehandler?.directoryhandler.reachableSubfolders.configuration}.devicetype`);
if(changeInfo){
result = {applicationId: changeInfo.applicationId, applicationName: changeInfo.applicationName, usedApplicationName: changeInfo.usedApplicationName, deviceEUI: changeInfo.deviceEUI, deviceId: changeInfo.deviceId, usedDeviceId: changeInfo.usedDeviceId, deviceType: changeInfo.deviceType, lat:changeInfo.lat, lon:changeInfo.lon, received:obj.message};
result = {applicationId: changeInfo.applicationId, applicationName: changeInfo.applicationName, usedApplicationName: changeInfo.usedApplicationName, deviceEUI: changeInfo.deviceEUI, deviceId: changeInfo.deviceId, usedDeviceId: changeInfo.usedDeviceId, deviceType: changeInfo.deviceType, received:obj.message};
}
else{
result = {error:true, message:"No device found", received:obj.message};
Expand Down

0 comments on commit 26ae43f

Please sign in to comment.