9 posts / 0 new
Last post
eugenel
eugenel's picture
Scheduling Roadster charge start AND stop

Hello,

I'm a Roadster owner in the UK, and a happy user of OVMS for many years. I am also on a modern Time-Of-Day electricity tariff (Octopus GO) that supplies low-cost renewable electricity overnight between 0030 and 0430. Given that I don't use my precious Roadster every day, it would be great to schedule overnight charging to only take place during that four hour window. As, for now, I only use the 13A granny charger, it might take several consecutive 4-hour overnight charging session to fill the car ... but that's fine! smiley

So, my question is can I somehow use OVMS to automate starting and stopping the charge?

I have an OVMS v3 module running the latest firmware.

Cheers,

Eugene

PS. There is a brilliant app called ev.energy that does this for my Model 3, which is what gave me the idea.

markwj
markwj's picture
Using firmware 3.2.015-89 (or

Using firmware 3.2.015-89 (or later), which can be obtained from 'edge' release, you can use command scripting to do this.

https://docs.openvehicles.com/en/latest/userguide/scripting.html#command-scripts

There are now two clock events (all based on local time):

  • clock.HHMM which is raised once a minute at hour HH minute MM
  • clock.dayN which is raised at midnight on each day (N=0 for Sunday, N=6 for Saturday)

So if you create a directory /store/events/clock.0031 and in it a file startcharge containing "charge start", that should kick off the charge you require.

You can do something more sophisticated with javascript (such as checking SOC%, whether the car was plugged in, etc, before starting a charge), but that is more complex.

Regards, Mark.

eugenel
eugenel's picture
Thanks, that's very helpful.

Thanks, that's very helpful. I'll have a crack at that and let you know how I get on.

Cheers, Eugene

eugenel
eugenel's picture
OK, so I hit the manuals and

OK, so I hit the manuals and succeeded in updating the firmware in my OVMS to the latest EDGE release (3.2.015-94). I also managed to set up two scripts:

/store/events/clock.0030/startcharge (containing the 'charge start' command) 

/store/events/clock.0430/stopcharge (containing the 'charge stop' command) 

I tested these by running the scripts from the web console command-line. Interestingly they did not work when I created them using the web console editor, but did work when I used the 'vfs append' command. A file format issue?

I also noticed that the clock.hhmm events reported in the web console status window were an hour before the current BST time, which I need to sync with the Octopus GO tariff period, so I reset the vehicle timezone using 'config set vehicle timezone GMT-1'. Hope that wasn't a mistake. devil

So, I've set the car to charge on plug-in, plugged it in, waited for the charge to start and then manually stopped it. Hopefully it will start up automatically tonight and charge exclusively during the Octopus Go lo-rate tariff period. I'll report back...

Eugene

PS. I'm hoping the auto-firmware download setting won't mean that the main branch of the software won't automatically OTA update and overwrite my EDGE version?

 

eugenel
eugenel's picture
Alas, the car did not charge

Alas, the car did not charge last night. I might try and set up a mid-day charing session and then observe. Also, I noticed on the battery page of the OVMS phone app that the charger icon has dispapeared. It appears fleetingly when the app starts and then disappears!? Curious.

I appreciate that this isn't the highest priority for the OVMS team, but there aer a few UK Roadster owners interested in this. Should I open up a support ticket (or something like that?)

Eugene

 

markwj
markwj's picture
#1 is to check the clock is

#1 is to check the clock is correct.

Can you try 'show clock' and make sure it is 100% correct. Your timezone string should be configured to reflect the DST logic in your country.

I also suggest adding a 'notify' to the script so you can push a notification to yourself when the script runs. At least then you can narrow it down to (a) script didn't run, or (b) charge couldn't start.

eugenel
eugenel's picture
Alas, I don't know where to

Alas, I don't know where to input 'show clock' as that does not appear to be a command in the OVMS shell. But I'm pretty sure the clock is correct as when I view the OVMS status window in the web console I see the clock alerts being issued at the correct time (see below):

 

I've installed the Pushover app on my phone and configued it successfully on OVMS, sending myself a Hello message. But what line do I add to my startcharge script to send myself a notification, so that I know the script has actually fired at 0030?

Also, it occurs to me though that I really only want this functionality when the car is at home. I've set up a home location, using the location command, with a 100m perimiter and perhaps I could check that before attempting to initiate this overnight charge? Or perhaps it would be best to issue these commands to the OVMS remotely, (say) by have the scheduling functionality on a home PC that tests to see if it can connect to the car? Any idea if this is possible?

Eugene

PS. I have an IT backgroud, but it's been a while frown. I've been trying to read up on as much as I can, but there's a lot to re-learn. Please feel free to point me at any relevant documentation.

markwj
markwj's picture
Sorry, the correct command to

Sorry, the correct command to show clock is:

OVMS# time status

You can send a normal smartphone push notification with:

OVMS# notify raise text alert info "This is a test message"

 

eugenel
eugenel's picture
Progress report. I think I

Progress report. I think I have successfully scheduled STARTING a charge, and am about to test scheduling a STOP.

Again using the 'vfs append' command, I created the following file: /store/events/clock.1730/10.startcharge containing the following lines:

raise text alert info 'Scheduled charge start request'
charge start
raise text alert info 'Scheduled charge started!'

I reset the Roadster by switching the charger off at the socket, unplugging, closing the charge hatch, opening the charge hatch, plugging the charge lead in again and switching it on. THe char woke up and started charging, I then used the app to stop the charging, all a few minutes before 1730.

And, lo and behold, the two notify messages showed up on the OVMS app and the car started charging. Hoorah!

I've scheduled a CHARGE STOP at 1800 and will then test it overnight at the desired 0030 (CHARGE START) and 0430 (CHARGE STOP) times ...

indecision

PS. Once again, using the Tools->Editor seems to leave the file in a weird state that won't run when scheduled. File protection? Weird. A bit awkward to have use the vfs append command.

Log in or register to post comments
randomness