This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers. For more details and for information how to disable the error reporting see Sentry-Plugin Documentation! Sentry reporting is used starting with js-controller 3.0.
This is an ioBroker adapter for processing location information messages which should contain a user, a geo-position and a timestamp as minimum. The adapters analyzes whether the location information is within a radius around the location configuration of ioBroker or optional other places.
There is just one mandatory configuration value: the radius (meters) which will be used to identify the current location of a user. The location of ioBroker is used to identify users being "at home", other places can be added as part of the configuration.
- Radius (mandatory) should be the radius in meters used to check whether the user is at a specific place (home or custom).
- Name for home can be used to set a custom name for the home place.
- Google Maps API key will be used for enabling geo-coding. A missing API key will be fetched from a configured vis-map instance (if available) when configuration page has been opened.
- Google Maps Geocoding can be activated to get a real address and an elevation for a provided geo-position.
- Places is a flexible list containing custom places where each place should have valid values for name, latitude and longitude.
- Users is a flexible list containing user mappings.
To process location update just send a message using the following syntax:
// send a message to all instances of places adapter
sendTo('locations', {
user: "Name of person",
latitude: 50.9576191,
longitude: 6.8272409,
timestamp: 1520932471
});
// send a message to a specific instance of places adapter adapter
sendTo('locations.0', {
user: "Name of person",
latitude: 50.9576191,
longitude: 6.8272409,
timestamp: 1520932471
});
// send a message to a specific instance and define a callback
sendTo('locations.0', {
user: "Name of person",
latitude: 50.9576191,
longitude: 6.8272409,
timestamp: 1520932471
}, function (res) { log(JSON.stringify(res)); });
The following block shows how response messages look like. For each value the ioBroker object tree has an according state.
{
"user": "Name of person", // name of person (may have been replaced by user mapping)
"latitude": 50.9576191,
"longitude": 6.8272409,
"timestamp": 1520932471000,
"date": "2018-03-13 10:14:31", // date extracted from timestamp
"atHome": false, // true if inside the configured radius around ioBroker
"homeDistance": 104898, // distance in meters between position and ioBroker
"name": "", // name of place found within the configuration
"address": "", // readable address (if geocoding is active)
"elevation": "", // elevation in meters (if geocoding is active)
}
Add a custom services xyz under White list for Services.
Change the mode to HTTP Private and use the following address as Host : https://iobroker.pro/service/custom_xyz/
On the tab Integration you have to select the instance of the cloud adapter and xyz as service. The adapter will listen to incoming requests for the service and start the processing.
Enable the option to store raw requests.
Create a short script with a subscription to the raw request, f.e. from telegram.0.communicate.requestRaw, and send a new request object to iobroker.places (or an instance of it):
on({id: "telegram.0.communicate.requestRaw", change: "ne"}, function (obj) {
var data = JSON.parse(obj.newState.val);
if (data.from && data.location) {
sendTo('places.0', {
user: data.from.first_name,
latitude: data.location.latitude,
longitude: data.location.longitude,
timestamp: data.date
}, function (res) { log('places analyzed telegram position as: ' + JSON.stringify(res)); });
}
});
The implementation is partly based on dschaedls ioBroker.geofency adapter. The logo has been taken from Free Icons PNG and has been modified to have a transparent background.
- (Apollon77) Fix personsAtHome and anybodyAtHome states
- (Apollon77) Allow (again?) to consume external subscribed state value independently of ack flag
- (Basgo) Correctly set ack flag
- (Apollon77) Add Sentry for crash reporting
- (bluefox) Updated packages
- (bluefox) Refactoring
- (BasGo) Added compact mode, replaced integration of iobroker.cloud with iobroker.iot
- (bluefox) Error with blockly was fixed
- (BasGo) Added handling for invalid route details
- (BasGo) Changed implementation to use promises
- (BasGo) Added route details for driving home
- (BasGo) Extended help texts
- (BasGo) Added optional subscription for cloud adapter
- (BasGo) UI fixes
- (BasGo) Configuration dialog extended
- (BasGo) Google Maps can be used for configuration
- (BasGo) Geocoding can be activated
- (BasGo) Added user mappings
- (BasGo) Optimized state handling
- (BasGo) Added option to clear array
- (BasGo) Added check for newer entries
- (BasGo) Extended configuration
- (BasGo) Materialized admin page
- (BasGo) Fixed some smaller issues
- (BasGo) Initial release
This adapter is licensed under the MIT License which is part of this repository.
Copyright (c) 2018-2022 BasGo [email protected]