Monitor your solar PV system in Home Assistant

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 [email protected] 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

Think your problem is that you import/export power between your battery and the grid which is not a typical usecase.

You only have a sensor for battery discharging.
HA doesn’t know which direction you discharge the energy.

You must define new template-sensors to provide the expected data to this integration.
i would define a template-sensor to calculate the value which will be exported to the house.
… or maybe your smart meter is delivering such values…don’t now

as i can see your sensor is only delivery the total discharge value.
means with your current sensor definition HA means, all power goes to the house.
you definitely have to calculate the difference by your own or maybe your smart meter has some sensor.

the logic from my pov is….
if the power from the panels is zero and you export energy to the grid. (if this is your logic)
In this case you must substract the grid_export_value from the battery_discharge value.

1 Like

hi there,

short, stupid question :smiley:

is this also possible with Shelly 3EM instead of WEM3080T?
I use one 3EM for our 3 phases for the flat and have a second on in a drawer, which I can use for this project…

Hi,
Of course ,it is OK.
In fact,the key to this solution is to get such parameters below

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

In other words, this solution does not bind any brand, all you need to do is to get such parameters above from your energy meters, then you will be able to use this solution.

This is why we can use a virtual energy meter of this link to show the effect of this solution.
https://www.iammeter.com/api/v1/site/meterdata/B384789C?token=ec0aeb9c07e24368b5fd9bb3b42a3095 184

The reasons I use IAMMETER`s energy meter in this solution are
1 it is bi-directional, if you install one energy meter on the grid side, you can measure both import/export kWh at the same time.
2 I run IAMMETER :grinning: :grinning: :grinning:

2 Likes

@iammeter great work! Few works in fact (HA, NodeRed, Grafana).
Can I know how you make it possible to have access to Grafana remotely? I was looking for that possibility but Grafana on HA card/view was possible for me only if I previously log into Grafana on the device. And from outside the LAN it was never accessible.

Hi:
Do you mean this effect
http://ha.iammeter.com:13000/
username:iammeter
PWD:iammeter

we have a project about how to monitor the solar pv system by home assistant,infuxDB and Grafana

Here are some public materials
https://www.iammeter.com/docs/homeassistant-grafana

Hi, very interesting project and nice looking graphs. I read Your materials from the link but, unfortunately, I did not find anything about setting up Grafana with HA to have access to graphs from devices not logged previously to Grafana on its servers.
Did I miss something?

I read it again and found it is not very specified indeed.(the quickstart is write several years ago) .
I will let my colleague to prepare a step-by-step solution ,with regard to
1 use the Home assistant to get the data
2 use the influxDB to store the data that get from the home assistant
3 use the Grafana to display as the dashboard
In my opinion , we just make a simple port mapping in the router so that you can visit the grafana server by the port of 13000

2 Likes