hass-amber-electric icon indicating copy to clipboard operation
hass-amber-electric copied to clipboard

** ATTENTION **

Open davewatson91 opened this issue 3 years ago • 93 comments

I have been in contact with Amber -> this API will be deprecated over a 6 month period, with a new API almost ready for release. One of the developers at Amber (creating the API, will also be developing (in his personal capacity I believe) an integration for Home Assistant.

davewatson91 avatar May 28 '21 05:05 davewatson91

Interesting development!

On Fri, 28 May 2021, 3:01 pm David Watson, @.***> wrote:

I have been in contact with Amber -> this API will be deprecated over a 6 month period, with a new API almost ready for release. One of the developers at Amber (creating the API, will also be developing (in his personal capacity I believe) an integration for Home Assistant.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lewisbenge/hass-amber-electric/issues/25, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTQSL2ZXXUVJYSXFZ6WKKDTP4PQZANCNFSM45VXORJQ .

bengAThome avatar May 29 '21 11:05 bengAThome

I was in contact with them last week as well. I noticed that during the recent price spikes in my area that the API was returning drastically different results to the app. They confirmed that they have done a lot of recent work on the pricing in the app but haven't updated the API accordingly. They then confirmed they are working on a new API but they didn't say one of their devs was going to develop the HA plugin, so that's good news.

micarex avatar Jun 01 '21 22:06 micarex

at they have done a lot of recent work on the pricing in the app but haven't updated the API accordingly. They then confirmed they are workin

Have noticed the same - we've had some horrible spikes of recent - almost enough to question our change from our previous provider.... Having the API working would certainly help us with mitigating some costs, but it's hard to mitigate with hours of $1+ spikes per evening.

I suspect maybe he's not advertising it too much, as I suspect it will not be an official Amber integration? Hopefully it won't take too long until we see it up and running!

davewatson91 avatar Jun 01 '21 22:06 davewatson91

Yeah these spikes have been challenging, I was thinking the same that it might be better to go back to single tariff. However the average still seems to be working out. I hope whoever at Amber that does the Dev work engages with us though, and does not just do it on their own...

On Wed, 2 Jun 2021, 8:33 am David Watson, @.***> wrote:

at they have done a lot of recent work on the pricing in the app but haven't updated the API accordingly. They then confirmed they are workin

Have noticed the same - we've had some horrible spikes of recent - almost enough to question our change from our previous provider.... Having the API working would certainly help us with mitigating some costs, but it's hard to mitigate with hours of $1+ spikes per evening.

I suspect maybe he's not advertising it too much, as I suspect it will not be an official Amber integration? Hopefully it won't take too long until we see it up and running!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lewisbenge/hass-amber-electric/issues/25#issuecomment-852526622, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTQSLZL7OL5NZS46HZL66TTQVNZ3ANCNFSM45VXORJQ .

bengAThome avatar Jun 01 '21 23:06 bengAThome

I'm the Amber Dev 👋

madpilot avatar Jun 01 '21 23:06 madpilot

I suspect maybe he's not advertising it too much, as I suspect it will not be an official Amber integration?

Once I've got something that I can start showing you all, I will. The plan is to have it part of Home Assistant core, rather than a custom component, but to start with a custom component makes the most sense, but that won't happen until we finish the API work, which is close, but we are a small team, and my attention is diverted on almost a daily basis.

Big ups to @lewisbenge for getting this component out! I'm using his integration at the moment too. I've been controlling my ducted air conditioning based on network prices (using the same wrong API as all of you - I can't even get access to it remotely yet, and I'm the one writing it!) - it's definitely helped me make a business case for this work.

madpilot avatar Jun 02 '21 00:06 madpilot

Great to hear Myles! I agree, the current API isn't perfect, but I am manually using it as a check before using power hungry devices, like dryers etc I'm working on using RGB LEDs to provide a traffic light style indication near all these devices, with a bit of extra intelligence. Eg green for cheap etc, but also have them animate the direction. Eg green going Amber red to indicate the price direction is heading up.

The second piece of the puzzle is to get real-time power usage. (Currently using Powerpal) but want to get it automatic too.

On Wed, 2 Jun 2021, 10:12 am Myles Eftos, @.***> wrote:

I suspect maybe he's not advertising it too much, as I suspect it will not be an official Amber integration?

Once I've got something that I can start showing you all, I will. The plan is to have it part of Home Assistant core, rather than a custom component, but to start with a custom component makes the most sense, but that won't happen until we finish the API work, which is close, but we are a small team, and my attention is diverted on almost a daily basis.

Big ups to @lewisbenge https://github.com/lewisbenge for getting this component out! I'm using his integration at the moment too. I've been controlling my ducted air conditioning based on network prices (using the same wrong API as all of you - I can't even get access to it remotely yet, and I'm the one writing it!) - it's definitely helped me make a business case for this work.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lewisbenge/hass-amber-electric/issues/25#issuecomment-852582331, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTQSL3RBZEX4GFQBIN3JHLTQVZOZANCNFSM45VXORJQ .

bengAThome avatar Jun 02 '21 00:06 bengAThome

The new API will have 24-hour delayed usage, but we don't have access to real-time at the moment. For reactive real-time (ie, how much power are you using this instant) Powerpal or Eagle 200 (or similar) or getting a battery with an API are your best bet

madpilot avatar Jun 02 '21 00:06 madpilot

The new API will have 24-hour delayed usage, but we don't have access to real-time at the moment. For reactive real-time (ie, how much power are you using this instant) Powerpal or Eagle 200 (or similar) or getting a battery with an API are your best bet

I've actually just setup ESPHome on an ESP32 to use the CircuitSetup board. I have to admit that this is the best bit of energy monitoring that I've ever used - its accurate, configurable and running ESPHome make it super easy. I will be interested to pull the stats in, but the 24hr delay is still OK for that, so long as the real time pricing is spot on :)

Let us know if you need any help in getting the component off the ground (or working for core)- it is definitely super valuable (I'm switching A/C, Hot Tub & Hot Water Service currently, which combined can avoid inadvertently using 14kWh)

davewatson91 avatar Jun 02 '21 00:06 davewatson91

ESPHome on an ESP32 to use the CircuitSetup board.

Nice! I'm investigating using Zigbee to talk to my smart meter, as it's non-intrusive. However, my meter is quite far from my house and has (ironically) no power, so the Eagle 200 won't work. I'm looking at homebrewing something, possibly solar powered.

madpilot avatar Jun 02 '21 00:06 madpilot

That's a nice board! Definitely an option once I can afford it :) Powerpal us a great device, but no API. The 24hr delay is fine for me too. It's the spot price that I'd like to be 💯 accurate.

On Wed, 2 Jun 2021, 10:45 am David Watson, @.***> wrote:

The new API will have 24-hour delayed usage, but we don't have access to real-time at the moment. For reactive real-time (ie, how much power are you using this instant) Powerpal or Eagle 200 (or similar) or getting a battery with an API are your best bet

I've actually just setup ESPHome on an ESP32 to use the CircuitSetup board https://circuitsetup.us/product/expandable-6-channel-esp32-energy-meter/. I have to admit that this is the best bit of energy monitoring that I've ever used - its accurate, configurable and running ESPHome make it super easy. I will be interested to pull the stats in, but the 24hr delay is still OK for that, so long as the real time pricing is spot on :)

Let us know if you need any help in getting the component off the ground (or working for core)- it is definitely super valuable (I'm switching A/C, Hot Tub & Hot Water Service currently, which combined can avoid inadvertently using 14kWh)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lewisbenge/hass-amber-electric/issues/25#issuecomment-852612103, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTQSLZXGT5VL5M4EY3TRPLTQV5KZANCNFSM45VXORJQ .

bengAThome avatar Jun 02 '21 01:06 bengAThome

ESPHome on an ESP32 to use the CircuitSetup board.

Nice! I'm investigating using Zigbee to talk to my smart meter, as it's non-intrusive. However, my meter is quite far from my house and has (ironically) no power, so the Eagle 200 won't work. I'm looking at homebrewing something, possibly solar powered.

Unfortunately the smart meter I have doesn't have the Zigbee option, only GSM from what I could dig up :( That was ultimately my first goal. The beauty of the CircuitSetup board is that I can manage individual circuits, and take into account power factor, reverse current and such. Example of how I'm currently setup (although not my final intent, just the quick and dirty to get up and running). I've got rules setup to run things when I'm exporting power and such.

image

davewatson91 avatar Jun 02 '21 01:06 davewatson91

That looks 1000 times better than my dashboard lol.

On Wed, 2 Jun 2021, 11:06 am David Watson, @.***> wrote:

ESPHome on an ESP32 to use the CircuitSetup board.

Nice! I'm investigating using Zigbee to talk to my smart meter, as it's non-intrusive. However, my meter is quite far from my house and has (ironically) no power, so the Eagle 200 won't work. I'm looking at homebrewing something, possibly solar powered.

Unfortunately the smart meter I have doesn't have the Zigbee option, only GSM from what I could dig up :( That was ultimately my first goal. The beauty of the CircuitSetup board is that I can manage individual circuits, and take into account power factor, reverse current and such. Example of how I'm currently setup (although not my final intent, just the quick and dirty to get up and running). I've got rules setup to run things when I'm exporting power and such.

[image: image] https://user-images.githubusercontent.com/51277302/120408498-80e40200-c392-11eb-8fb2-1e24158f6e1b.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lewisbenge/hass-amber-electric/issues/25#issuecomment-852629940, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTQSL2TU2LZ3TM4BTP6T6DTQV7Z5ANCNFSM45VXORJQ .

bengAThome avatar Jun 02 '21 01:06 bengAThome

How is everyone writing their automations? YAML, UI, NodeRed, Appdaemon, other?

madpilot avatar Jun 02 '21 01:06 madpilot

I migrated to NodeRed about 6 months back, and surprisingly haven't looked back. Running HA / NodeRed in Docker (amongst 20 other containers).

davewatson91 avatar Jun 02 '21 01:06 davewatson91

Mixture some Yaml, some node-red. Plus use grafana for those sweet graphs :)

On Wed, 2 Jun 2021, 11:28 am David Watson, @.***> wrote:

I migrated to NodeRed about 6 months back, and surprisingly haven't looked back. Running HA / NodeRed in Docker (amongst 20 other containers).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lewisbenge/hass-amber-electric/issues/25#issuecomment-852640109, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTQSL4X3ABD6KFUG4OUDHDTQWCMBANCNFSM45VXORJQ .

bengAThome avatar Jun 02 '21 01:06 bengAThome

How is everyone writing their automations? YAML, UI, NodeRed, Appdaemon, other?

I'm currently using the UI for my automations but I'm in the process of adding AppDaemon because I need to execute more complex logic than what the HASS automations allow. I also need to send REST APIs calls with Digest authentication to my Fronius inverter from a script and as best I can tell, there's nothing in HASS that can do this at the moment.

I'm switching hot water heating, reverse cycle aircon, wireless GPOs (Ikea Tradfri) and wired GPOs (NetIO), and charging battery from grid when Amber price is low and discharging when price is high. The built in automations do a good job for simple tasks and I'll keep them going, but I need to start writing custom Python to add more complex stuff. I'm also doing my more complex graphing & analysis in InfluxDB 2.

Example InfluxDB 2 image

Example HASS Dashboard image

micarex avatar Jun 06 '21 00:06 micarex

@micarex intrigued as to how you're controlling the flow to/from the grid?

Why the appdaemon vice something like NodeRed?

davewatson91 avatar Jun 06 '21 01:06 davewatson91

@micarex intrigued as to how you're controlling the flow to/from the grid?

Why the appdaemon vice something like NodeRed?

I probably could use node red and write my complex logic in js. However I've already written quite a lot of python code to do what I want. I wrote it before I discovered HASS so I figure it is easier for me to keep going with python. I'm in the process of writing a trading algorihtm which detects the best price ranges during the day to buy and sell energy and then I need to control the relays to turn devices on/off based on those time periods. So far I've been using somewhat fixed values (e.g. If Amber feed is price is greater than 15c then discharge battery to grid, but I'm now moving to more sophisticated approach of figuring out the optimum time based on forecast prices. Also determining whether to discharge/charge battery is also heavily influenced by other variables such as time of day and battery SOC. e.g. No point discharging battery and exhausting battery energy at 5 p.m. at 15c feed in if I am only going to have to buy it back at 6-7 pm at 30c to cater for evening energy usage.).

As for grid flow, at the moment it is fairly simple (in logic) right now which is why I want to improve it.

It have a set of HASS automations which are triggered based on the Amber pricing. image

Based on thresshold values I then run scripts to send MODBUS commands to my Fronius inverter to tell the battery to charge/discharge.

image

But I'd like to improve these to charge at a calculated percentage rate depending on forecast pricess too.

micarex avatar Jun 06 '21 01:06 micarex

I found that one of the unintended consequences of setting the battery to discharge to grid is that the Fronius inverter then turns on my hot water and aircon relays at the wrong time because the smart meter tells the Fronius that there is excess energy flowing to the grid and under normal circumstances this means I have excess solar going to the grid so I want to consume the energy via hot water heating and running aircon (heating) rather than getting paid a pittance to send it to the grid. However the so called 'smart meter' has no idea why energy is flowing to the grid. So when the battery is discharging to the grid I need to turn off the Fronius relay automations to stop it consuming the energy I am deliberately trying to send to the grid when Amber price is high. This requires me to send a REST API call using digest authentication to the Fronius Inverter.

micarex avatar Jun 06 '21 01:06 micarex

So they're the same logic pains that I'm running through now. Balancing it with trying to make sure that the hot-tub and hot water service get enough periods of running throughout the day to stay hot, while trying to optimise using the cheapest prices..

What sort of battery storage are you running with the fronius? I've been tossing up with this as the next logical step....

The direction of flow has also been something I've been working on. Turns out that the smart meters are useless for it, but the power monitor I mentioned above does handle current flow direction - has helped with that same problem.

davewatson91 avatar Jun 06 '21 08:06 davewatson91

What model Fronius are you running?

davewatson91 avatar Jun 06 '21 08:06 davewatson91

What model Fronius are you running?

I have two. A Primo 4.0kw and I also have a Primo Gen24 6.0kw hybrid inverter. I am on the beta program for the Gen24 and the largest model they make is 6.0kw at the moment, so I had to get the Primo 4.0 to make a 10kw system (with 12.54kw of panels). I use the Gen24 for all the smart stuff because it has much more advanced power control. Having said that, most of the stuff I'm doing can also be done with the Primo (or the 3 phase Symo).

micarex avatar Jun 06 '21 08:06 micarex

Refer https://www.mcelectrical.com.au/wp-content/uploads/2017/02/Fronius_Feature.x29689.pdf page 5 for the basic concept. The Fronius inverters have 4 inbuilt 12v relays that can be use to control contactors to switch 240v loads.

micarex avatar Jun 06 '21 08:06 micarex

I am using a BYD Battery Box HVM 11.04kwh battery. This is the Fronius recommended battery for use with the Gen24 inverters now that they don't produce batteries themselves.

micarex avatar Jun 06 '21 08:06 micarex

Can you elaborate on the direciton of flow issue. I can tell direction of flow using my Fronius Smart meter. Power values are negative or positive depending on direction of flow. Refer Power Grid guage in the screen shot I posted. It shows +1016.88w where one I have taken just now shows negative.

image

micarex avatar Jun 06 '21 09:06 micarex

Yeah ok - so that's the same, and you have the same generation stats - why not roll those metrics as a conditional check into the automations for the relays? (i.e. if producing x watts, don't turn off, or if feed in tarrif is high, don't turn on, to maximise production).

davewatson91 avatar Jun 06 '21 09:06 davewatson91

Yeah ok - so that's the same, and you have the same generation stats - why not roll those metrics as a conditional check into the automations for the relays? (i.e. if producing x watts, don't turn off, or if feed in tarrif is high, don't turn on, to maximise production).

I'm already doing some checks of metrics in the HA automations, but there's a more fundamental limitation that I came across.

The problem is that the Fronius relay setting are not that sophisticated. And HASS can't actually control the relays directly because there is no published REST API or MODBUS commands to control the relays. You just set the values in the UI. e.g.

image

So my automations are currently split between HA and the Fronius inverter. The Fronius does hot water diversion and reverse cycle aircon, and I'm using HA for battery charge/discharge and GPOs.

My next step is to get HA to control the lot so that they all work in harmony. I had to figure out a way for HA to control the relays. This bit was very tricky. Since there is not official interface on the inverter to make this happen, I ended up sniffing the network traffic with wireshark between the UI and the inverter. Turns out there is a set of internal APIs and JSON values that I have learned to mimick. Using this method I can control the configuration of the relays (on/off and thressholds) programmatically. However the Fronius requires digest authentication for the internal APIs to work. I have a few hundreds lines of python to do the digest auth and construct the appropriate API calls. I successfully got this running via AppDaemon a couple of weeks ago.

So that was a long answer to your question, but now I should now be able to automate the lot from HA dynamically setting the relays settings on the Fronius. And I can incorporate whatever other conditions and variables into the mix as you've suggested.

micarex avatar Jun 06 '21 09:06 micarex

yeah wow - I missed the fundamental piece about the relays not being externally controllable.

I will be bookmarking this, after reading up on the fronius, it looks like it may fit the bill for what I need.....

Thanks!

davewatson91 avatar Jun 07 '21 03:06 davewatson91

Just curious, how will you go with the remote power grid control? Where they will turn off your export if the grid gets unstable.

On Mon, 7 Jun 2021, 1:57 pm David Watson, @.***> wrote:

yeah wow - I missed the fundamental piece about the relays not being externally controllable.

I will be bookmarking this, after reading up on the fronius, it looks like it may fit the bill for what I need.....

Thanks!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lewisbenge/hass-amber-electric/issues/25#issuecomment-855556407, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTQSL4Z753545DY6VSSZOLTRQ7QZANCNFSM45VXORJQ .

bengAThome avatar Jun 07 '21 06:06 bengAThome