Skip to content

Commit

Permalink
Revert "Merge branch 'dev' into object_creation_fix"
Browse files Browse the repository at this point in the history
This reverts commit 1177a28, reversing
changes made to b61cb37.
  • Loading branch information
Scrounger committed Nov 4, 2023
1 parent 1177a28 commit 5c1d159
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 149 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ Or you can use the tab **files** to upload the file. (see image below)\
-->

### **WORK IN PROGRESS**

- (Scounger) bug fix: objects only if necessary
- (Scrounger) Calculate distance between ioBroker and tracker

### 0.1.2 (2023-02-24)

Expand Down
46 changes: 0 additions & 46 deletions build/lib/object_definition.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions build/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"common": {
"name": "tractive-gps",
"version": "0.1.3",
"version": "0.1.2",
"news": {
"0.1.2": {
"en": "Dependencies updated\nUI updated",
Expand Down
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.tractive-gps",
"version": "0.1.3",
"version": "0.1.2",
"description": "This adapter allows you to connect to the Tractive GPS service and retrieve the location of your pets.",
"author": {
"name": "xXBJXx",
Expand Down Expand Up @@ -31,8 +31,7 @@
"cron": "^2.2.0",
"dayjs": "^1.11.7",
"react-leaflet": "3.2.5",
"source-map-support": "^0.5.21",
"geo-position.ts": "^1.4.1"
"source-map-support": "^0.5.21"
},
"devDependencies": {
"@alcalzone/release-script": "^3.5.9",
Expand Down
46 changes: 0 additions & 46 deletions src/lib/object_definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,42 +101,6 @@ export const stateAttrb: StateAttr = {
read: true,
write: false,
},
prioritized_zone_entered_at: {
name: 'Prioritized zone entered at',
desc: 'Prioritized zone entered at',
type: 'number',
role: 'value',
def: null,
read: true,
write: false,
},
prioritized_zone_last_seen_at: {
name: 'Prioritized zone last seen at',
desc: 'Prioritized zone last seen at',
type: 'number',
role: 'value',
def: null,
read: true,
write: false,
},
prioritized_zone_type: {
name: 'Prioritized zone type',
desc: 'Prioritized zone type',
type: 'string',
role: 'value',
def: null,
read: true,
write: false,
},
prioritized_zone_id: {
name: 'Prioritized zone id',
desc: 'Prioritized zone id',
type: 'string',
role: 'value',
def: null,
read: true,
write: false,
},
hw_status: {
name: 'Hardware Status',
desc: 'Hardware Status of the device',
Expand Down Expand Up @@ -371,16 +335,6 @@ export const stateAttrb: StateAttr = {
read: true,
write: false,
},
distance: {
name: 'Distance',
desc: 'Distance to ioBroker',
type: 'number',
role: 'value.gps.distance',
def: 0,
unit: 'm',
read: true,
write: false,
},
speed: {
name: 'Speed',
desc: 'Speed in meters per second',
Expand Down
21 changes: 0 additions & 21 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as utils from '@iobroker/adapter-core';
// import 'source-map-support/register.js';
import axios from 'axios';
import { CronJob } from 'cron';
import { GeoPosition } from 'geo-position.ts';
import sourceMapSupport from 'source-map-support';
import { decrypt, encrypt } from './lib/Helper';
import { stateAttrb } from './lib/object_definition';
Expand Down Expand Up @@ -200,21 +199,6 @@ class TractiveGPS extends utils.Adapter {
val: value[1],
ack: true,
});

let sysConfig = await this.getForeignObjectAsync('system.config');

if (sysConfig && sysConfig.common && sysConfig.common.longitude && sysConfig.common.latitude) {
let sysPoint = new GeoPosition(sysConfig.common.latitude, sysConfig.common.longitude);
let petPoint = new GeoPosition(value[0], value[1]);

await this.setStateAsync(`${device._id}.device_pos_report.distance`, {
val: Number(sysPoint.Distance(petPoint).toFixed(0)),
ack: true,
});
} else {
this.writeLog('No gps coordinates of system found!', "warn");
}

} else {
if (typeof value === 'object' && value !== null) {
await this.setStateAsync(`${device._id}.device_pos_report.${key}`, {
Expand Down Expand Up @@ -432,11 +416,6 @@ class TractiveGPS extends utils.Adapter {
common: stateAttrb['longitude'],
native: {},
});
await this.extendObjectAsync(`${device._id}.device_pos_report.distance`, {
type: 'state',
common: stateAttrb['distance'],
native: {},
});
} else {
await this.setObjectNotExistsAsync(`${device._id}.device_pos_report.${key}`, {
type: 'state',
Expand Down
4 changes: 0 additions & 4 deletions src/types/TractiveDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ export interface Tracker {
charging_state: string;
battery_state: string;
power_saving_zone_id: string | null;
prioritized_zone_entered_at: number | null;
prioritized_zone_last_seen_at: number | null;
prioritized_zone_type: string,
prioritized_zone_id: string
}

export interface DeviceHwReport {
Expand Down

0 comments on commit 5c1d159

Please sign in to comment.