The script above has been working for me and @danfulton.
However on Tuesday evening I had a problem …
The script ran per cronjob but when I checked the webpage for Demand Shaper, the red bars were not showing to indicate that a charge was scheduled.
I then ran the script in an SSH terminal - the script ran without error – but still no red bars.
I had to manually turn Demand Shaper OFF and then manually turn it back to SMART to get the red bars.
But this is exactly what the script tries to achieve and the json printout indicated that the ctrlmode was set to ‘smart’:
{'schedule': {'settings': {'device': 'openevse', 'device_type': 'openevse', 'device_name': 'openevse', 'ctrlmode': 'smart', 'period': 4.021739130434782, 'end': 8, 'end_timestamp': 1609920000, 'interruptible': 0, 'runone': 0, 'on_completion': 'smart', 'forecast_config': [{'name': 'octopusagile', 'weight': 1, 'gsp_id': 'H'}], 'forecast_units': 'generic', 'timer': [{'start': 0, 'end': 0}, {'start': 0, 'end': 0}], 'ip': '', 'soc_source': 'input', 'battery_capacity': 75, 'charge_rate': 6.9, 'target_soc': 0.9, 'current_soc': 0.53, 'balpercentage': 0.9, 'baltime': 2, 'car_economy': 3.4, 'charge_energy': 27.75, 'charge_distance': 94.3, 'distance_units': 'miles', 'ovms_vehicleid': '', 'ovms_carpass': '', 'divert_mode': 1}, 'runtime': {'started': True, 'periods': [{'start': [1609896600, 1.5], 'end': [1609911078, 5.517]}], 'timeleft': 0}}}
200
{"success":true,"message":"Saved to disk"}
In another related Forum posting …
… you indicated that:
It may take until the next SOC auto update for the changes to take effect, up to 10 mins.
Would you please explain in a bit more detail how this aspect of Demand Shaper works.
Is the SOC you refer to the actual then SOC of the EV or is it the target SOC you want to achieve?
Is there a way to force the update you refer to? I could incorporate this into the script.
Your advice would be most welcome - thx