Kemmey / Kemmey-TeslaWatch-Public

40 stars 21 forks source link

Apple 'Shortcuts' intregration #263

Open swany99 opened 3 years ago

swany99 commented 3 years ago

Hi, Wondering if it would be possible to allow the app actions to be shown in 'shortcuts' similar to the likes of 'Hive heating system' we could then setup siri commands with our chosen words for each command, unsure how big an ask this is.

Kemmey commented 3 years ago

@swany99 This is definitely something I'm working on.

The biggest problem is the localization, as apple require the app to ship with sample phrases for all commands - and that's going to be a huge library of localization keys, that bring very little value...

Kemmey commented 3 years ago

@swany99 initial shortcuts support has shipped in latest beta:

https://testflight.apple.com/join/FdzFOLZv

Let me know if you test it out and need improvements!

swany99 commented 3 years ago

@Kemmey let me try it and revert back. Thanks

swany99 commented 3 years ago

@Kemmey Tried trunk so far and its the wrong way round, close opens and open seems to do nothing?

swany99 commented 3 years ago

@Kemmey when start defrost activated it works ok but when you stop defrost it leaves the climate ON.

swany99 commented 3 years ago

@Kemmey tried all others except frunk as i am not at the car. All others except the ones mentioned above all work 👍

nachtbraker commented 3 years ago

Nice! Start Climate works. Now I can tell Siri to warm up the car for me. 😊

Kemmey commented 3 years ago

Awesome guys! Thank you for testing!

The trunk actions both currently trigger "actuate" which means toggle from whatever current state it's in. I'll add checks so open opens and close closes - so the workflow can be certain the desired state was achieved. Kind of relevant with trunks and windows :-D

Kemmey commented 3 years ago

Oh - and I'll make sure to turn off climate when turning off defrost!

Kemmey commented 3 years ago

@swany99 - I changed my mind regarding defrost and climate - the official app also does not turn off climate when turning off defrost. But turning off climate will also turn off defrost. So when you write workflows, turn off climate to turn off both - that mimics the official app 1:1. If that changes, I'll adapt as well.

As for the trunks - they will now execute their named action - open or close - and report success only if desired state was achieved - either if state was already in place or state was changed to desired state.

swany99 commented 3 years ago

@Kemmey updated app and the 'open Trunk' action still seems to do nothing, other commands show a progress bar when the command is selected on a phone but the 'open trunk' just opens the app and does nothing. When i manually open the trunk and try the 'close trunk' function it shows progress on the shortcut and asks for confirmation to complete the closing however it does not close the trunk,Could you have a look please

Kemmey commented 3 years ago

@swany99 doh! That was a misconfiguration on my part. I had set those actions to require user confirmation - that apparently means open the app instead. I've removed that restriction - cause the shortcut app already have confirm action toggles in place that can optionally be removed.

New beta incoming :-D

swany99 commented 3 years ago

@Kemmey no probs, let me know when the changes have been rolled out to test flight and i will try the trunk again

Kemmey commented 3 years ago

@swany99 should be live now

swany99 commented 3 years ago

@Kemmey trunk open works ok, trunk close says it done it successfully but the boot does not close if you can check the programming on this

Kemmey commented 3 years ago

@swany99 right - my bad. That was actually a generic bug with the trunks in general. In vehicles with electric trunks, vehicle reports different values according to how open trunk is.

Fixed in incoming beta! :-D

Thanks for helping out with this!!!

swany99 commented 3 years ago

@Kemmey the vehicle state shows nothing on the apple watch even although it says 'success' and when the shortcut is run froM the phone it shows nothing either, i assume its supposed to advise battery percentage?

Kemmey commented 3 years ago

@swany99 the vehicle state returns a dictionary with all sorts of goodies for use in shortcut logic - but the value itself is literally "Success" if it managed to extract that :-D

I've updated the intent to return a string with vehicle soc, range and chargestate, just so it's textual representation is meaningful. But the real power of that intent, is by controlling shortcut flow - like, turn on defrost if outside temp is freezing and chargestate is complete ish

swany99 commented 3 years ago

@Kemmey Could a siri shortcut link be added for vehicle location (Find Tesla) and it pulls this up on maps?

Also other ones for trying to find your car in a large car park/airport could be;

Kemmey commented 3 years ago

Hey @swany99

all of the above are actually already in 1.1.6 :-D

honk and flash via the builtin Siri "give signal" actions - they work spoken, not sure if they're properly implemented in Shortcuts - but if not, they are on my list to build as separate actions.

As for location, look for the Vehicle State shortcut - that will actually return a dictionary of various vehicle state information - location being one. And from there it's easy to kick to maps using shortcuts :-D

Kemmey commented 3 years ago

image

cmfrazier commented 3 years ago

@Kemmey is it possible to have shortcuts per vehicle when multiple are present?

Kemmey commented 3 years ago

@cmfrazier not yet - multi-vehicle support is on my todo list - and has been recently bumped up a bit, by a lot of you guys requesting features that needs it - I'll bump it up a bit more. I'm a bit bogged down these days on support cases, so feature progress is slower than I'd have liked. But I'll do my best to get to better multi vehicle support! I do have it mapped out in my mind how I'll do it - just have to get around to writing it :-D

plangin commented 2 years ago

Any news on car selection?

Tried to create some shortcuts on macOS 12 and found out I can not select the car.

Kemmey commented 2 years ago

@plangin unfortunately - still top-of-list - but not fully implemented - sorry.

Proper multi vehicle support requires a very large rewrite - and a new storage system - so while I do have a branch running, I had too many flakey issues after that rewrite, that the work done in that feature branch has stagnated a bit, in favour of fixing more broadly affecting issues, I'm afraid.

But it IS still at the top of my todo list - and something I will get around to eventually...

Kemmey commented 2 years ago

@plangin in latest TestFlight I've added three actions that might stave off this issue a bit - get vehicles, get active vehicle and set active vehicle.

These will at least allow you to write multi-vehicle logic yourself.

They're not entirely perfect just yet - user defines names for vehicles are not always properly initialized for the get vehicles on account action - but try them out, and let me know what you think!

https://testflight.apple.com/join/FdzFOLZv

image image image

Kemmey commented 2 years ago

Car selection is now added to all shortcuts in latest beta - please test them out and report back of any issues - I'm gearing up for release if 1.2.2

https://testflight.apple.com/join/FdzFOLZv