Jump to content

HELP NEEDED WITH ICC SOLAR (MQTT) - HOME ASSISTANT INTEGRATION


JacquesV

Recommended Posts

Good day all.

Is there anybody running Home Assistant and ICC Solar with MQTT integration? I looked through the older posts, but I can not get the MQTT "connection" to work. I have managed to get a Tesla Style Power card to work with the Local EMONCMS values from the ICC PI.

Home Assistant is running on a VM, the ICC PI only runs the Programs installed by the ICC image.

Any pointers and or guide will be much appreciated.

Link to comment
Share on other sites

Thank you for the attempting to assist, I will try to answer with as much detail as possible.

I have the Mosquito broker configured to use the ICC PI MQTT built in broker, so the broker* is set to the PI (static)IP address, and port, username and password, as per the ICC MQTT port, username and password as displayed in ICC Solar settings tab. It does seem to connect, I do not get any errors. But that is up to where I manage to get. I do not get any "Topics" when "Listening" while Subscribing to topics and publishing payloads does not change anything as expected to. Still no errors up to this point, but no reaction as well.

I might be missing something simple...

Link to comment
Share on other sites

I have set up Home Assistant MQTT Broker as "core broker" but it still does not receive any published data from ICC MQTT broker. Using MQTT explorer I can only receive data on $SYS/#" which suggest to me that the ICC Broker is running, but no other data (such as "Inverter/LoadWatts, ect.") is being published by the ICC broker. 

This then seems to be a problem I need to solve within the ICC PI system, of which I definitely don't have the necessary knowledge to do on my own.

If only Solar Assistant had Static IP available yet if would have been an easy switch to make 🙄

Thank you very much for the assistance to far.

 

image.thumb.png.c46c3da5cd08c6a73a841e09c08b0aa7.png

Link to comment
Share on other sites

  • 4 weeks later...

I have run ICC successfully with HA. I use the built-in/add-on Mosquitto broker in HA. To get ICC to communicate with the HA Mosquitto broker, you need to create a config file called icc.conf in /share/mosquitto folder on your HA server. The icc.conf file need to contain the following:

 

connection ICM

remote_username ICM

remote_password ICM123456

address <IP of your ICM PI:Port>

topic inverter/# out

The way I created/edited this file, is by using the HA community add-on SSH&Web Terminal https://github.com/hassio-addons/addon-ssh to access the share folder. I then created the mosquitto folder and then the icc.conf file using nano editor.

Once the icc.conf file has been created, you need to restart your Mosquitto broker and then check the broker log to see that it finds the icc.conf file. I do these two steps by going to the Mosquitto broker page in the Settings/Add-ons menu in HA.  Refresh the log a few times while the broker is restarting to see the connection to ICM.

Hope this helps. Let me know

Link to comment
Share on other sites

And I see that I had to create sensors in my configuration.yaml for the mqtt info I wanted to display in my HA front-end:

 

mqtt:
  sensor:
    - name: "Solar_SOC"
      state_topic: "ICC-Master/Battery/SOC"
    - name: "Solar_Battery_Amps"
      state_topic: "ICC-Master/Battery/Amps"
    - name: "Solar_Load_Watts"
      state_topic: "ICC-Master/Inverter/TotalLoadWatts"  
    - name: "Solar_Grid_Watts"
      state_topic: "ICC-Master/Inverter/TotalGridWatts"  
    - name: "Solar_PV_Watts"
      state_topic: "ICC-Master/Inverter/PvWattsTotal"          
    - name: "Solar_energy_Kwh_Today"
      state_topic: "ICC-Master/Inverter/SolarKWhUse"  
    - name: "Solar_Battery_Time_Remaining"   
      state_topic: "ICC-Master/Battery/TimeRemaining"

Link to comment
Share on other sites

  • 2 weeks later...
On 2023/03/17 at 9:03 AM, edgarl said:

I have run ICC successfully with HA. I use the built-in/add-on Mosquitto broker in HA. To get ICC to communicate with the HA Mosquitto broker, you need to create a config file called icc.conf in /share/mosquitto folder on your HA server. The icc.conf file need to contain the following:

 

connection ICM

remote_username ICM

remote_password ICM123456

address <IP of your ICM PI:Port>

topic inverter/# out

The way I created/edited this file, is by using the HA community add-on SSH&Web Terminal https://github.com/hassio-addons/addon-ssh to access the share folder. I then created the mosquitto folder and then the icc.conf file using nano editor.

Once the icc.conf file has been created, you need to restart your Mosquitto broker and then check the broker log to see that it finds the icc.conf file. I do these two steps by going to the Mosquitto broker page in the Settings/Add-ons menu in HA.  Refresh the log a few times while the broker is restarting to see the connection to ICM.

Hope this helps. Let me know

Hi @edgarl,

Thank you so much for the above. I have followed the instructions and finally managed to get the Mosquitto broker to connect to the ICM PI. I see the below message in the log:

[09:43:10] INFO: Starting mosquitto MQTT broker...
1679989390: Loading config file /share/mosquitto/icc.conf
2023-03-28 09:43:10: Warning: Mosquitto should not be run as root/administrator.
[09:43:10] INFO: Successfully send discovery information to Home Assistant.
[09:43:10] INFO: Successfully send service information to the Supervisor.

My question is where does it store the topic inverter/# out metrics so I can use them in scenes and automation?

Edited by uDuWaR
Tag User
Link to comment
Share on other sites

Hi @JacquesV and the other chaps

I managed to get it working, little blood, some sweat and way too many tears :)

The 1st thing you need to do is make sure you can connect to the MQTT broker on the ICM PI. Download MQTT explorer and connect default password is ICM123456.
You should see the ICM-Master on the broker with all your info.
Then you need to create the integration on the HA -> Settings -> Devices & Services -> Add Integration -> MQTT default and add the PI's details.

Finally you need to add the sensors using the same config that @Edl supplied.
You do this by going to Settings -> Add-ons -> Download and install File Editor. Open File editor then open the config/configuration.yaml then add the sensors he posted above. I am certain you can add some kind of auto discovery. Here is the documentation I suspect you need. https://www.home-assistant.io/integrations/mqtt/#mqtt-discovery

Finally give everything a restart.

Under Settings -> Devices & Services -> Entities search for solar and you should see them. Now you should be able to add them as Cards on your dashboard.

Screenshot 2023-03-28 164938.png

Screenshot 2023-03-28 165054.png

Screenshot 2023-03-28 165319.png

Screenshot 2023-03-28 170838.png

Screenshot 2023-03-28 171122.png

Screenshot 2023-03-28 172741.png

Link to comment
Share on other sites

Little update:
I have managed to tag the data sources correctly so you can configure the energy dashboard in HA.
Take the watt used value from the sonoff geyser switch and calculate a kWh usage
Finally convert the negative number received from the ICM PI for battery used to a positive so it can be used in the Energy display.

# To calculate the kWh for various watt metrics
sensor:
  - platform: integration
    source: sensor.sonoff_10014e384f_power
    name: Geyser_energy_used
    unit_prefix: k
    round: 2
  - platform: integration
    source: sensor.solar_grid_watts
    name: Grid_watts_calculated
    unit_prefix: k
    round: 2
    

# Convert the negative number of battery used to a positive
template:
- sensor:
      - name: "Solar_Month_BatteryKWh_Used_Positive"
        unit_of_measurement: "kWh"
        state_class: total_increasing
        device_class: energy
        state: >
          {% if states('sensor.Solar_Month_BatteryKWh_Used') | float(0) <= 0 %}
            {% set gridout = (states('sensor.Solar_Month_BatteryKWh_Used') |float |abs) %}
          {% else %}
            {% set gridout = 0 %}
          {% endif %}
          {{ gridout }}

# MQTT details to pull information from the ICM PI
mqtt:
  sensor:
    - name: "Solar_SOC"
      state_topic: "ICC-Master/Battery/SOC"
      unit_of_measurement: "%"
      state_class: "measurement"
      device_class: "battery"
      
    - name: "Solar_Battery_Amps"
      state_topic: "ICC-Master/Battery/Amps"
      unit_of_measurement: "A"
      state_class: "measurement"
      device_class: "current"
      
    - name: "Solar_Load_Watts"
      state_topic: "ICC-Master/Inverter/TotalLoadWatts"
      unit_of_measurement: "W"
      state_class: "measurement"
      device_class: "power"
      
    - name: "Solar_Grid_Watts"
      state_topic: "ICC-Master/Inverter/TotalGridWatts"
      unit_of_measurement: "W"
      state_class: "measurement"
      device_class: "power"
      
    - name: "Solar_Battery_Time_Remaining"   
      state_topic: "ICC-Master/Battery/TimeRemaining"
      unit_of_measurement: hh:mm
      
    - name: "Solar_Month_Grid_Total"   
      state_topic: "ICC-Master/Inverter/Month_Grid_Total"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      device_class: "energy"
      
    - name: "Solar_Month_Load_Total"
      state_topic: "ICC-Master/Inverter/Month_Total_Use"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      device_class: "energy"
      
    - name: "Solar_Month_BatteryKWh_Used"
      state_topic: "ICC-Master/Inverter/Month_BatteryKWh_Used"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      device_class: "energy"
      
    - name: "Solar_Month_BatteryKWh_Charged"
      state_topic: "ICC-Master/Inverter/Month_BatteryKWh_Charged"
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      device_class: "energy"

Dashboard looks like this now:

image.thumb.png.544e010244390f0c23ac6c87c503b017.png

Link to comment
Share on other sites

  • 2 months later...

Thanks for the great post guys - I have just installed HA and I'm in the process of setting up all of my sensors and dashboards.

I'm still new when it comes to programming on the .yaml configuration, but for the life of me, I cannot seem to be able to get the values for the amount of PV produced.

I'm using the following:

- name: "Solar_PV_Watts"
      state_topic: "ICC-Master/Inverter/TotalPVWatts"
      unit_of_measurement: "W"
      state_class: "measurement"
      device_class: "power"

This seems to fall in-line with what @uDuWaR so kindly posted. However, I have been unable to get it to work. When I review the entity, it just states that there is no information available.

I have managed to get all of the other variables to work, but stuck on this one.

Link to comment
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...