evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Tibber: Support smartcharging by relative price level

Open cschlipf opened this issue 7 months ago • 61 comments

Is your feature request related to a problem? Please describe. Smart charging using tibber works only via a fixed price. However the prices are changing. What is considered expensive this week, might be considered cheap next week. Now the car might not be charging because the fixed price will not be achieved during the next week.

Describe the solution you'd like Enable smart charging based on the price levels provided by tibber. They provide a 'level' attribute, which can be taken as a relative price, which is a value of 'VERY_EXPENSIVE', 'EXPENSIVE', 'NORMAL', 'CHEAP', 'VERY_CHEAP'.

See additional context below for a sample request.

With this level the user could select a level instead of a price. For example if the user sets 'CHEAP', smart charging would start, when it sees a cheap price, instead of a fixed level. It could even be smarter and check if in the next 2-3 hours a 'VERY CHEAP' occurs and delay charging until then automatically.

Describe alternatives you've considered Alternative would be a statistical analysis of past and future Tibber prices and do the rating with EVCC. However as Tibber provides the info already, using this would be easier.

Additional context Tibber GraphQL example:

Request:

{
  viewer {
    homes {
      currentSubscription{
        priceInfo{
          current{
            total
            energy
            tax
            startsAt
            level
          }
          today {
            total
            energy
            tax
            startsAt
            level
          }
        }
      }
    }
  }
}

Response:

{
  "data": {
    "viewer": {
      "homes": [
        {
          "currentSubscription": {
            "priceInfo": {
              "current": {
                "total": 0.3146,
                "energy": 0.1288,
                "tax": 0.1858,
                "startsAt": "2023-11-20T15:00:00.000+01:00",
                "level": "EXPENSIVE"
              },
              "today": [
                {
                  "total": 0.2426,
                  "energy": 0.0683,
                  "tax": 0.1743,
                  "startsAt": "2023-11-20T00:00:00.000+01:00",
                  "level": "NORMAL"
                },
                {
                  "total": 0.2359,
                  "energy": 0.0627,
                  "tax": 0.1732,
                  "startsAt": "2023-11-20T01:00:00.000+01:00",
                  "level": "NORMAL"
                },
                {
                  "total": 0.2326,
                  "energy": 0.0599,
                  "tax": 0.1727,
                  "startsAt": "2023-11-20T02:00:00.000+01:00",
                  "level": "CHEAP"
                },
                {
                  "total": 0.2328,
                  "energy": 0.06,
                  "tax": 0.1728,
                  "startsAt": "2023-11-20T03:00:00.000+01:00",
                  "level": "NORMAL"
                },
                {
                  "total": 0.2384,
                  "energy": 0.0648,
                  "tax": 0.1736,
                  "startsAt": "2023-11-20T04:00:00.000+01:00",
                  "level": "NORMAL"
                },
                {
                  "total": 0.2571,
                  "energy": 0.0804,
                  "tax": 0.1767,
                  "startsAt": "2023-11-20T05:00:00.000+01:00",
                  "level": "NORMAL"
                },
                {
                  "total": 0.2836,
                  "energy": 0.1028,
                  "tax": 0.1808,
                  "startsAt": "2023-11-20T06:00:00.000+01:00",
                  "level": "NORMAL"
                },
                {
                  "total": 0.3138,
                  "energy": 0.1281,
                  "tax": 0.1857,
                  "startsAt": "2023-11-20T07:00:00.000+01:00",
                  "level": "EXPENSIVE"
                },
                {
                  "total": 0.3121,
                  "energy": 0.1267,
                  "tax": 0.1854,
                  "startsAt": "2023-11-20T08:00:00.000+01:00",
                  "level": "EXPENSIVE"
                },
                {
                  "total": 0.3023,
                  "energy": 0.1184,
                  "tax": 0.1839,
                  "startsAt": "2023-11-20T09:00:00.000+01:00",
                  "level": "EXPENSIVE"
                },
                {
                  "total": 0.2948,
                  "energy": 0.1122,
                  "tax": 0.1826,
                  "startsAt": "2023-11-20T10:00:00.000+01:00",
                  "level": "NORMAL"
                },
                {
                  "total": 0.2875,
                  "energy": 0.106,
                  "tax": 0.1815,
                  "startsAt": "2023-11-20T11:00:00.000+01:00",
                  "level": "NORMAL"
                },
                {
                  "total": 0.2839,
                  "energy": 0.103,
                  "tax": 0.1809,
                  "startsAt": "2023-11-20T12:00:00.000+01:00",
                  "level": "NORMAL"
                },
                {
                  "total": 0.2969,
                  "energy": 0.114,
                  "tax": 0.1829,
                  "startsAt": "2023-11-20T13:00:00.000+01:00",
                  "level": "EXPENSIVE"
                },
                {
                  "total": 0.3046,
                  "energy": 0.1204,
                  "tax": 0.1842,
                  "startsAt": "2023-11-20T14:00:00.000+01:00",
                  "level": "EXPENSIVE"
                },
                {
                  "total": 0.3146,
                  "energy": 0.1288,
                  "tax": 0.1858,
                  "startsAt": "2023-11-20T15:00:00.000+01:00",
                  "level": "EXPENSIVE"
                },
                {
                  "total": 0.3279,
                  "energy": 0.1399,
                  "tax": 0.188,
                  "startsAt": "2023-11-20T16:00:00.000+01:00",
                  "level": "EXPENSIVE"
                },
                {
                  "total": 0.3363,
                  "energy": 0.147,
                  "tax": 0.1893,
                  "startsAt": "2023-11-20T17:00:00.000+01:00",
                  "level": "EXPENSIVE"
                },
                {
                  "total": 0.3279,
                  "energy": 0.14,
                  "tax": 0.1879,
                  "startsAt": "2023-11-20T18:00:00.000+01:00",
                  "level": "EXPENSIVE"
                },
                {
                  "total": 0.3161,
                  "energy": 0.1301,
                  "tax": 0.186,
                  "startsAt": "2023-11-20T19:00:00.000+01:00",
                  "level": "EXPENSIVE"
                },
                {
                  "total": 0.3042,
                  "energy": 0.12,
                  "tax": 0.1842,
                  "startsAt": "2023-11-20T20:00:00.000+01:00",
                  "level": "EXPENSIVE"
                },
                {
                  "total": 0.2887,
                  "energy": 0.107,
                  "tax": 0.1817,
                  "startsAt": "2023-11-20T21:00:00.000+01:00",
                  "level": "NORMAL"
                },
                {
                  "total": 0.2899,
                  "energy": 0.108,
                  "tax": 0.1819,
                  "startsAt": "2023-11-20T22:00:00.000+01:00",
                  "level": "NORMAL"
                },
                {
                  "total": 0.2776,
                  "energy": 0.0977,
                  "tax": 0.1799,
                  "startsAt": "2023-11-20T23:00:00.000+01:00",
                  "level": "NORMAL"
                }
              ]
            }
          }
        }
      ]
    }
  }
}

Tibber API documentation on the price level attribute: https://developer.tibber.com/docs/reference#pricelevel image

cschlipf avatar Nov 20 '23 14:11 cschlipf