TMC is an independent, primarily volunteer organization that relies on ad revenue to cover its operating costs. Please consider whitelisting TMC on your ad blocker and becoming a Supporting Member. For more info: Support TMC

TOU api

Discussion in 'Tesla Energy' started by Sylvia Else, Aug 3, 2018.

  1. Sylvia Else

    Sylvia Else Member

    Joined:
    May 28, 2018
    Messages:
    85
    Location:
    Sydney
    I've captured some requests and responses to Tesla's servers for the ap, for those who already know how to access the servers.

    POST /api/1/energy_sites/nnn/time_of_use_settings

    where nnn is your site id.

    {"tou_settings":{"optimization_strategy":"economics","schedule":[{"target":"peak","week_days":[1,2,3,4,5],"start_seconds":50400,"end_seconds":75600},{"target":"off_peak","week_days":[1,2,3,4,5],"start_seconds":79200,"end_seconds":27000},{"target":"peak","week_days":[0,6],"start_seconds":null,"end_seconds":null},{"target":"off_peak","week_days":[0,6],"start_seconds":79200,"end_seconds":25200}]}}

    {"tou_settings":{"optimization_strategy":"balanced","schedule":[{"target":"peak","week_days":[1,2,3,4,5],"start_seconds":50400,"end_seconds":75600,"timestamp":1533354852668,"receipt_timestamp":1533354852668},{"target":"off_peak","week_days":[1,2,3,4,5],"start_seconds":79200,"end_seconds":27000,"timestamp":1533354852668,"receipt_timestamp":1533354852668},{"target":"peak","week_days":[0,6],"start_seconds":null,"end_seconds":null,"timestamp":1533354852668,"receipt_timestamp":1533354852668},{"target":"off_peak","week_days":[0,6],"start_seconds":79200,"end_seconds":25200,"timestamp":1533354852668,"receipt_timestamp":1533354852668}]}}

    It appears that it only includes the "timestamp" values when you change between balanced and cost saving, and vice versa.

    Changing the backup reserve

    POST /api/1/energy_sites/nnnn/backup

    {"backup_reserve_percent":67}

    Changing modes:

    POST /api/1/energy_sites/nnn/operation

    {"default_real_mode":"backup"}

    {"default_real_mode":"self_consumption"}

    {"default_real_mode":"autonomous"}

    This latter is for "Advanced mode, or TOU".

    In all cases the respone is

    {"response":{"Code":201,"Message":"Updated"}}

    It may be that the "default_real_mode" is just "default_mode" prior to firmware 1.21.0
     
    • Informative x 1
  2. BJReplay

    BJReplay Member

    Joined:
    Oct 13, 2017
    Messages:
    61
    Location:
    St Kilda West
    Thanks. From this it appears that you have a three part tariff, with shoulder on weekdays from 7:30 to 14:00 and again from 21:00 to 22:00, and the message defines peak and off peak, with shoulder "everything else"?

    Weekend is shoulder and off peak, and no peak period?

    Off Peak end seconds can be "after" start seconds, so it wraps around midnight.
     
  3. Sylvia Else

    Sylvia Else Member

    Joined:
    May 28, 2018
    Messages:
    85
    Location:
    Sydney
    That's how mine is set, yes - there's no peak at weekends, so it appears that to represent that it specifies null for the start and end times. As you surmised, shoulder is everything not included in the specified periods.

    It looks as if there are a couple of minor things that could be achieved with the api, that the ap won't allow. Once is to change the week/weekend split, perhaps to handle a forthcoming public holiday. The other is to specify boundaries that are not multiples of 30 minutes, though I'd be surprised if there are my tariffs like that.

    Still pretty basic stuff, though.
     

Share This Page

  • About Us

    Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.
  • Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


    SUPPORT TMC