Monitor your solar PV system in Home Assistant

Yes, besides using of a bi-directional energy meter,use two energy meters is also OK(one for import energy while another for export energy)

1 Like

IAMMETE energy meter begins to support Modbus/TCP from the latest firmware upgrading. You can integrate them into Home assistant with a third-party component(Modbus/TCP)
Video tutorial: Integrate a three-phase energy meter into Home assistant by Modbus TCP (over Wi-Fi) - YouTube

Register map of the Modbus
https://www.iammeter.com/newsshow/news-modbus-tcp-energy-meter

By the way, I know that the IAMMETER energy meter had been integrated into Home Assistant, you can use it directly and do not need to consider the third party component when you use it in Home Assitant.
We just use the Home Assistant to show the Modbus/TCP feature of the IAMEMTER energy meter.

Use the 3 phase Wi-Fi energy meter the way you liked(Home assistant,Openhab,NodeRed,Private server etc…)

I have also a brand new solar system and would like to monitor the power coming from the grid or sold to the grid. I have Frient pulse energy monitoring system. It worked perfectly previously. But now it reports the power/energy passed through without the direction.

I have been looking e.g. at Shelly EM3, but its operating temperature is 0…40 C and I am living in North. And the cabinet is a metallic one making wifi connections problematic.

As a cheap solution I started to think about detecting the direction from the changes. Before I start to learn how to do it and test it, I would like to ask whether anyone sees any major problems.

I’ve two reliable real time sensors:

  • Solar power: power that my panels are producing
  • Grid power: power coming to my house or going out, direction is unknown

I want to calculate two sensors:

  • Power to grid: power delivered/sold to the grid
  • Power from grid: power bought from the grid
  • One is always zero and the other one is non-zero, which one is depending on the direction
  • Bought/sold energy is calculated from these using Riemann method

Since solar power is constantly changing and used power is more static, the idea is to check how these are changing from the previous values as follows:

  • If Grid power > Solar power then
    • Power to grid = 0
    • Power from grid = Grid power
  • Else if previous Solar power < Solar power and previous Grid power > Grid power then
    • Power to grid = 0
    • Power from grid = Grid power
  • Else if previous Solar power > Solar power and previous Grid power < Grid power then
    • Power to grid = 0
    • Power from grid = Grid power
  • Else
    • Power to grid = Grid power
    • Power from grid = 0

That is, if the sensors are changing to opposite directions, I am still using energy from the grid.
I realize that this logic does not work when both Solar power and used power in the house change much, but I feel that this would work e.g. 95 % time, which would be perfectly ok for me.

I started to analyze this by implementing statistics sensors (sampling size: 2). The main problem is that the values changes do not happen in sync perhaps due to different delays in the value updates.

1 Like

Nice dashboards and visualizations :sunglasses:
Now the next step is to optimize your home energy flow >> EMHASS !!!

New updates:

Summary: How to use IAMMETER`s energy meter in Home assistant

After IAMMETER supports modbus/tcp, you can use the Modbus/TCP sensor in Home Assistant to read the data from the Wi-Fi energy meter of IAMMETER.
It means the data can be requested more faster than the IAMMETER integration.
When you want to use the energy meter`s data as a feedback value in a control loop(Ex: control the battery charge or discharge), this fast response option will be a better choice.

The most advantage of Modbus/tcp sensor in Home Assistant is it supports requesting the data every 1 second, which can be used as a real-time sensor feedback value in a control loop. The 1-second sample interval makes it can be used in many interesting things.

Request the data of energy meter in Home Assistant(modbus/tcp), trigger the Sonoff in realtime

A better solution is to use a meter that pushes an update to Home Assistant only when there is a significant change (local push). This way you are not flooding your network with unnecessary traffic.

1 Like

Now, there are three ways to integrate the Wi-Fi energy meter of IAMMETER into Home Assistant.

1 IAMMETER@Home Assistant integration
2 Use the modebus/tcp sensor in Home Assistant
3 USE the MQTT sensor

Can you advise the process for Modbus - and provide the Modbus map for the unit ?

Can i use Node Red to query this every second through modbus and then feed to Home Assistant

Craig

Hi
Do you mean you want to request the data by modbus/rtu from RS485?

I recommend to use the modbus/tcp ,not modbus/rtu
This is the register map of the modbus/tcp
https://www.iammeter.com/newsshow/news-modbus-tcp-energy-meter
This is about how to integrate the energy meter by modbus/tcp sensor

Thanks for the quick response.

No i am happy with modbus/TCP thanks - i just wanted to see what a query would look like to your unit i.e. could i make a single query to return all registers every second and then parse them on my end - or do i need to request each individual register ?

I like the unit - just gets a little expensive to replace my main IOTAWATT for my Solar monitoring as i will need two of the units - however i may look at a single unit to help me with my batteries Zero out the grid

Craig

Hi:

Of course, you can query all registers (just need to change the register length in the polling command) every second, no need to query the registers one by one.
There is a total tutorial about how to use the modbus/tcp sensor in the home assistant to read the data of the Wi-Fi energy meter in the above post.

Hello,
I think I’ve done everything according to the guidelines but a strange behaviour was noticed, for house I usually only have no more that 10kWh but I export into the grid from my batteries, this energy is being added into house consumption corrupting the house consumption data,
Am I doing something wrong?
How could this be rectified?
Thanks in advance

Hi:
Sorry, I do not understand why this occurs, please give us more information.

In short words, the key to this solution is to measure such parameters directly

inverter output power(w)
inverter yield energy(kwh)
feed in power(w)
import energy from grid(kwh)
export energy to grid(kwh)

and do some calculations ,then show them on the dashboard

load_power = inverter_power(always positive) - feedin_power (positive: export energy , negative : import energy)

selfuse_energy = yield_energy-exported_energy

load_energy = selfuse_energy+grid_consumption_energy

So, please check whether the energy meter had been installed in the correct position and whether the five key parameters are measured correctly.

If you still have questions, please give us more information about how you install your energy meter and how you confirm the five parameters are measured correctly.

Thanks for your voluntary help,
Interesting, I haven’t inputed anywhere the inverter output, in fact no power measurements at all in the dashboard, all I’ve added is the energy measurements.
The import/export meter I verified with the smart meter data from my supplier and its within 0.4% accuracy, its a modbus meter, same brand of meter I use for the PV meter, (I measure energy from inverters with a meter not directly from inverters, technically more accurate) I don’t have any sensors for house loads.
Battery energy sensor is also accurate and makes logical sense although I can’t really verify
Since you mentioned power sensors where would this sensors go? In the dashboard all I can input is energy sensors?



its impossible to have > 60 kWh battery charged per day with a 7kwp environment.
you are using the wrong sensors. it looks like a total/sum value.

how big is your battery?
are you charging/discharging your battery from/to the grid?

anyhow, this is misconfigured

1 Like

1 :I agree withTobiasGJ`s opinion, the data you used is the total value, not the daily value.
2 if you only use the kWh data of the inverter and grid export and import ,there will be no extra computation needed.
What you need to do is calculate the periodic data(daily, monthly) from the total value. like this

utility_meter:
  grid_consumption_energy_daily:
    source: sensor.grid_consumption_energy
    cycle: daily
  grid_consumption_energy_monthly:
    source: sensor.grid_consumption_energy
    cycle: monthly
.......

Please check whether you add this to your YAML file.

1 Like

I have a 13.2kW inverter with about 45kWh battery storage and yes I do charge from the grid and discharge during peak time to balance the grid, I guess something’s not right but can’t figure out what exactly.
What I can confirm for sure is:
Energy to grid :white_check_mark:
energy from grid :white_check_mark:
energy to battery :white_check_mark:
energy from battery✅
Solar generation :white_check_mark:
Home consumption :x: this reading is not calculated correctly…

Agreed yes it’s the total value but resets every day I’ve checked for multiple days already.
This is the sensors I’m using:


 -  name: victron ess
    retry_on_empty: true
    retries: 6
    type: tcp
    host: 192.168.2.200
    port: 502

    sensors:
    - name: 'Grid meter Energy from Grid'
      unit_of_measurement: "kWh"
      slave: 30
      address: 2603
      data_type: uint16
      scale: 0.01
      precision: 1
      scan_interval: 20
      device_class: energy
      state_class: total_increasing

    - name: 'Grid meter Energy to Grid'
      unit_of_measurement: "kWh"
      slave: 30
      address: 2606
      data_type: uint16
      scale: 0.01
      precision: 1
      scan_interval: 20
      device_class: energy
      state_class: total_increasing

    - name: 'PV AC coupled inverter'
      unit_of_measurement: "kWh"
      slave: 32
      address: 1030
      data_type: uint16
      scale: 0.01
      precision: 1
      scan_interval: 20
      device_class: energy
      state_class: total_increasing
      
#Battery 
    - name: 'Battery Discharged energy'
      unit_of_measurement: "kWh"
      slave: 226
      address: 301
      data_type: uint16
      scale: 0.1
      precision: 1
      scan_interval: 20
      device_class: energy
      state_class: total_increasing

    - name: 'Battery Charged energy'
      unit_of_measurement: "kWh"
      slave: 226
      address: 302
      data_type: uint16
      scale: 0.1
      precision: 1
      scan_interval: 20
      device_class: energy
      state_class: total_increasing'

I’ve noticed everything works fine until I discharge the battery in the grid, this energy is being wrongly added in the home consumption, everything else works as intended no complaints.
I wonder if the formula for calculations is easily accessible?

1 Like