Jump to content
Chris Hobson

Axpert/Sonoff/ICC/Alexa integration

Recommended Posts

Posted (edited)

Hello Everyone 

I have been MIA for a while but Covid 19 has slowed my solar business down and I have had a bit of extra time.

I have finally put the finishing touches to my PV system and now have the control I have wanted for years.

I have a 1.2kW pump that lifts water 185m up a mountain (in fact two mountains but that is not really relevant). I was running and controlling it with a Sonoff switch. It would run from 8h30 to 15h30  and I used my phone to switch it off if it looked like the weather was clouding over. My staff quarters is powered from my home and I would switch it off once SOC was roughly 50%.

 

Just before Covid shutdown @PaulF007 visited me here on the farm - what a privilege. Paul introduced me to Node Red and 3 weeks later things have changed drastically.

First change was to put Tasmota onto my Sonoff devices so they are now local devices rather than being controlled by a remote server. I knew about Tasmota but without the software to integrate the Sonoffs with I would lose functionality hence I had never changed. I immediately noticed that the Sonoffs' performance was much improved as maintaining connection was always an issue with the Chinese server, now there is never an issue 

Paul then started integrating devices and software. Paul installed openhabian and Node Red on a Rpi. Once up and running the first order of business was to collect data from the inverters. Fortunately ICC posts to Emoncms and we used the Emoncms node within Node Red to pull the data. We could have just as easily subscribed to the topics within MQTT.

Once we had the data it was time to makes some rules which a fairly simple  but become more complex with overload exceptions etc.

Rule 1:       1.2kW Pump switches on after 08h00 in the morning once state of charge >30% and the batteries are being charged by at least 1500W. The pump switches off at 15h01. If at any time the battery had a sustained average discharge of 500W for longer than 7 minutes or a peak discharge of 1200W the pump switches off. This prevents toasters and kettles at breakfast time causing the pump to switch off. If the pump switches off after 30 minutes the pump will try switch on again. This  allows conditions to improve and allows the pipeline to drain so that the pump is not starting against a 18 bar pressure. If the pump switches off 3 times it will remain off for the rest of the day.

The change has been immediately noticeable as 3 of the 4 reservoirs we fill  are nearly full in spite of the cloudy weather over the last 5 days.

Rule 2: My staff quarters are supplied with electricity from 17h55 (just before Sewende Laan) till the SOC hits 50%. There is an overload routine and as time passes they are becoming more and more disciplined and their lights switched off after 9:00 pm last night.

Rule 3: Excess power is fed to a geyser. I plan to balance the geysers draw to currently available excess energy using Triacs. As we are heading into winter this part has not been implemented yet.

Finally the entire system reports to an Echo-dot (Alexa). This was slightly more cumbersome. Node Red has node that can easily pass text to speech (TTS) from Node Red to Alexa.  So Alexa reports on the pump switching on/off, the staff quarters switching on/off and low battery voltage or SOC. However querying solar data was more of a challenge. Writing a Alexa skill is relatively easy. Writing a good Alexa skill is a whole lot more difficult. The easiest workaround was to link Alexa with Webhooks using IFTTT and draw the command into Node Red using a Webhook. The Node Red Webhooks node is written by Webhooks and is flawless. So now when I wake up in the morning before it is light I can query battery health and know if anything untoward happened in the night all from the comfort of my bed.

Edited by Chris Hobson

Share this post


Link to post
Share on other sites

That is good use for it. 

I like the node-red interface it is easily programmable and the GUi give you a nice view. The upside of node red is there is lot of integration available.

For fine tuning of the pump and prediction you can integrate a weather module to give some prediction for the day and then move more water if you see it sunny.

Also look node-red has a build in dashboard function and it is very easy to setup. Because you know how long the pump is running from your tasmota device  you can setup a timer and then based on the calculated average usage of the pump show your pump power usage for the month or any other sonoff/tasmota device.

Share this post


Link to post
Share on other sites

Thank you what a great post, I am very keen to get more control over my system, however I will need to get rid of my Must inverter. This was very interesting!

Share this post


Link to post
Share on other sites

Chris, you've given me just enough pointers in your post to get my own stuff going!  Over the past few days I've installed Node-RED on my Linux home server and imported al the nodes & flows to:

  • Get temperature & cloud data from OpenWeatherMap
  • Read the most relevant information from emoncms (running on my inverter's RPi)
  • Control my Sonoff devices (native firmware, not Tasmota)

Now I need to build some logic so that I can automatically turn heaters on to warm up the house up during cold winter days, or turn the swimming pool pump off to save batteries when its very overcast, etc.

image.png.09ed3868decce3b4807b8799a6f2fcbd.png

Share this post


Link to post
Share on other sites

Hi @ChristoSnake

Wow you have inspired me to take mine further.

How are you getting inverter data into Node-Red? I can get BMV data into Node-Red but have yet to work out how to use the barrage of data effectively (it posts every second). I have unsuccessfully tried to get inverter data into Node-Red directly. I have noticed data that cannot be correct and want to filter data coming from my inverter.

Share this post


Link to post
Share on other sites
Posted (edited)

Chris, I have added the emoncms nodes to my Node-RED installation...

 I point the "emoncms in" node to the local emoncms data (via the URL & API key found on the ICC Pi at Settings -> Cloud Posting), and also provide the node with the Feed ID found on the Raspberry Pi's emoncms website (http://localhost/emoncms).  Those three steps gives you a node that reads a single emoncms feed value at a time:

image.png.24e6160921d849948c8b809527f2a95d.png

I'm using a standard "inject" node to provide a manual trigger for the "emoncms in" node and then outputting the result with a "debug" node (at this stage purely for testing purposes).  It's easy to configure the "inject" node to repeat at your preferred interval, though:

image.png.e57a1359d24d271b6fb0257bbe4b721a.png

To slow your BMV data down, you can make use of a "delay" node...

 

Edited by ChristoSnake
Moved graphics

Share this post


Link to post
Share on other sites

image.png.78d22b4c9fc8f4cf76dad94fc658a294.png

I am pulling all my data via Emoncms. All data posted every 30secs, except Grid Watts which is posted every second. I need to know if the generator is on  to prevent the staff houses unnecessarily being powered by the inverters. They can receive power directly from the generator not via the inverters.  Trying get inverter data caused Node Red to bomb this evening. I will crack this somehow I am determined.

Share this post


Link to post
Share on other sites
Posted (edited)

BMV.JPG.eff0e167c2a6aa5cf7c0966a82c0c604.JPG

The BMV posts 33 different data fields (including 2 check sums) every second. I have isolated the useful data and restricted it to every 30 seconds.  The switch was not behaving as I would expect and I had to order the data fields and change how to switch evaluated the data to work as it should. For instance BMV and VS needed to be evaluated before V and H10 to H18 needed to be evaluated before H1 to H9 (in spite  of a setting set to check all rules first) . Now to conquer the Axpert.

@ChristoSnake I  have  imported  OpenWeatherMap data but it seems to be you  can either get hourly  weather forecast or a 5 day forecast neither seem  particularly useful    to me.   Is  there   a   forecast  for  24 hours?

Edited by Chris Hobson

Share this post


Link to post
Share on other sites
On 2020/04/29 at 9:12 PM, Chris Hobson said:

 

@ChristoSnake I  have  imported  OpenWeatherMap data but it seems to be you  can either get hourly  weather forecast or a 5 day forecast neither seem  particularly useful    to me.   Is  there   a   forecast  for  24 hours?

Sorry Chris - my requirement was only to know the current temperature so that I can decide whether to heat the house or not!

But I'll keep your requirement in the back of my mind when I look at the API again...

Share this post


Link to post
Share on other sites
On 2020/04/26 at 8:45 PM, Chris Hobson said:

image.png.78d22b4c9fc8f4cf76dad94fc658a294.png

I am pulling all my data via Emoncms. All data posted every 30secs, except Grid Watts which is posted every second. I need to know if the generator is on  to prevent the staff houses unnecessarily being powered by the inverters. They can receive power directly from the generator not via the inverters.  Trying get inverter data caused Node Red to bomb this evening. I will crack this somehow I am determined.

Chris this is awesome, can you possibly export this flow so I can import and play around?

Share this post


Link to post
Share on other sites
On 2020/04/26 at 10:24 AM, Chris Hobson said:

 

How are you getting inverter data into Node-Red? I can get BMV data into Node-Red but have yet to work out how to use the barrage of data effectively (it posts every second). I have unsuccessfully tried to get inverter data into Node-Red directly. I have noticed data that cannot be correct and want to filter data coming from my inverter.

To get inverter data from node-red directly  is better on  rj45 serial port.      HID node has got problems to install.

You need  serial node,  crc node (function) and parsing data answer (function).

All my FV installation is on node red (monitoring and control).   Dashboard node red is awesome.  A few screenshots of my flows and dashboards:

 

 Notice that in FV installation are several inverters (even ongrid infinisolar),  pcm60x, bmv700,  grid sensor sdm230 eastron,  Own Charging algorithym on all solar regulators (pip, pcm60x, infinisolar), etc etc etc....    node red joins everything.

Here  PIP5048MS flow  offgrid0

nodered1.thumb.png.fa920742166f5d825ba654d9d5443464.png

 

Extracting data from BMV700

nodered2.thumb.png.51c65c28e840f8f734978fbc686fbad0.png 

 

Extracting data from 5048MS  in  QPIGS command  on function node.

nodered3.thumb.png.5e80c0b294d3ad9861c116e72ed076a5.png

 

Dashboard control (right)  and  logging events (left)  on 5048ms (offgrid0 inverter).

nodered4.thumb.png.5db66934ffad61808150464a7f3e22bc.png

 

Control BTA to fine battery voltaje adjust on each inverter  and globals command to ecualization lead bank battery,   charging battery from grid,  etc, etc etc...

nodered5.thumb.png.3f3d2ba5225e90a6b4dce1409d9532a3.png

Share this post


Link to post
Share on other sites

whoa. i've also been spending my lockdown hours going down this rabbit hole, albeit a slightly different route.

basically used my existing hassio/homeassistant installed on a Rpi4. so far i've managed to tie everything up using:

- home assistant interface with the axpert inverter, which takes care of extracting the metrics.

- the grafana and influxdb integration which saves all sensor and log data, and for dashboards/data analysis

- in home assistant i've also started using nodered to take care of the logic with the various sensors/gadgets around the house

Home Assistant

9QFA2xH.png

utvpXaF.png

Integrations make it simple

nQcDiJT.png

Grafana & InfluxDB

a58SGg6.png

iixnFAH.png

 

 

Share this post


Link to post
Share on other sites
On 2020/05/23 at 1:23 AM, MockTurtle said:

whoa. i've also been spending my lockdown hours going down this rabbit hole, albeit a slightly different route.

basically used my existing hassio/homeassistant installed on a Rpi4. so far i've managed to tie everything up using:

- home assistant interface with the axpert inverter, which takes care of extracting the metrics.

- the grafana and influxdb integration which saves all sensor and log data, and for dashboards/data analysis

- in home assistant i've also started using nodered to take care of the logic with the various sensors/gadgets around the house

Home Assistant

9QFA2xH.png

utvpXaF.png

Integrations make it simple

nQcDiJT.png

Grafana & InfluxDB

a58SGg6.png

iixnFAH.png

 

 

@MockTurtle this is brilliant! Does the Docket link you sent have the Grafana and LoveLace cards in or can you export so I can have a look at how you did this?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...