diff --git a/debian/control b/debian/control index dcc88e68..5d96dfe4 100644 --- a/debian/control +++ b/debian/control @@ -749,6 +749,22 @@ Description: nymea.io plugin for Solar-Log This package will install the nymea.io plugin for Solar-Log. +Package: nymea-plugin-smartcar +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends}, + nymea-plugins-translations, + python3-pip, +Description: nymea.io plugin for smartcar + The nymea daemon is a plugin based IoT (Internet of Things) server. The + server works like a translator for devices, things and services and + allows them to interact. + With the powerful rule engine you are able to connect any device available + in the system and create individual scenes and behaviors for your environment. + . + This package will install the nymea.io plugin for Smartcar (see https://smartcar.com/). + + Package: nymea-plugin-tasmota Architecture: any Depends: ${shlibs:Depends}, diff --git a/debian/nymea-plugin-smartcar.install.in b/debian/nymea-plugin-smartcar.install.in new file mode 100644 index 00000000..21260143 --- /dev/null +++ b/debian/nymea-plugin-smartcar.install.in @@ -0,0 +1,3 @@ +smartcar/integrationpluginsmartcar.json usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/smartcar/ +smartcar/integrationpluginsmartcar.py usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/smartcar/ +smartcar/requirements.txt usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/smartcar/ diff --git a/smartcar/integrationpluginsmartcar.json b/smartcar/integrationpluginsmartcar.json index 4c7fb962..496c3984 100644 --- a/smartcar/integrationpluginsmartcar.json +++ b/smartcar/integrationpluginsmartcar.json @@ -3,6 +3,13 @@ "displayName": "Smartcar", "id": "f33bb38d-640e-4b15-a39e-f0e7b2cc6993", "paramTypes": [ + { + "id": "70e2c7a1-55b4-47fd-83b5-549de30b1391", + "name": "testMode", + "displayName": "Test Mode", + "type": "bool", + "defaultValue": false + }, { "id": "bb5ee037-5034-4921-b1d8-3936bc515fa6", "name": "customClientId", diff --git a/smartcar/integrationpluginsmartcar.py b/smartcar/integrationpluginsmartcar.py index bb57fca1..ca65e034 100644 --- a/smartcar/integrationpluginsmartcar.py +++ b/smartcar/integrationpluginsmartcar.py @@ -117,12 +117,15 @@ def createSmartcarClient(): clientSecret = apiKey.data("clientSecret") redirectUri = "https://127.0.0.1:8888" + testMode = configValue(smartcarPluginTestModeParamTypeId) + logger.log("Test mode enabled: ", testMode) + smartcarClient = smartcar.AuthClient( client_id=clientId, client_secret=clientSecret, redirect_uri=redirectUri, scope=['required:read_vehicle_info', 'required:read_battery', 'required:read_charge'], - test_mode=True + test_mode=testMode ) return smartcarClient @@ -200,5 +203,11 @@ def getAccessToken(client, thingId): if smartcar.is_expired(expiration_date_time_obj): token = client.exchange_refresh_token(token['refresh_token']) saveToken(thingId, token) - return token['access_token'] + return token['access_token'] + + +def configValueChanged(paramTypeId, value): + if paramTypeId == smartcarPluginTestModeParamTypeId: + logger.log("Test mode enabled changed to: ", value) + #should retrigger a setup somehow here \ No newline at end of file diff --git a/smartcar/requirements.txt b/smartcar/requirements.txt index 95d886ce..2d2ddd93 100644 --- a/smartcar/requirements.txt +++ b/smartcar/requirements.txt @@ -1,4 +1,11 @@ -Flask==1.0.2 -flask-cors==3.0.9 -requests==2.20.1 -smartcar==5.2.1 +Flask==1.0.2 \ + --hash=sha256:2271c0070dbcb5275fad4a82e29f23ab92682dc45f9dfbc22c02ba9b9322ce48 \ + --hash=sha256:a080b744b7e345ccfcbc77954861cb05b3c63786e93f2b3875e0913d44b43f05 +Flask-Cors==3.0.9 \ + --hash=sha256:6bcfc100288c5d1bcb1dbb854babd59beee622ffd321e444b05f24d6d58466b8 \ + --hash=sha256:cee4480aaee421ed029eaa788f4049e3e26d15b5affb6a880dade6bafad38324 +requests==2.20.1 \ + --hash=sha256:65b3a120e4329e33c9889db89c80976c5272f56ea92d3e74da8a463992e3ff54 \ + --hash=sha256:ea881206e59f41dbd0bd445437d792e43906703fff75ca8ff43ccdb11f33f263 +smartcar==5.2.1 \ + --hash=sha256:ee296d917b5fcf3f756737fb87a158558b0beaa5f0c5626de6a7c10f493ff957