Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Renault Zoe & Siri integration
-
I've recently bought myself a lovely Zoe R110 ZE40 electric car, and stumbled across this on the web.
https://adrian.schoenig.me/blog/2019/01/20/hey-siri-preheat-my-car/
I really liked the idea of having Siri tell me the status of my car, so bought & downloaded Pythonista 3 to my iPhone X and then shifted over to the beta so that I could use shortcuts.
I have very little programming knowledge, but have the script running on my iPhone just fine. The thing is I am struggling with the shortcut, as when I tap on the shortcut I created it just open Pythonista and then a text displays the results.
Anyone know how too make Siri say the results please?
-
@Bod did you try shortcuts.set_spoken_output(text)
-
That instruction is in there at the bottom of the script, but it only actions 'if shortcuts.is_shortcut():'
I'm totally new to this, so don't really know what it is looking for to make the statement true.
-
@Bod you have to run your script via Siri, not in the Pythonista app.
tap shortcuts
tap > at right
tap +
tap add
-
Ah !!! ... Thank you so very much.
I didn't even see the + sign. Doh !!!
It's working now, so all I have to do is alter the code to display miles instead of km.
This should be fairly simple (i hope). -
Right, I've figured where the KM value is & I've added a new line of code which takes the KM and divides by 1.6 which should give me a rough mileage conversion.
Just need to figure out how to round it up neatly now.
result = requests.get(url, headers=headers).json() convert = ({result['remaining_range']/1.6}) if result['charging']: minutes = result['remaining_time'] remaining = fuzzy_duration(minutes) status = f"done charging in {remaining}" else: status = "is not charging" return f"{carname} can go {convert} miles. Battery is {result['charge_level']}% full and {status}."
I notice there is a programming tool called 'round', but I can't seem to get it to work.
I tried convert = round ({result['remaining_range']/1.6})
-
@Bod, try:
convert = round(result['remaining_range']/1.6)
If
result['remaining_range']
is actually a string, wrap it infloat()
. -
Thank you, working perfectly now.
You are all amazingly helpful. Couldn't have solved this so quickly without all your help.
-
Wow! Good work. Would be so great to have this!
But will it still work?
~ % ping www.services.renault-ze.com ping: cannot resolve www.services.renault-ze.com: Unknown host
-
At the bottom of the blog entry above is the blog author's twitter handle. You might try tweeting him to see if he is willing to update his software.
-
I'm the author of that blog post. I don't have a Renault Zoe anymore, but have a look if this repo helps: https://github.com/jamesremuscat/pyze