lewisbenge / hass-amber-electric

Home Assistant Component to pull the latest energy prices from Amber Electric
MIT License
27 stars 7 forks source link

Community Discussion vs Issue #24

Closed darren365 closed 3 years ago

darren365 commented 3 years ago

Any chance Discussions be enabled for this repository? Would be great to have Issues exclusively available for problems and where ideas and general engagement activity surfaced via Discussions.

https://docs.github.com/en/discussions

bengAThome commented 3 years ago

Not sure if this project is still active?

It still works for me though. So kudos to lewisbenge!

davewatson91 commented 3 years ago

I haven't dug, but assume there are no active forks? - I'm using it, and would like to see it's continued development!

darren365 commented 3 years ago

Also working for me. Am only new to Home Assistant and this project was the driver for implementing. Only have it showing a dashboard related to current and future pricing (using the information shared here by others), but this is the type of discussion that I'd love to have, understanding how others are using the feed. My intention is to use price level as a trigger for turning off specific devices. I'm not a developer but can work things out, I intend to read up on issue #20 as this would seem to have a fixed date for resolution whereby anything I create breaks if not resolved.

davewatson91 commented 3 years ago

Noting the impending blocking of custom components without a manifest, I've created a fork where I will do my best to get us to a point where it can be continued to be used.

Happy to work on any issues I can, and manage the fork, however am not a dev, so welcome any PR's.

davewatson91/hass-amber-electric

micarex commented 3 years ago

This integration is working well for me. I have created automations for my solar/battery installation using HA and I use this integration to determine when to send energy to the grid (from my battery) or when to charge the battery from the grid. I also send the sensor data to Influx DB so I can create graphs of the pricing when the standard HA ones aren't up to it. I was just about to get working on the adding the version to the manifest file to remove the warning message, but it looks like @davewatson91 has already done it. Thanks @davewatson91 and thanks to @lewisbenge for creating the initial version.

davewatson91 commented 3 years ago

This integration is working well for me. I have created automations for my solar/battery installation using HA and I use this integration to determine when to send energy to the grid (from my battery) or when to charge the battery from the grid. I also send the sensor data to Influx DB so I can create graphs of the pricing when the standard HA ones aren't up to it. I was just about tp get working on the adding the version to the manifest file to remove the warning message, but it looks like @davewatson91 has already done it. Thanks @davewatson91 and thanks to @lewisbenge for created the initial version.

Not a worry at all.

Really interested how you're controlling the load between sending and pulling from the grid - something I've looked into, but hadn't worked out yet.....

micarex commented 3 years ago

I'm using the HA Automations to check when the state of the Amber sensor is above/below a certain price and then I use modbus to get my Fronius inverter to tell the battery to charge/discharge. Took me a few months of research and some discussions with Fronius support to figure out how to do this, but turns out the Fronius has hundreds of control commands via MODBUS that can't be seen in the UI, but HA can use them all. Refer here for MODBUS codes if you happen to have a Fronius device.

If you do have a Fronius device I can provide further info on the configuration.yaml settings to get the MODBUS going.

My setup is roughly as follows: -Fronius Inverter (I actually have a Primo and a Gen24) with 12.54 kw of panels -11.04 kwh BYD Battery controlled by Fronius Gen24 inverter -Power diversion when excess solar is available and grid price is low -Use 1xrelay on Fronius Inverter to heat hot water -If more solar available 1xrelay on Fronius Inverter to turn on/off reverse cycle aircon -If more solar available activate Netio Smart Powerpoint to turn on Heller column heater -If grid price is high, stop using loads, and send the power to the grid instead

I have also used the Ikea TRÅDFRI wireless smart plugs to control loads as well. These work well (requires TRÅDFRI hub), but I prefer to use LAN based devices so I'm using NetIO instead. But the Ikea solution is definitely much cheaper, works well and has OOTB HA integration available.


Sample automation: Check the amber price, then check if the battery is more than 70% charged and if it is, call a script to activate the battery discharge function on the inverter, and send me a notification to let me know.


alias: >- 001.On - Discharge battery to grid when Amber solar feed-in is higher than F.I.T description: >- Checks the Amber energy solar feed in price and switches on discharge to grid if solar feed in rate is high (which is a negative number in amber API) trigger:


And this is the script that is called from the automation above


alias: Discharge Battery to Grid at Rate 100% sequence:

bengAThome commented 3 years ago

That is awesome work micarex.

I don't have solar, but I do have a Powerpal, so I'm hoping to integrate it. Then I can use the realtime data from Powerpal and the predictive data from Amber to guide decisions on whether to put the aircon on or the dryer, oven etc.

micarex commented 3 years ago

I just took at look at Powerpal. Seems they don't yet have an API (or other integration method) to be able to read data from the device in real time, but they are considering creating an API. https://support.powerpal.net/hc/en-us/articles/360053641894-Can-I-export-data-from-Powerpal-and-is-there-an-API-available-

Do you know of any way to get the data from the device? It looks like the only way at the moment is to download a CSV of the last 60 days of data. If you wrote a script to load that info to InfluxDB or MongoDB (or some other DB that has a rest interface) you could then use the rest sensor to read the values. Not exactly elegant but it might be possible to make this work.

micarex commented 3 years ago

I just looked through the HA docs and found that there is a file reader integration as well. I haven't used this but it looks like it would do the job if you have a way to regularly download the data from the Powerpal to a directory.

Alternatively you could use the Command Line sensor and use a regex expression to extract the values you need. This might be better because you could potentially use CURL to download the file, then process it with the regex to get the values you need.

bengAThome commented 3 years ago

Yep. I've applied for access to the API beta, waiting to hear back from them.

Fallback would be the file export route. I was thinking maybe running an android emulator with the Powerpal app installed and scraping the numbers.

But, to be honest I think I'd rather build an esphome smart metre reader :)

On Sun, 16 May 2021, 2:56 pm micarex, @.***> wrote:

I just took at look at Powerpal. Seems they don't yet have an API (or other integration method) to be able to read data from the device in real time, but they are considering creating an API.

https://support.powerpal.net/hc/en-us/articles/360053641894-Can-I-export-data-from-Powerpal-and-is-there-an-API-available-

Do you know of any way to get the data from the device? It looks like the only way at the moment is to download a CSV of the last 60 days of data. If you wrote a script to load that info to InfluxDB or MongoDB (or some other DB that has a rest interface) you could then use the rest sensor to read the values. Not exactly elegant but it might be possible to make 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/24#issuecomment-841766507, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTQSL72ATEY2DWXQANRQLLTN5F6TANCNFSM44AAVYPQ .

davewatson91 commented 3 years ago

I'm using the HA Automations to check when the state of the Amber sensor is above/below a certain price and then I use modbus to get my Fronius inverter to tell the battery to charge/discharge. Took me a few months of research and some discussions with Fronius support to figure out how to do this, but turns out the Fronius has hundreds of control commands via MODBUS that can't be seen in the UI, but HA can use them all. Refer here for MODBUS codes if you happen to have a Fronius device.

If you do have a Fronius device I can provide further info on the configuration.yaml settings to get the MODBUS going.

My setup is as roughly as follows: -Fronius Inverter (I actually have a Primo and a Gen24) with 12.54 kw of panels -11.04 kwh BYD Battery controlled by Fronius Gen24 inverter -Power diversion when excess solar is available and grid price is low -Use 1xrelay on Fronius Inverter to heat hot water -If more solar available 1xrelay on Fronius Inverter to turn on/off reverse cycle aircon -If more solar available activate Netio Smart Powerpoint to turn on Heller column heater -If grid price is high, stop using loads, and send the power to the grid instead

I have also used the Ikea TRÅDFRI wireless smart plugs to control loads as well. These work well (requires TRÅDFRI hub), but I prefer to use LAN based devices so I'm using NetIO instead. But the Ikea solution is definitely much cheaper, works well and has OOTB HA integration available.

Sample automation: Check the amber price, then check if the battery is more than 70% charged and if it is, call a script to activate the battery discharge function on the inverter, and send me a notification to let me know.

alias: >- 001.On - Discharge battery to grid when Amber solar feed-in is higher than F.I.T description: >- Checks the Amber energy solar feed in price and switches on discharge to grid if solar feed in rate is high (which is a negative number in amber API) trigger:

  • platform: numeric_state entity_id: sensor.amber_solar_feed_in_tariff below: '-25.00' condition:
  • condition: numeric_state entity_id: sensor.byd_40362_state_of_charge above: '70' action:
  • service: script.turn_on data: {} entity_id: script.discharge_battery_to_grid_at_rate_100
  • service: notify.mobile_app_my_phone data: message: >- {{states('sensor.date_time')}} Battery=Discharge to grid. Amber general: {{states('sensor.amber_general_usage_price')}}c. Amber solar: {{states('sensor.amber_solar_feed_in_tariff')}}c. Battery s.o.c: {{states('sensor.byd_40362_state_of_charge')}}% mode: single

And this is the script that is called from the automation above

alias: Discharge Battery to Grid at Rate 100% sequence:

  • service: switch.turn_on data: {} target: entity_id: switch.toggle_40367_charge_limit_inwrte_neg_100
  • service: switch.turn_on target: entity_id: switch.toggle_charge_limit mode: single icon: 'mdi:battery'

What a setup!

How are your relays setup from the inverter? - I imagine that the loads are quite high on these? - I was looking into having a series of contactors installed on teh switchboard, then controlling these with either smart plugs or a microcontroller.

micarex commented 3 years ago

The Fronius inverters have a set of 4x12v relays that can control contactors in the switchboard. Refer this paper. I was surprised to find that almost nobody uses this functionality. I have been part of the Fronius beta program for their Gen24 Single Phase model and from discussions with Fronius and my installer, it seems I'm one of only a few people in AU who have setup this kind of solution. The previous generation inverters also have this feature which is why I was so surprised it hasn't been utilised much. My motivation was to utilise as much of the solar as possible rather than sending it to the grid and getting paid a pittance for it. So my system optimises usage via combination of battery, switching loads on and off and sending or charging from grid when conditions make sense to do so. Other inverters also have similar functionality, sometimes via add on modules such as SMA. If you don't have an inverter with the relay switching capability, there are quite a few after market solutions such Loxone which can control the relays although many of them can only be found overseas. The main thing you will need is a smart meter which can be read to understand the energy flow to/from your house. Smart plugs are a good way to start because they don't require a sparky to control the loads.

davewatson91 commented 3 years ago

The Fronius inverters have a set of 4x12v relays that can control contactors in the switchboard. Refer this paper. I was surprised to find that almost nobody uses this functionality. I have been part of the Fronius beta program for their Gen24 Single Phase model and from discussions with Fronius and my installer, it seems I'm one of only a few people in AU who have setup this kind of solution. The previous generation inverters also have this feature which is why I was so surprised it hasn't been utilised much. My motivation was to utilise as much of the solar as possible rather than sending it to the grid and getting paid a pittance for it. So my system optimises usage via combination of battery, switching loads on and off and sending or charging from grid when conditions make sense to do so. Other inverters also have similar functionality, sometimes via add on modules such as SMA. If you don't have an inverter with the relay switching capability, there are quite a few after market solutions such Loxone which can control the relays although many of them can only be found overseas. The main thing you will need is a smart meter which can be read to understand the energy flow to/from your house. Smart plugs are a good way to start because they don't require a sparky to control the loads.

That's actually really good.

I will have to look into this - I've been tossing around with the idea of using a decent size UPS to do this, but hadn't worked out how to manage the load back/forth to the grid.

The Fronius looks like a decent system with some serious capabilities - it would suit that perfectly. I think my biggest hurdle is finding a sparky who is willing to do a bit of a more 'interesting' project.

micarex commented 3 years ago

Yes the sparky bit is definitely a challenge. I spoke to a few on my journey and some of them just thought I was barking mad and wouldn't go near it, and other just couldn't understand what I was trying to do. WRT to the Fronius Smart Meter, unless you have a Fronius Inverter it may not be the right device for your solution. As best I know the Smart Meter can only use MODBUS RTU rather than MODBUS TCP. So I'm not sure you will be able to see it on your network and read it with HA. It is cabled directly to the Inverter and the Inverter is the brains. The inverter support MODBUS TCP so I'm using HA to talk to the Inverter which is the master in the master-slave MODBUS arrangement. Refer this doc for some more info on Fronius MODBUS. So in the Fronius setup, the Inverter and the Smart Meter use a direct cable connection and MODBUS RTU to communicate, whilst the Inverter can be set to use either RTU or TCP to communicate with other devices (such as HA).

davewatson91 commented 3 years ago

Yes the sparky bit is definitely a challenge. I spoke to a few on my journey and some of them just thought I was barking mad and wouldn't go near it, and other just couldn't understand what I was trying to do. WRT to the Fronius Smart Meter, unless you have a Fronius Inverter it may not be the right device for your solution. As best I know the Smart Meter can only use MODBUS RTU rather than MODBUS TCP. So I'm not sure you will be able to see it on your network and read it with HA. It is cabled directly to the Inverter and the Inverter is the brains. The inverter support MODBUS TCP so I'm using HA to talk to the Inverter which is the master in the master-slave MODBUS arrangement. Refer this doc for some more info on Fronius MODBUS.

Yeah roger, understood.

Definitely got some more reading to do. Where did you go about finding all the information you needed along the way?

micarex commented 3 years ago

Feels like I "read the Internet". Some days I would spend 4-6 hours googling different solutions/articles/manufacturer specs etc. I put it all together over a 6 month time frame. Certainly learned a lot along the way. I also managed to get contacts inside Fronius and Daikin (for air con) so that helped too.

bengAThome commented 3 years ago

Yep. I've applied for access to the API beta, waiting to hear back from them. Fallback would be the file export route. I was thinking maybe running an android emulator with the Powerpal app installed and scraping the numbers. But, to be honest I think I'd rather build an esphome smart metre reader :) On Sun, 16 May 2021, 2:56 pm micarex, @.***> wrote: I just took at look at Powerpal. Seems they don't yet have an API (or other integration method) to be able to read data from the device in real time, but they are considering creating an API. https://support.powerpal.net/hc/en-us/articles/360053641894-Can-I-export-data-from-Powerpal-and-is-there-an-API-available- Do you know of any way to get the data from the device? It looks like the only way at the moment is to download a CSV of the last 60 days of data. If you wrote a script to load that info to InfluxDB or MongoDB (or some other DB that has a rest interface) you could then use the rest sensor to read the values. Not exactly elegant but it might be possible to make this work. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#24 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTQSL72ATEY2DWXQANRQLLTN5F6TANCNFSM44AAVYPQ .

Ok, Powerpal got back to me, they say their API is still basically in Alpha so no timeline on when it will be available.

darren365 commented 3 years ago

Discussions have been enabled for the repository Closing "Issue". Kick off some chat in the Discussions area using this link.

https://github.com/lewisbenge/hass-amber-electric/discussions