Amber Electric (Australia) Custom Component

Hi James

It looks like your fix has led me to a bug in the logic. I didn’t realize the API can return historical values so when I was returning a 0 index for me assuming it would be the current time for everyone. I’ve just updated the code to now look for the current time and return that as the sensor value, and scrub historical data from the attributes.

I’m just testing and will hopefully push an update this weekend.

Thanks,
Lewis

Hi,

I’ve pushed a version to Github that will now scrub historic price date. This should negate you jumping to index 49 and ensure the price being returned is current. Let me know if you still see issues.

Thanks,
Lewis

Thanks Lewis,

I’ll take a look at the update. It’s been working well for me with my change (upon further investigation, it turned out that index 48 was the value that was used for ‘now’ in the app) and I managed to successfully charge my car overnight when the rate dropped below 12c and stop the charging when the rate went over 15c. I’m still a few days away from switching over to Amber, but it’s great to know that this is possible and actually fairly simple to achieve.

Cheers,
James.

I spoke to their support and at the moment they don’t have a way for us to pull customer data via API :frowning:

The app certainly gets the data so maybe we can reverse engineer it?

@squishykid might be able to help…

1 Like

Not currently an Amber customer myself, but looking into it and have stumbled across this.
I am encountering an error on setup which I’m digging into but don’t yet have the answer, will share here for visibility. Effectively I have followed the setup instructions exactly and rebooted HA, and I’m getting the following on system start:

Logger: homeassistant.components.sensor
Source: custom_components/amberelectric/ambermodel.py:41
Integration: Sensor (documentation, issues)
First occurred: 10:51:06 (1 occurrences)
Last logged: 10:51:06

Error while setting up amberelectric platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/amberelectric/sensor.py", line 45, in setup_platform
    AmberPricingSensor(amber_data, postcode, CONST_SOLARFIT, "Amber solar feed in tariff", "mdi:solar-power"),
  File "/config/custom_components/amberelectric/sensor.py", line 62, in __init__
    self.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 239, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/amberelectric/sensor.py", line 157, in update
    self.amber_data = AmberData.from_dict(json.loads(response.text))
  File "/config/custom_components/amberelectric/ambermodel.py", line 433, in from_dict
    data = Data.from_dict(obj.get("data"))
  File "/config/custom_components/amberelectric/ambermodel.py", line 396, in from_dict
    VariablePricesAndRenewable.from_dict, obj.get("variablePricesAndRenewables")
  File "/config/custom_components/amberelectric/ambermodel.py", line 51, in from_list
    return [f(y) for y in x]
  File "/config/custom_components/amberelectric/ambermodel.py", line 51, in <listcomp>
    return [f(y) for y in x]
  File "/config/custom_components/amberelectric/ambermodel.py", line 315, in from_dict
    created_at = from_datetime(obj.get("createdAt"))
  File "/config/custom_components/amberelectric/ambermodel.py", line 41, in from_datetime
    return dateutil.parser.parse(x)
  File "/usr/local/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 1374, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 646, in parse
    res, skipped_tokens = self._parse(timestr, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 725, in _parse
    l = _timelex.split(timestr)         # Splits the timestr into tokens
  File "/usr/local/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 207, in split
    return list(cls(s))
  File "/usr/local/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 76, in __init__
    '{itype}'.format(itype=instream.__class__.__name__))
TypeError: Parser must be a string or character stream, not NoneType

My postcode is 3012 and I can confirm I’m getting data from the API, with a quickly thrown together python script (using the same methods you do) giving me the following output:

:~$ python3 test_amberelectric_api.py
b'{"serviceResponseType":1,"data":{"currentNEMtime":"2020-07-11T10:56:02","postcode":"3012","networkProvider":"Powercor","staticPrices":{"E1":{"dataAvailable":true,"networkDailyPrice":"37.6712328767123","basicMeterDailyPrice":"19.8","additionalSmartMeterDailyPrice":"0","amberDailyPrice":"32.8767123287671","totalDailyPrice":"90.3479452054794","networkKWHPrice":"7.898","marketKWHPrice":"1.86846258860692","greenKWHPrice":"4.5","carbonNeutralKWHPrice":"1.944","lossFactor":"1.0686","offsetKWHPrice":"1.944","totalfixedKWHPrice":"11.71046","totalBlackPeakFixedKWHPrice":"NaN","totalBlackShoulderFixedKWHPrice":"NaN","totalBlackOffpeakFixedKWHPrice":"NaN"},"E2":{"dataAvailable":true,"networkDailyPrice":"0","basicMeterDailyPrice":"0","additionalSmartMeterDailyPrice":"0","amberDailyPrice":"0","totalDailyPrice":"0","networkKWHPrice":"2.882","marketKWHPrice":"1.86846258860692","greenKWHPrice":"4.5","carbonNeutralKWHPrice":"1.944","lossFactor":"1.0686","offsetKWHPrice":"1.944","totalfixedKWHPrice":"6.69446","totalBlackPeakFixedKWHPrice":"NaN","totalBlackShoulderFixedKWHPrice":"NaN","totalBlackOffpeakFixedKWHPrice":"NaN"},"B1":{"dataAvailable":true,"networkDailyPrice":"0","basicMeterDailyPrice":"0","additionalSmartMeterDailyPrice":"0","amberDailyPrice":"0","totalDailyPrice":"0","networkKWHPrice":"0","marketKWHPrice":"0","greenKWHPrice":"0","carbonNeutralKWHPrice":"0","lossFactor":"-1.0686","offsetKWHPrice":"0","totalfixedKWHPrice":"0.00000","totalBlackPeakFixedKWHPrice":"NaN","totalBlackShoulderFixedKWHPrice":"NaN","totalBlackOffpeakFixedKWHPrice":"NaN"}},"variablePricesAndRenewables":[{"periodType":"ACTUAL","semiScheduledGeneration":"424.82","operationalDemand":"6047.92","rooftopSolar":"488.693","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"9.5579","region":"VIC1","period":"2020-07-10T11:00:00","renewablesPercentage":"0.1397532636550458","periodSource":"30MIN","percentileRank":"0.8554216867469879"},{"periodType":"ACTUAL","semiScheduledGeneration":"342.12","operationalDemand":"5899.49","rooftopSolar":"557.687","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.724200000000001","region":"VIC1","period":"2020-07-10T11:30:00","renewablesPercentage":"0.1393499047648841","periodSource":"30MIN","percentileRank":"0.7349397590361446"},{"periodType":"ACTUAL","semiScheduledGeneration":"314.95","operationalDemand":"5772.62","rooftopSolar":"611.176","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.5251","region":"VIC1","period":"2020-07-10T12:00:00","renewablesPercentage":"0.14507449799461009","periodSource":"30MIN","percentileRank":"0.6385542168674698"},{"periodType":"ACTUAL","semiScheduledGeneration":"300.7","operationalDemand":"5733.68","rooftopSolar":"643.346","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.5097000000000005","region":"VIC1","period":"2020-07-10T12:30:00","renewablesPercentage":"0.14803859981126","periodSource":"30MIN","percentileRank":"0.6265060240963856"},{"periodType":"ACTUAL","semiScheduledGeneration":"327.66","operationalDemand":"5610.76","rooftopSolar":"649.965","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.5306","region":"VIC1","period":"2020-07-10T13:00:00","renewablesPercentage":"0.1561520430940506","periodSource":"30MIN","percentileRank":"0.6506024096385542"},{"periodType":"ACTUAL","semiScheduledGeneration":"302.83","operationalDemand":"5601.88","rooftopSolar":"626.471","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.455800000000001","region":"VIC1","period":"2020-07-10T13:30:00","renewablesPercentage":"0.14920498218549338","periodSource":"30MIN","percentileRank":"0.5783132530120482"},{"periodType":"ACTUAL","semiScheduledGeneration":"279.28","operationalDemand":"5581.66","rooftopSolar":"591.817","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.4316","region":"VIC1","period":"2020-07-10T14:00:00","renewablesPercentage":"0.14110314171414262","periodSource":"30MIN","percentileRank":"0.5662650602409639"},{"periodType":"ACTUAL","semiScheduledGeneration":"291","operationalDemand":"5528.12","rooftopSolar":"506.165","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.459100000000001","region":"VIC1","period":"2020-07-10T14:30:00","renewablesPercentage":"0.13210595787239085","periodSource":"30MIN","percentileRank":"0.5903614457831325"},{"periodType":"ACTUAL","semiScheduledGeneration":"295.89","operationalDemand":"5504.78","rooftopSolar":"464.959","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.657100000000002","region":"VIC1","period":"2020-07-10T15:00:00","renewablesPercentage":"0.12745096561172942","periodSource":"30MIN","percentileRank":"0.6867469879518072"},{"periodType":"ACTUAL","semiScheduledGeneration":"263.51","operationalDemand":"5490.28","rooftopSolar":"361.571","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.6747","region":"VIC1","period":"2020-07-10T15:30:00","renewablesPercentage":"0.10681765478991179","periodSource":"30MIN","percentileRank":"0.6987951807228916"},{"periodType":"ACTUAL","semiScheduledGeneration":"270.25","operationalDemand":"5675.66","rooftopSolar":"244.563","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.780300000000001","region":"VIC1","period":"2020-07-10T16:00:00","renewablesPercentage":"0.08695837977724825","periodSource":"30MIN","percentileRank":"0.7710843373493976"},{"periodType":"ACTUAL","semiScheduledGeneration":"231.71","operationalDemand":"5868.55","rooftopSolar":"129.693","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"8.7626","region":"VIC1","period":"2020-07-10T16:30:00","renewablesPercentage":"0.060251476974173934","periodSource":"30MIN","percentileRank":"0.8313253012048193"},{"periodType":"ACTUAL","semiScheduledGeneration":"121.04","operationalDemand":"6143.18","rooftopSolar":"51.567","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"10.353200000000001","region":"VIC1","period":"2020-07-10T17:00:00","renewablesPercentage":"0.0278634462392088","periodSource":"30MIN","percentileRank":"0.891566265060241"},{"periodType":"ACTUAL","semiScheduledGeneration":"96.14","operationalDemand":"6467.82","rooftopSolar":"4.404","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"11.2101","region":"VIC1","period":"2020-07-10T17:30:00","renewablesPercentage":"0.015534691011930364","periodSource":"30MIN","percentileRank":"0.927710843373494"},{"periodType":"ACTUAL","semiScheduledGeneration":"159.69","operationalDemand":"6808.41","rooftopSolar":"0","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"10.5435","region":"VIC1","period":"2020-07-10T18:00:00","renewablesPercentage":"0.023454815441490744","periodSource":"30MIN","percentileRank":"0.9036144578313253"},{"periodType":"ACTUAL","semiScheduledGeneration":"232.43","operationalDemand":"6850.81","rooftopSolar":"0","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"6.175400000000001","region":"VIC1","period":"2020-07-10T18:30:00","renewablesPercentage":"0.03392737501113007","periodSource":"30MIN","percentileRank":"0.1686746987951807"},{"periodType":"ACTUAL","semiScheduledGeneration":"263.48","operationalDemand":"6834.25","rooftopSolar":"0","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"6.568100000000001","region":"VIC1","period":"2020-07-10T19:00:00","renewablesPercentage":"0.03855287705307825","periodSource":"30MIN","percentileRank":"0.21686746987951808"},{"periodType":"ACTUAL","semiScheduledGeneration":"226.52","operationalDemand":"6625.57","rooftopSolar":"0","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"6.651700000000001","region":"VIC1","period":"2020-07-10T19:30:00","renewablesPercentage":"0.03418875658999905","periodSource":"30MIN","percentileRank":"0.24096385542168675"},{"periodType":"ACTUAL","semiScheduledGeneration":"229.55","operationalDemand":"6453.75","rooftopSolar":"0","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.4041000000000015","region":"VIC1","period":"2020-07-10T20:00:00","renewablesPercentage":"0.03556846794499322","periodSource":"30MIN","percentileRank":"0.5301204819277109"},{"periodType":"ACTUAL","semiScheduledGeneration":"242.48","operationalDemand":"6304.87","rooftopSolar":"0","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.129100000000001","region":"VIC1","period":"2020-07-10T20:30:00","renewablesPercentage":"0.038459159348249845","periodSource":"30MIN","percentileRank":"0.3373493975903614"},{"periodType":"ACTUAL","semiScheduledGeneration":"285.69","operationalDemand":"6074.36","rooftopSolar":"0","createdAt":"2020-07-11T10:54:41","wholesaleKWHPrice":"7.3909","region":"VIC1","period":"2020-07-10T21:00:00","renewablesPercentage":"0.04703211531749847","periodSource":"30MIN","percentileRank":"0.5060240963855421"},<truncated due to character limit on post>

As an aside, I note the output lists Powercor as networkProvider… our post code actually has multiple providers (at least Jemena as well). I can’t find any doco on the API to see if there’s a way to ask for more specific info like that…

Looks like I jumped the gun as was minutes from finding the ‘bad’ data. In the middle of this block (use ctrl+f for 5MIN), there is an entry that doesn’t define createdAt. I guess the change needed is to treat that as optional or query Amber if it’s a bug?

"variablePricesAndRenewables": [
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "424.82",
        "operationalDemand": "6047.92",
        "rooftopSolar": "488.693",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "9.5579",
        "region": "VIC1",
        "period": "2020-07-10T11:00:00",
        "renewablesPercentage": "0.1397532636550458",
        "periodSource": "30MIN",
        "percentileRank": "0.8554216867469879"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "342.12",
        "operationalDemand": "5899.49",
        "rooftopSolar": "557.687",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.724200000000001",
        "region": "VIC1",
        "period": "2020-07-10T11:30:00",
        "renewablesPercentage": "0.1393499047648841",
        "periodSource": "30MIN",
        "percentileRank": "0.7349397590361446"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "314.95",
        "operationalDemand": "5772.62",
        "rooftopSolar": "611.176",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.5251",
        "region": "VIC1",
        "period": "2020-07-10T12:00:00",
        "renewablesPercentage": "0.14507449799461009",
        "periodSource": "30MIN",
        "percentileRank": "0.6385542168674698"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "300.7",
        "operationalDemand": "5733.68",
        "rooftopSolar": "643.346",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.5097000000000005",
        "region": "VIC1",
        "period": "2020-07-10T12:30:00",
        "renewablesPercentage": "0.14803859981126",
        "periodSource": "30MIN",
        "percentileRank": "0.6265060240963856"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "327.66",
        "operationalDemand": "5610.76",
        "rooftopSolar": "649.965",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.5306",
        "region": "VIC1",
        "period": "2020-07-10T13:00:00",
        "renewablesPercentage": "0.1561520430940506",
        "periodSource": "30MIN",
        "percentileRank": "0.6506024096385542"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "302.83",
        "operationalDemand": "5601.88",
        "rooftopSolar": "626.471",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.455800000000001",
        "region": "VIC1",
        "period": "2020-07-10T13:30:00",
        "renewablesPercentage": "0.14920498218549338",
        "periodSource": "30MIN",
        "percentileRank": "0.5783132530120482"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "279.28",
        "operationalDemand": "5581.66",
        "rooftopSolar": "591.817",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.4316",
        "region": "VIC1",
        "period": "2020-07-10T14:00:00",
        "renewablesPercentage": "0.14110314171414262",
        "periodSource": "30MIN",
        "percentileRank": "0.5662650602409639"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "291",
        "operationalDemand": "5528.12",
        "rooftopSolar": "506.165",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.459100000000001",
        "region": "VIC1",
        "period": "2020-07-10T14:30:00",
        "renewablesPercentage": "0.13210595787239085",
        "periodSource": "30MIN",
        "percentileRank": "0.5903614457831325"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "295.89",
        "operationalDemand": "5504.78",
        "rooftopSolar": "464.959",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.657100000000002",
        "region": "VIC1",
        "period": "2020-07-10T15:00:00",
        "renewablesPercentage": "0.12745096561172942",
        "periodSource": "30MIN",
        "percentileRank": "0.6867469879518072"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "263.51",
        "operationalDemand": "5490.28",
        "rooftopSolar": "361.571",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.6747",
        "region": "VIC1",
        "period": "2020-07-10T15:30:00",
        "renewablesPercentage": "0.10681765478991179",
        "periodSource": "30MIN",
        "percentileRank": "0.6987951807228916"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "270.25",
        "operationalDemand": "5675.66",
        "rooftopSolar": "244.563",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.780300000000001",
        "region": "VIC1",
        "period": "2020-07-10T16:00:00",
        "renewablesPercentage": "0.08695837977724825",
        "periodSource": "30MIN",
        "percentileRank": "0.7710843373493976"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "231.71",
        "operationalDemand": "5868.55",
        "rooftopSolar": "129.693",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "8.7626",
        "region": "VIC1",
        "period": "2020-07-10T16:30:00",
        "renewablesPercentage": "0.060251476974173934",
        "periodSource": "30MIN",
        "percentileRank": "0.8313253012048193"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "121.04",
        "operationalDemand": "6143.18",
        "rooftopSolar": "51.567",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "10.353200000000001",
        "region": "VIC1",
        "period": "2020-07-10T17:00:00",
        "renewablesPercentage": "0.0278634462392088",
        "periodSource": "30MIN",
        "percentileRank": "0.891566265060241"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "96.14",
        "operationalDemand": "6467.82",
        "rooftopSolar": "4.404",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "11.2101",
        "region": "VIC1",
        "period": "2020-07-10T17:30:00",
        "renewablesPercentage": "0.015534691011930364",
        "periodSource": "30MIN",
        "percentileRank": "0.927710843373494"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "159.69",
        "operationalDemand": "6808.41",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "10.5435",
        "region": "VIC1",
        "period": "2020-07-10T18:00:00",
        "renewablesPercentage": "0.023454815441490744",
        "periodSource": "30MIN",
        "percentileRank": "0.9036144578313253"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "232.43",
        "operationalDemand": "6850.81",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "6.175400000000001",
        "region": "VIC1",
        "period": "2020-07-10T18:30:00",
        "renewablesPercentage": "0.03392737501113007",
        "periodSource": "30MIN",
        "percentileRank": "0.1686746987951807"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "263.48",
        "operationalDemand": "6834.25",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "6.568100000000001",
        "region": "VIC1",
        "period": "2020-07-10T19:00:00",
        "renewablesPercentage": "0.03855287705307825",
        "periodSource": "30MIN",
        "percentileRank": "0.21686746987951808"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "226.52",
        "operationalDemand": "6625.57",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "6.651700000000001",
        "region": "VIC1",
        "period": "2020-07-10T19:30:00",
        "renewablesPercentage": "0.03418875658999905",
        "periodSource": "30MIN",
        "percentileRank": "0.24096385542168675"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "229.55",
        "operationalDemand": "6453.75",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.4041000000000015",
        "region": "VIC1",
        "period": "2020-07-10T20:00:00",
        "renewablesPercentage": "0.03556846794499322",
        "periodSource": "30MIN",
        "percentileRank": "0.5301204819277109"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "242.48",
        "operationalDemand": "6304.87",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.129100000000001",
        "region": "VIC1",
        "period": "2020-07-10T20:30:00",
        "renewablesPercentage": "0.038459159348249845",
        "periodSource": "30MIN",
        "percentileRank": "0.3373493975903614"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "285.69",
        "operationalDemand": "6074.36",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.3909",
        "region": "VIC1",
        "period": "2020-07-10T21:00:00",
        "renewablesPercentage": "0.04703211531749847",
        "periodSource": "30MIN",
        "percentileRank": "0.5060240963855421"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "369.48",
        "operationalDemand": "5932.35",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.378800000000001",
        "region": "VIC1",
        "period": "2020-07-10T21:30:00",
        "renewablesPercentage": "0.062282232167690715",
        "periodSource": "30MIN",
        "percentileRank": "0.4939759036144578"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "393.83",
        "operationalDemand": "5749.81",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "6.49",
        "region": "VIC1",
        "period": "2020-07-10T22:00:00",
        "renewablesPercentage": "0.06849443720749032",
        "periodSource": "30MIN",
        "percentileRank": "0.1927710843373494"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "407.59",
        "operationalDemand": "5518.47",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "6.912400000000001",
        "region": "VIC1",
        "period": "2020-07-10T22:30:00",
        "renewablesPercentage": "0.07385923997049906",
        "periodSource": "30MIN",
        "percentileRank": "0.27710843373493976"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "424.38",
        "operationalDemand": "5306.15",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "5.566000000000001",
        "region": "VIC1",
        "period": "2020-07-10T23:00:00",
        "renewablesPercentage": "0.07997889241728938",
        "periodSource": "30MIN",
        "percentileRank": "0.0963855421686747"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "408.08",
        "operationalDemand": "5418.48",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "5.7838",
        "region": "VIC1",
        "period": "2020-07-10T23:30:00",
        "renewablesPercentage": "0.07531263380136127",
        "periodSource": "30MIN",
        "percentileRank": "0.12048192771084337"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "355.49",
        "operationalDemand": "5374.41",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "6.3558",
        "region": "VIC1",
        "period": "2020-07-11T00:00:00",
        "renewablesPercentage": "0.06614493497890932",
        "periodSource": "30MIN",
        "percentileRank": "0.18072289156626506"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "299.07",
        "operationalDemand": "5148.65",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "5.704600000000001",
        "region": "VIC1",
        "period": "2020-07-11T00:30:00",
        "renewablesPercentage": "0.05808707136822274",
        "periodSource": "30MIN",
        "percentileRank": "0.10843373493975904"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "277.88",
        "operationalDemand": "4989.88",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "5.932300000000001",
        "region": "VIC1",
        "period": "2020-07-11T01:00:00",
        "renewablesPercentage": "0.055688713957049066",
        "periodSource": "30MIN",
        "percentileRank": "0.14457831325301204"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "259.64",
        "operationalDemand": "4820.75",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.1698",
        "region": "VIC1",
        "period": "2020-07-11T01:30:00",
        "renewablesPercentage": "0.053858839392210756",
        "periodSource": "30MIN",
        "percentileRank": "0.3614457831325301"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "221.79",
        "operationalDemand": "4657.4",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.716500000000001",
        "region": "VIC1",
        "period": "2020-07-11T02:00:00",
        "renewablesPercentage": "0.047620990252071976",
        "periodSource": "30MIN",
        "percentileRank": "0.7228915662650602"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "169.38",
        "operationalDemand": "4454.61",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.4679",
        "region": "VIC1",
        "period": "2020-07-11T02:30:00",
        "renewablesPercentage": "0.038023530679453424",
        "periodSource": "30MIN",
        "percentileRank": "0.6024096385542169"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "127.59",
        "operationalDemand": "4336.39",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "6.633",
        "region": "VIC1",
        "period": "2020-07-11T03:00:00",
        "renewablesPercentage": "0.029423091557724282",
        "periodSource": "30MIN",
        "percentileRank": "0.2289156626506024"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "112.85",
        "operationalDemand": "4311.67",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "6.501",
        "region": "VIC1",
        "period": "2020-07-11T03:30:00",
        "renewablesPercentage": "0.026173153325741532",
        "periodSource": "30MIN",
        "percentileRank": "0.20481927710843373"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "120.69",
        "operationalDemand": "4226.69",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.268800000000001",
        "region": "VIC1",
        "period": "2020-07-11T04:00:00",
        "renewablesPercentage": "0.028554258769864838",
        "periodSource": "30MIN",
        "percentileRank": "0.43373493975903615"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "94.6",
        "operationalDemand": "4221.21",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "4.4110000000000005",
        "region": "VIC1",
        "period": "2020-07-11T04:30:00",
        "renewablesPercentage": "0.022410635812954105",
        "periodSource": "30MIN",
        "percentileRank": "0"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "89.7",
        "operationalDemand": "4252.01",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "4.6002",
        "region": "VIC1",
        "period": "2020-07-11T05:00:00",
        "renewablesPercentage": "0.021095905230702656",
        "periodSource": "30MIN",
        "percentileRank": "0.012048192771084338"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "72.07",
        "operationalDemand": "4315.11",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "5.1051",
        "region": "VIC1",
        "period": "2020-07-11T05:30:00",
        "renewablesPercentage": "0.016701775852759258",
        "periodSource": "30MIN",
        "percentileRank": "0.04819277108433735"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "60.85",
        "operationalDemand": "4364.03",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "4.961",
        "region": "VIC1",
        "period": "2020-07-11T06:00:00",
        "renewablesPercentage": "0.013943533843717848",
        "periodSource": "30MIN",
        "percentileRank": "0.024096385542168676"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "46.7",
        "operationalDemand": "4501.5",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "5.0567",
        "region": "VIC1",
        "period": "2020-07-11T06:30:00",
        "renewablesPercentage": "0.010374319671220706",
        "periodSource": "30MIN",
        "percentileRank": "0.03614457831325301"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "39.74",
        "operationalDemand": "4674.07",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.3964",
        "region": "VIC1",
        "period": "2020-07-11T07:00:00",
        "renewablesPercentage": "0.00850222611129059",
        "periodSource": "30MIN",
        "percentileRank": "0.5180722891566265"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "26.84",
        "operationalDemand": "4802.9",
        "rooftopSolar": "0",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "5.962000000000001",
        "region": "VIC1",
        "period": "2020-07-11T07:30:00",
        "renewablesPercentage": "0.005588290407878574",
        "periodSource": "30MIN",
        "percentileRank": "0.1566265060240964"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "54.53",
        "operationalDemand": "5063.22",
        "rooftopSolar": "5.171",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.3205",
        "region": "VIC1",
        "period": "2020-07-11T08:00:00",
        "renewablesPercentage": "0.011779083342228332",
        "periodSource": "30MIN",
        "percentileRank": "0.46987951807228917"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "94.57",
        "operationalDemand": "5296.38",
        "rooftopSolar": "31.63",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "6.741900000000001",
        "region": "VIC1",
        "period": "2020-07-11T08:30:00",
        "renewablesPercentage": "0.023686141730214466",
        "periodSource": "30MIN",
        "percentileRank": "0.26506024096385544"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "95.71",
        "operationalDemand": "5543.84",
        "rooftopSolar": "61.023",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "8.061900000000001",
        "region": "VIC1",
        "period": "2020-07-11T09:00:00",
        "renewablesPercentage": "0.027963752191623593",
        "periodSource": "30MIN",
        "percentileRank": "0.7951807228915663"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "89.35",
        "operationalDemand": "5718.22",
        "rooftopSolar": "110.282",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "9.4237",
        "region": "VIC1",
        "period": "2020-07-11T09:30:00",
        "renewablesPercentage": "0.03425099622510209",
        "periodSource": "30MIN",
        "percentileRank": "0.8433734939759037"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "125.35",
        "operationalDemand": "5758.38",
        "rooftopSolar": "177.494",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "8.0993",
        "region": "VIC1",
        "period": "2020-07-11T10:00:00",
        "renewablesPercentage": "0.05101927702643284",
        "periodSource": "30MIN",
        "percentileRank": "0.8072289156626506"
      },
      {
        "periodType": "ACTUAL",
        "semiScheduledGeneration": "126.19",
        "operationalDemand": "5791.62",
        "rooftopSolar": "299.273",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "8.327000000000002",
        "region": "VIC1",
        "period": "2020-07-11T10:30:00",
        "renewablesPercentage": "0.06985231886358864",
        "periodSource": "30MIN",
        "percentileRank": "0.8192771084337349"
      },
      {
        "period": "2020-07-11T11:00:00",
        "periodType": "ACTUAL",
        "periodSource": "5MIN",
        "latestPeriod": "2020-07-11T10:55:00",
        "region": "VIC1",
        "rooftopSolar": "349.762",
        "usage": "34836.70800",
        "operationalDemand": "34836.70800",
        "wholesaleKWHPrice": "7.77832",
        "renewablesPercentage": "0.08308",
        "percentileRank": "0.7590361445783133"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "159.405",
        "operationalDemand": "5600.83",
        "rooftopSolar": "383.288",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T11:30:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.306535500000001",
        "period": "2020-07-11T11:30:00",
        "region": "VIC1",
        "renewablesPercentage": "0.09068888681673723",
        "periodSource": "30MIN",
        "percentileRank": "0.4578313253012048"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "173.769",
        "operationalDemand": "5478.93",
        "rooftopSolar": "406.281",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T12:00:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.1735268",
        "period": "2020-07-11T12:00:00",
        "region": "VIC1",
        "renewablesPercentage": "0.09856061235527493",
        "periodSource": "30MIN",
        "percentileRank": "0.37349397590361444"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "186.936",
        "operationalDemand": "5388.2",
        "rooftopSolar": "418.882",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T12:30:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.1300185",
        "period": "2020-07-11T12:30:00",
        "region": "VIC1",
        "renewablesPercentage": "0.10432399611371082",
        "periodSource": "30MIN",
        "percentileRank": "0.3493975903614458"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "191.27",
        "operationalDemand": "5326.24",
        "rooftopSolar": "423.355",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T13:00:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.125880300000001",
        "period": "2020-07-11T13:00:00",
        "region": "VIC1",
        "renewablesPercentage": "0.10689883374394198",
        "periodSource": "30MIN",
        "percentileRank": "0.3253012048192771"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "192.577",
        "operationalDemand": "5308.89",
        "rooftopSolar": "407.741",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T13:30:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.262435399999999",
        "period": "2020-07-11T13:30:00",
        "region": "VIC1",
        "renewablesPercentage": "0.10501255022407427",
        "periodSource": "30MIN",
        "percentileRank": "0.42168674698795183"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "197.333",
        "operationalDemand": "5293.14",
        "rooftopSolar": "393.241",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T14:00:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.0488484",
        "period": "2020-07-11T14:00:00",
        "region": "VIC1",
        "renewablesPercentage": "0.10385762051469993",
        "periodSource": "30MIN",
        "percentileRank": "0.30120481927710846"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "204.542",
        "operationalDemand": "5278.75",
        "rooftopSolar": "356.816",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T14:30:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.0183157000000005",
        "period": "2020-07-11T14:30:00",
        "region": "VIC1",
        "renewablesPercentage": "0.09960987059684866",
        "periodSource": "30MIN",
        "percentileRank": "0.2891566265060241"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "214.737",
        "operationalDemand": "5294.06",
        "rooftopSolar": "302.126",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T15:00:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.283951400000001",
        "period": "2020-07-11T15:00:00",
        "region": "VIC1",
        "renewablesPercentage": "0.09235986795292363",
        "periodSource": "30MIN",
        "percentileRank": "0.4457831325301205"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "223.59",
        "operationalDemand": "5368.8",
        "rooftopSolar": "233.021",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T15:30:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.428237300000001",
        "period": "2020-07-11T15:30:00",
        "region": "VIC1",
        "renewablesPercentage": "0.08151117288467447",
        "periodSource": "30MIN",
        "percentileRank": "0.5542168674698795"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "227.498",
        "operationalDemand": "5437.86",
        "rooftopSolar": "151.69",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T16:00:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.422366600000001",
        "period": "2020-07-11T16:00:00",
        "region": "VIC1",
        "renewablesPercentage": "0.06783873478186975",
        "periodSource": "30MIN",
        "percentileRank": "0.5421686746987951"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "194.459",
        "operationalDemand": "5550.66",
        "rooftopSolar": "70.017",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T16:30:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.475487800000001",
        "period": "2020-07-11T16:30:00",
        "region": "VIC1",
        "renewablesPercentage": "0.04705411821387353",
        "periodSource": "30MIN",
        "percentileRank": "0.6144578313253012"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "154.308",
        "operationalDemand": "5784.49",
        "rooftopSolar": "10.184",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T17:00:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "7.676948400000001",
        "period": "2020-07-11T17:00:00",
        "region": "VIC1",
        "renewablesPercentage": "0.02838675652849496",
        "periodSource": "30MIN",
        "percentileRank": "0.7108433734939759"
      },
      {
        "periodType": "FORECAST",
        "semiScheduledGeneration": "134.22",
        "operationalDemand": "6079.53",
        "rooftopSolar": "0",
        "forecastedAt": "2020-07-11T10:30:00",
        "forecastedAt+period": "2020-07-11T10:30:00+2020-07-11T17:30:00",
        "createdAt": "2020-07-11T10:54:41",
        "wholesaleKWHPrice": "11.1968989",
        "period": "2020-07-11T17:30:00",
        "region": "VIC1",
        "renewablesPercentage": "0.02207736453311358",
        "periodSource": "30MIN",
        "percentileRank": "0.9156626506024096"
      },
      <truncated>
    ]

Hi all,

Thanks for raising these issues. Apologies for the delay in responding, my wife had a baby 2 weeks ago so I’ve been trying to stay away from the keyboard for a few weeks to get everyone settled. I’ll take a look at the above and commit changes back into the Github repo to fix ASAP.

Thanks,
Lewis

1 Like

No stress mate. Congrats on the newborn!

Congrats onthe bub! Just joined Amber and was excited to see your project for sensor data.

I too am getting failures, look forward to your update!

2020-07-21 13:56:10 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up amberelectric platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/amberelectric/sensor.py", line 45, in setup_platform
    AmberPricingSensor(amber_data, postcode, CONST_SOLARFIT, "Amber solar feed in tariff", "mdi:solar-power"),
  File "/config/custom_components/amberelectric/sensor.py", line 62, in __init__
    self.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 239, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/amberelectric/sensor.py", line 157, in update
    self.amber_data = AmberData.from_dict(json.loads(response.text))
  File "/config/custom_components/amberelectric/ambermodel.py", line 433, in from_dict
    data = Data.from_dict(obj.get("data"))
  File "/config/custom_components/amberelectric/ambermodel.py", line 396, in from_dict
    VariablePricesAndRenewable.from_dict, obj.get("variablePricesAndRenewables")
  File "/config/custom_components/amberelectric/ambermodel.py", line 51, in from_list
    return [f(y) for y in x]
  File "/config/custom_components/amberelectric/ambermodel.py", line 51, in <listcomp>
    return [f(y) for y in x]
  File "/config/custom_components/amberelectric/ambermodel.py", line 315, in from_dict
    created_at = from_datetime(obj.get("createdAt"))
  File "/config/custom_components/amberelectric/ambermodel.py", line 41, in from_datetime
    return dateutil.parser.parse(x)
  File "/usr/local/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 1374, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 646, in parse
    res, skipped_tokens = self._parse(timestr, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 725, in _parse
    l = _timelex.split(timestr)         # Splits the timestr into tokens
  File "/usr/local/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 207, in split
    return list(cls(s))
  File "/usr/local/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 76, in __init__
    '{itype}'.format(itype=instream.__class__.__name__))
TypeError: Parser must be a string or character stream, not NoneType

My pull request should resolve that issue mate: https://github.com/lewisbenge/hass-amber-electric/pull/9
Be great if you could test and confirm :slight_smile:

Congratulations on the bub Lewis.
:smiley:

Yep it did! Awesome, thanks. Will add it in and have a play shortly.

1 Like

All seems to be working fine although I have noticed I am pulling a different wholesale price comapred to my phone app - suspect because postcode is defaulting to CitiPower rather than Jemena in my area.

EDIT: as already meantioned by @boc

Hi Guys,

I’m back in front of my PC this week. I’ve approved the PR from @boc to fix the serialisation issues causing the crashes. I’ve also see a bunch of issues raised in Github, so I’ll work through them.

Note I don’t actually work for Amber, so I’m working with the limitations of the API they have supplied. Unfortunately until they supply a personalized feed we may continue to see issues specific to the use cases.

I’ll post again once I’ve had a chance to get the tweaks in-place.

Thanks,
Lewis

2 Likes

Just had this up and running for a few days to check it out, awesome work. I have noticed that the integration appears to be running off UTC+1 (or -9 hours from current AEST). I.e current time is 18:54 but the sensor is showing last update as 09:53 (which is also the earliest lookback in the the actuals)

When looking at the actual and forecast price feed, it looks like the historical actuals go back 9 hours - when checking the historic actuals against the amber app you can easily align them (which is great) however they are out by one, i.e. the cost in the amber app for 18:00 is 27c, 17:30 is 28c, 17:00 is 24c. In the historic actuals they show as 18:30 is 27c, 18:00 is 28c, 17:30 is 24c. etc

I see there are a few comments that may be related and an open issue, so all good if this is a known issue and working on it, let me know if I can provide anything else to help?

Cheers,
Mike

Ok, so just realised I hadn’t localised my raspberry pi… that sorted out some of the issues I was seeing. I’m still seeing a offset issue with the forecast being off by 30 mins, i.e. app is saying now (19:30) 24c, 20:00 is 25c, 20:30 is 24c etc and HA sensor has forecast which matches at 20:00 is 24c, 20:30 at 25c, 21:00 at 24c etc - clearly offset by 1 period incorrectly, unless the sensor is showing “up to that time” whereas the app is showing “from that time”? In which case they align perfectly. Am I just reading it wrong?

Hi, I’ve completed the first steps of adding the components to my folder, and adding my postcode in config yaml, but I’m hoping you could be kinda enough to help me achieve my main goal (or secondary goal if not)

All I want to initially do is be able to ask my google home (series of minis around my house, along with my phone) “hey google, what’s the price?”
And I’m hoping it can just respond with “the current price is 23c” or something.

That way my family can quickly check if it’s time to turn on high power usage appliances like dishwashers, rather than having to open the app and find out (sounds like a pretty basic task but one that gets ignored!)

My secondary goal, whether than can be achieved or not, would be to have a toggle or something (IFTTT widget) on my Android phones maiN screen that lets me click to see the live price?

Going forwards, either an automated, or when prompted “the price is forecast to spike at $XX today at XXYYpm” would be a really cool goal for later down the track.

If all this is too tricky, would a simpler task of setting a price trigger to turn on a wifi power switch work? That way if the price goes above a pre-determined price, it could trigger a switch to turn on which would turn on a red led light in my living room to alert that power is expensive and dirty.

If I can contribute any way, I’d love to help - the one thing I can possibly bring to the table is a direct contact with one of the founders of Amber :slight_smile:
Cheers

(should add, since this post, I’ve been able to successfully link Google home to HA the dreaded manual way)

1 Like

Just to update: I have successfully integrated this component (the current price sensor) with Google Home, allowing me to ask any of my home minis “hey google, power price”, and she responds “the current price is 17.25 cents”.

Very happy this result, and will do perfectly until Amber get around to adding google home support. Bonus of having this component is that you can also add a widget on Android that shows the live price (with tap to update). Again, does what I need until Amber get around to adding widgets.

Anyone know how to switch the sensor to 5 minute rather than 30 minute intervals?

I think the actual data is only in 30min intervals, and the sensor by default checks every 15mins.
But the issue I’m finding is that it will be 7:10pm, and it’s still showing the 6:30pm price.
This seems to be because there is 2 “actual” prices? The Amber app price is always between 15-30mins “ahead” of the price shown in the sensor…