Skip to content

Commit

Permalink
0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyWinkler committed Dec 19, 2023
1 parent d027de4 commit 47d4b0e
Show file tree
Hide file tree
Showing 22 changed files with 922 additions and 83 deletions.
12 changes: 10 additions & 2 deletions .homeychangelog.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"0.0.1": {
"en": "Initial release",
"de": "Initiales Release"
"en": "Initial alpha release",
"de": "Initiales Alpha-Release"
},
"0.0.2": {
"en": "New device images",
"de": "Neue Gerätebilder"
},
"0.0.3": {
"en": "Beta updates",
"de": "Neue Gerätebilder"
}
}
11 changes: 6 additions & 5 deletions .homeycompose/app.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"id": "com.tesla.car",
"version": "0.0.1",
"version": "0.0.3",
"compatibility": ">=5.0.0",
"platforms": ["local"],
"sdk": 3,
"name": {
"en": "Tesla",
"de": "Tesla"
},
"description": {
"en": "Tesla Vehicle",
"de": "Tesla Fahrzeug",
"nl": "Tesla Voertuig"
},
"description": {
"en": "Zero emissions. Zero compromises.",
"de": "Keine Emissionen. Keine Kompromisse.",
"nl": "Geen uitstoot. Geen compromis."
},
"tags": {
"en": ["Tesla", "car", "charger", "charging"],
"de": ["Tesla", "Auto", "Fahrzeug", "Lader", "Laden"],
Expand Down
2 changes: 1 addition & 1 deletion .homeycompose/capabilities/measure_drive_speed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "number",
"title": {
"en": "Speed",
"de": "Geschrindigkeit",
"de": "Geschwindigkeit",
"nl": "Snelheid"
},
"units": {
Expand Down
1 change: 1 addition & 0 deletions .homeycompose/capabilities/measure_location_latitude.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"de": "Breitengrad",
"nl": "Breedtegraad"
},
"decimals": 8,
"insights": true,
"getable": true,
"setable": false,
Expand Down
1 change: 1 addition & 0 deletions .homeycompose/capabilities/measure_location_longitude.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"de": "Längengrad",
"nl": "Lengtegraad"
},
"decimals": 8,
"insights": true,
"getable": true,
"setable": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"nl": "Coördinaten zijn achtergelaten of bereikt"
},
"titleFormatted": {
"en": "Coordinates have been [[action]]: Latitude [[latitude]] and Longitude [[longitude]] or GoogleMaps URL [[url]] with tolerance [[distance]] m",
"de": "Koordinaten wurden [[action]]: Breitengrad [[latitude]] und Längengrad [[longitude]] oder GoogleMaps URL [[url]] mit Toleranz [[distance]] m",
"nl": "Coördinaten zijn [[action]]: Breedtegraad [[latitude]] en Lengtegraad [[longitude]] of GoogleMaps URL [[url]], met tolerantie [[distance]] m"
"en": "Coordinates have been [[action]]: Longitude [[longitude]] and Latitude [[latitude]] or GoogleMaps URL [[url]] with tolerance [[distance]] m",
"de": "Koordinaten wurden [[action]]: Längengrad [[longitude]] und Breitengrad [[latitude]] oder GoogleMaps URL [[url]] mit Toleranz [[distance]] m",
"nl": "Coördinaten zijn [[action]]: Lengtegraad [[longitude]] en Breedtegraad [[latitude]] of GoogleMaps URL [[url]], met tolerantie [[distance]] m"
},
"hint": {
"en": "The flow is triggered when the specified coordinates (specified as latitude/longitude or GoogleMaps short URL) are reached or left. The tolerance specifies the radius of the geofence area in meters.",
"de": "Der Flow wird ausgelöst, wenn die angebenen Koordinaten (angegben als Breitengrat/Längengrad oder GoogleMaps-Kurz-URL) erreicht oder verlassen werden. Die Toleranz gibt Radius des Geofence-Bereichs in Metern an.",
"nl": "De stroom wordt geactiveerd wanneer de opgegeven coördinaten (gespecificeerd als breedtegraad/lengtegraad of korte URL van GoogleMaps) worden bereikt of verlaten. De tolerantie specificeert de straal van het geofencegebied in meters."
"en": "The flow is triggered when the specified coordinates (specified as longitude/latitude or GoogleMaps short URL) are reached or left. The tolerance specifies the radius of the geofence area in meters.",
"de": "Der Flow wird ausgelöst, wenn die angebenen Koordinaten (angegben als Längengrad/Breitengrat oder GoogleMaps-Kurz-URL) erreicht oder verlassen werden. Die Toleranz gibt Radius des Geofence-Bereichs in Metern an.",
"nl": "De stroom wordt geactiveerd wanneer de opgegeven coördinaten (gespecificeerd als lengtegraad/breedtegraad of korte URL van GoogleMaps) worden bereikt of verlaten. De tolerantie specificeert de straal van het geofencegebied in meters."
},
"tokens": [
{
Expand Down
135 changes: 135 additions & 0 deletions .homeycompose/flow/triggers/location_left_or_reached.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"title": {
"en": "Location has been left or reached",
"de": "Standort wurde verlassen oder erreicht",
"nl": "Locatie is verlaten of bereikt"
},
"titleFormatted": {
"en": "Location [[location]] has been [[action]] with tolerance [[distance]] m",
"de": "Standort [[location]] wurde [[action]] mit Toleranz [[distance]] m",
"nl": "Locatie [[location]] is [[action]] met tolerantie [[distance]] m"
},
"hint": {
"en": "The flow is triggered when the specified location (specified in device settings) ais reached or left. The tolerance specifies the radius of the geofence area in meters.",
"de": "Der Flow wird ausgelöst, wenn der angebene Standort (angegben in den Geräteeinstellungen) erreicht oder verlassen werden. Die Toleranz gibt Radius des Geofence-Bereichs in Metern an.",
"nl": "De Flow wordt geactiveerd wanneer de opgegeven locatie (opgegeven in de apparaatinstellingen) wordt bereikt of verlaten. De tolerantie specificeert de straal van het geofencegebied in meters."
},
"tokens": [
{
"name": "location_latitude",
"type": "number",
"title": {
"en": "Latitude",
"de": "Breitengrad",
"nl": "Breedtegraad"
}
},
{
"name": "location_longitude",
"type": "number",
"title": {
"en": "Longitude",
"de": "Längengrad",
"nl": "Lengtegraad"
}
},
{
"name": "location_name",
"type": "string",
"title": {
"en": "Location name",
"de": "Standortname",
"nl": "Plaats naam"
}
},
{
"name": "location_street",
"type": "string",
"title": {
"en": "Street",
"de": "Straße",
"nl": "Straat"
}
},
{
"name": "location_city",
"type": "string",
"title": {
"en": "City",
"de": "Ort",
"nl": "Plaats"
}
},
{
"name": "location_postcode",
"type": "string",
"title": {
"en": "Postcode",
"de": "Postleitzahl",
"nl": "postcode"
}
},
{
"name": "location_country",
"type": "string",
"title": {
"en": "Country",
"de": "Land",
"nl": "Land"
}
}
],
"args": [
{
"name": "action",
"type": "dropdown",
"values": [
{
"id": "reached",
"title": {
"en": "reached",
"de": "erreicht",
"nl": "bereikt"
}
},
{
"id": "left",
"title": {
"en": "left",
"de": "verlassen",
"nl": "verlaat"
}
}
]
},
{
"name": "location",
"type": "autocomplete",
"title": {
"en": "Location",
"de": "Standort",
"nl": "Plaats"
}
},
{
"name": "distance",
"type": "number",
"required": false,
"title": {
"en": "Distance (m)",
"de": "Entfernung (m)",
"nl": "Afstand (m)"
},
"placeholder": {
"en": "Default: 100m",
"de": "Standard: 100m",
"nl": "Standaard: 100m"
}
},
{
"name": "device",
"type": "device",
"filter": "driver_id=location"
}
]
}
2 changes: 0 additions & 2 deletions README.de.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Keine Emissionen. Keine Kompromisse.

Protokolliere deine Fahrzeugdaten, klimatisiere vor der Fahrt oder optimiere das Laden…
Unzählige Möglichkeiten, deinen Tesla noch smarter zu machen und in dein Smarthome zu integrieren.

Expand Down
2 changes: 0 additions & 2 deletions README.nl.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Geen uitstoot. Geen compromis.

Registreer uw voertuiggegevens, airconditioning voordat u gaat rijden of optimaliseer het opladen...
Ontelbare manieren om uw Tesla nog slimmer te maken en te integreren in uw smart home.

Expand Down
2 changes: 0 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Zero emissions. Zero compromises.

Log your vehicle data, air conditioning before driving or optimize charging...
Countless ways to make your Tesla even smarter and integrate it into your smart home.

Expand Down
30 changes: 26 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ module.exports = class TeslaApp extends TeslaOAuth2App {
await super.onOAuth2Init();

await this._initFlowActions();
await this._initFlowTriggers();
}

// FLOW ACTIONS ==============================================================================
async _initFlowActions(){

this._flowActionRefresh = this.homey.flow.getActionCard('refresh');
this._flowActionRefresh.registerRunListener(async (args, state) => {
this.homey.flow.getActionCard('refresh')
.registerRunListener(async (args, state) => {
await args.device.flowActionRefresh();
});

this._flowActionWakeUp = this.homey.flow.getActionCard('wake_up');
this._flowActionWakeUp.registerRunListener(async (args, state) => {
this.homey.flow.getActionCard('wake_up')
.registerRunListener(async (args, state) => {
await args.device.flowActionWakeUp( (args.wait=='wait') );
});

Expand All @@ -41,4 +42,25 @@ module.exports = class TeslaApp extends TeslaOAuth2App {

}

// FLOW TRIGGER ======================================================================================
async _initFlowTriggers(){
this._flowTriggerLocationChanged = this.homey.flow.getDeviceTriggerCard('location_changed');

this.homey.flow.getDeviceTriggerCard('location_coordinates_left_or_reached')
.registerRunListener(async (args, state) => {
return (await args.device.flowTriggerLocationCoordinatesRunListener(args) == args.action);
});

this.homey.flow.getDeviceTriggerCard('location_left_or_reached')
.registerRunListener(async (args, state) => {
return (await args.device.flowTriggerLocationRunListener(args) == args.action);
})
.registerArgumentAutocompleteListener('location', async (query, args) => {
const locationList = args.device.getAutocompleteLocationList();
return locationList.filter((result) => {
return result.name.toLowerCase().includes(query.toLowerCase());
});
});

}
}
Loading

0 comments on commit 47d4b0e

Please sign in to comment.