stealthchesnut / ha-foxess-modbus Goto Github PK
View Code? Open in Web Editor NEWHome Assistant Modbus Integration setup for Fox ESS H1 and AC Inverters
Home Assistant Modbus Integration setup for Fox ESS H1 and AC Inverters
Someone has messed up the indents in here, and added (e.g. row 1) some dashes where i dont think they belong. Including if you need to comment in the wifi piece.
Originally posted by Daibutt May 7, 2022
I have seen several comments regarding energy values not matching up, and for a while I have been trying to estimate system "overhead" using the FoxESS cloud data.
Now we have ~real time data using the modbus integration this makes it easier to estimate these.
The inverter uses energy to do it's thing, and when you feel the inverter, batteries etc. warm to the touch, that's all using energy.
Conceptually, this is how I see it;
NB: I do not have an EV, so not sure if EV chargers typically are included in the "loads" sensor or if they are separate to this.
So doing some maths;
which can be rewritten as;
Im my HA configuration.yaml have added a template for a "losses" sensor, and also a totaliser and daily losses utility meter;
Totaliser;
And a daily (utility) meter;
Obviously if you have other loads or generators that are different than the diagram above you will need to alter this accordingly (i.e. 2nd inverter, EV charger that is not included in the loads sensor, Eddi?)
I am typically seeing ~ 100W system overhead/loss, and this seems to vary depending on how hard the inverter is working, which sort of makes sense.
I have been successfully using this code until recently.
Unfortunately with HA 2023.9.1 I find that all the Modbus values are being displayed as nan and being listed as Unavailable on the Entities page.
This appears to be related to a change made in this latest HA version.
My guess is that we now need to reject invalid data to prevent the sensors being made unavailable if they are not detected when the Modbus link is first started. Does anyone have the same experience or knowledge on how to solve this ?
Agent addresses captured on my forked Wiki - can we move to the main wiki please?
https://github.com/nathanmarlor/HA-FoxESS-Modbus/wiki/RS485-Agent-Settings-Addresses
I've just addded the integration to home assistant from my H1 invertor and i'm not recieving values for a number of sensors. Grid CT and CT2 as a couple of examples but there are a few more. Looking at the modbusLAN.yaml file at the Grid CT and CT2 the addresses are down as 31014 and 31015 respectivley but looking a the registers wiki should these not be 11021 and 11022?
I have an occurring fault with my inverter that has only started since my HA modbus connection using ethernet. I disabled the integration and no inverter issues or reboots in a month. Re-added the integration on a clean HA install and within a few days I get the same error
I'm using the standard HA settings but I have removed any sensors I do not use. I noticed in the Fox app that the battery goes offline and then a couple of minutes later it seems the inverter resets itself. This is noticeable for me as I have EPS setup on critical circuits and so the inverter resetting switches out the internal relay meaning these circuits lose power for 5-10 seconds.
The firmware versions are
Master : 1.48
Slave : 1.02
Manager : 1.45
I have observed the Load Power reading going very low and negative at certain times. This seems to be when the battery SoC is full/99%, good solar generation (over 3kW), and load is less than the solar generation.
Not sure if this is anything to do with the integration config, or just the data that's coming from the inverter. Seeing matching data in the Fox portal, i.e. LoadsPower reading -0.37kW.
The system losses sensor using LAN config appears to be reading more like a current power generation figure, not a losses figure.
In the USB config it may not be accurate or is giving some surprisingly high figures.
Units may be wrong, or source data may be wrong (incorrect register definition in the LAN config?)
Need to check data source registers are correct in LAN config (or at least match the USB config), then check the implementation of the sensor template.
@StealthChesnut Thank you for the updated code. I now have Grid Consumption and FeedIn gauges working. And they broadly match the values from the CTs feeding our MyEnergi Zappi which I've used as my measuring stick up to now. Spot on!
I see I also now have a Grid CT sensor which I can use to chart grid use, although it seems to be the inverse... See screenshot below - if you look at the right hand end the lilac Grid CT is the inverse of the Load Power:
Originally posted by @C00K50N in #25 (comment)
I was asked to have a look at an issue where the daily system losses was zero, but the system losses was correctly showing the current system losses.
The sensor logic appears to be sensor.system_losses is real time loss, this gets integrated by sensor.losses_sum and then the sensor.losses_daily utility meter (which is zero) is the daily summation.
Having looked at the sensor code added to the configuration.yaml, it seems the sensor.losses_sum definition is missing, if you add it in the daily losses sensor works ok - not sure whether this is the intended method but it does work.
The sensor I added is -
- method: left name: losses_sum platform: integration round: 2 source: sensor.system_losses unit_time: h
I believe I have managed to find which one is for battery temperature:
- name: "Battery temperature"
scan_interval: 60
slave: 247
address: 11038
state_class: measurement
unit_of_measurement: "°C"
scale: 0.1
data_type: int16
input_type: input
device_class: battery
Hello, I have connected my inverted to home assistant using LAN and one of the sensors seems to be backwards:
As you will see during the night the value is a Minus but in the day its possitive. I would expect it to be opposite I.E returning to grid should be a negative number.
I have looked at the foxess app and that is reporting Returning to grid correctly. Here is the configuration in HA for the parameter:
- name: "FoxESS Grid Power"
scan_interval: 5
address: 31014
state_class: measurement
unit_of_measurement: "kW"
data_type: int16
scale: 0.001
precision: 3
input_type: holding
device_class: power
Home Assistant has updated the syntax for defining template sensors. Updating to the new syntax will enable new options such as setting state class.
Quick question about the BMS Watthours sensor;
Should this be the same as the kWh (x1000) value that is available in the Foxcloud data report?
If so then I think I have a problem;
Foxcloud reports my throughput as roughly 9947kWh or 9,947,000 Wh.
The sensor I am pullling in from register 11049 is giving me odd values in HA;
It peaked at 32,731 then dropped to -32749 (more or less 2^15 to -2^15) so is this a stack overflow issue?
In modbus config for this sensor I tried adding data_type: xxxxx (int16, int32, int64, uint16, uint32, uint64) but none of these worked either!
Originally posted by @Daibutt in #92 (comment)
Hi,
After some tinkering, I managed to get my W610 connected using ethernet, rather than as a wifi client.
I don't have permission to edit the wiki, but I've created some instructions below in case you (or anyone else) finds them useful.
Thanks!
Using your router's device list or local ip scanner, find the ip address of the USR now on your local network.
I have a 3-Phase inverter H3-8.0-E and I want to share my register findings for Modbus over Serial with you.
The default Modbus device ID (Slave ID) is 247. This can be adjusted in the inverter menu Settings->Communication->RS485->DeviceID.
I put all findings to my fork of this project for 3-phase inverters
LAN | RS485 | Name | data_type | scale | unit | device class | Description | Validated with display values |
---|---|---|---|---|---|---|---|---|
? |
31000 |
PV1-Voltage | int16 | 0.1 | V | Y | ||
? |
31001 |
PV1-Current | int16 | 0.1 | A | Y | ||
? |
31002 |
PV1-Power | int16 | W | Y | |||
? |
31003 |
PV2-Voltage | int16 | 0.1 | V | Y | ||
? |
31004 |
PV2-Current | int16 | 0.1 | A | Y | ||
? |
31005 |
PV2-Power | int16 | W | Y | |||
? |
31006 |
Grid-Voltage-Phase-R | int16 | 0.1 | V | suggested | ||
? |
31007 |
Grid-Voltage-Phase-S | int16 | 0.1 | V | suggested | ||
? |
31008 |
Grid-Voltage-Phase-T | int16 | 0.1 | V | suggested | ||
? |
31009 |
Grid-Current-Phase-R | int16 | 0.1 | A | Y | ||
? |
31010 |
Grid-Current-Phase-S | int16 | 0.1 | A | Y | ||
? |
31011 |
Grid-Current-Phase-T | int16 | 0.1 | A | Y | ||
? |
31012 |
Grid-Power-Phase-R | int16 | W | suggested | |||
? |
31013 |
Grid-Power-Phase-S | int16 | W | suggested | |||
? |
31014 |
Grid-Power-Phase-T | int16 | W | suggested | |||
? |
31015 |
Grid-Frequency | int16 | 0.01 | Hz | suggested | ||
? |
31016 |
EPS-Voltage-Phase-R | int16 | 0.1 | V | Y | ||
? |
31017 |
EPS-Voltage-Phase-S | int16 | 0.1 | V | Y | ||
? |
31018 |
EPS-Voltage-Phase-T | int16 | 0.1 | V | Y | ||
? |
31019 |
EPS-Current-Phase-R | int16 | 0.1 | A | Y | ||
? |
31020 |
EPS-Current-Phase-S | int16 | 0.1 | A | Y | ||
? |
31021 |
EPS-Current-Phase-T | int16 | 0.1 | A | Y | ||
? |
31022 |
EPS-Power-Phase-R | int16 | W | Y | |||
? |
31023 |
EPS-Power-Phase-S | int16 | W | Y | |||
? |
31024 |
EPS-Power-Phase-T | int16 | W | Y | |||
? |
31025 |
EPS-Frequency | int16 | 0.01 | Hz | Frequency (island mode) | Y | |
? |
31026 |
Smart-Meter-Power-Phase-R | int16 | W | smart-meter | negative=consumption/import | Y | |
? |
31027 |
Smart-Meter-Power-Phase-S | int16 | W | smart-meter | negative=consumption/import | Y | |
? |
31028 |
Smart-Meter-Power-Phase-T | int16 | W | smart-meter | negative=consumption/import | Y | |
? |
31029 |
Load-Power-Phase-R | int16 | W | Main+EPS out | |||
? |
31030 |
Load-Power-Phase-S | int16 | W | Main+EPS out | |||
? |
31031 |
Load-Power-Phase-T | int16 | W | Main+EPS out | |||
? |
31032 |
Temperature Inverter | int16 | 0.1 | °C | Y | ||
? |
31033 |
Temperature Inner | int16 | 0.1 | °C | Y | ||
? |
31034 |
Battery-Voltage | int16 | 0.1 | V | battery | Y | |
? |
31035 |
Battery-Current | int16 | 0.1 | A | battery | Y | |
? |
31036 |
Battery-Power | int16 | W | battery | Negative=charging | Y | |
? |
31037 |
Battery-Temperature | int16 | 0.1 | °C | battery | Y | |
? |
31038 |
Battery-SoC | int16 | % | battery | Y | ||
? |
32001 |
PV-Energy-total | int16 | 0.1 | kWh | inverter | total_increase | Y |
? |
32002 |
PV-Energy-daily | int16 | 0.1 | kWh | inverter | total_increase, daily reset | Y |
? |
32004 |
Battery-Charge-Energy-total | int16 | 0.1 | kWh | battery | total_increase | Y |
? |
32005 |
Battery-Charge-Energy-daily | int16 | 0.1 | kWh | battery | total_increase, daily reset | Y |
? |
32007 |
Battery-Discharge-Energy-total | int16 | 0.1 | kWh | battery | total_increase | Y |
? |
32008 |
Battery-Discharge-Energy-daily | int16 | 0.1 | kWh | battery | total_increase, daily reset | Y |
? |
32013 |
Smart-Meter-Import-total | int16 | 0.1 | kWh | smart-meter | total_increase, daily reset | Y |
? |
32014 |
Smart-Meter-Import-daily | int16 | 0.1 | kWh | smart-meter | total_increase | Y |
? |
32016 |
Smart-Meter-Export-total | int16 | 0.1 | kWh | smart-meter | total_increase, daily reset | Y |
? |
32017 |
Smart-Meter-Export-daily | int16 | 0.1 | kWh | smart-meter | total_increase | Y |
? |
32022 |
Load-Energy-total | int16 | 0.1 | kWh | inverter | total_increase | Y |
? |
32023 |
Load-Energy-daily | int16 | 0.1 | kWh | inverter | total_increase, daily reset | Y |
Address Bankand 30000 (RS485)
30000-30011 - Model name in hex - 'H3-8.0-E'
A number of the BMS sensors (11037, 11041, 11042, 11045, 11046) don't have
state_class: measurement
in their definition in modbusUSB.yaml so, as I undestand it, won't be storing any long term statistics whilst most other sensors do have this.
Is this intentional or should these sensors also have this property?
Sorry not an issue as such but was trying to get some totals for generation and its not working.
I've set up the following for example but i'm not getting any numbers logged:
utility_meter:
daily_pv1:
source: sensor.pv1_power
cycle: daily
#New Sensor
daily_pv2:
source: sensor.pv2_power
cycle: daily
template:
I would then do the same for Monthly, Yearly and Total.
Any ideas where i've gone wrong?
The BMS sensors have the device class set to battery, this needs to be updated to the correct device class per sensor as per full reference here - https://www.home-assistant.io/integrations/sensor/
a number of sensors in the modbusLAN.yaml, don't have the line" slave: 247 "
these sensors don't seem to work without it ?
You need to add the line then reboot the system (a restart isn't good enough)
Hi,
I've found some more H1 RS485 registers:
I'm getting these errors in my HA logs.
Any ideas how to fix them?
Logger: homeassistant.components.template.template_entity
Source: components/template/template_entity.py:173
Integration: Template (documentation, issues)
First occurred: June 1, 2022, 23:34:34 (12 occurrences)
Last logged: 11:59:37
TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{ [0, ((states('sensor.pv1_power') | float + states('sensor.pv2_power') | float ) * 1)]|max }}' but no default was specified') while processing template 'Template("{{ [0, ((states('sensor.pv1_power') | float + states('sensor.pv2_power') | float ) * 1)]|max }}")' for attribute '_attr_native_value' in entity 'sensor.pv_total_power'
TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{% if (states('sensor.grid_ct') | float ) > 0 %} {{ states('sensor.grid_ct') | float * 1 }} {% else %} {{ (states('sensor.random_watts') | float - 5.5 ) / 1000 }} {% endif %}' but no default was specified') while processing template 'Template("{% if (states('sensor.grid_ct') | float ) > 0 %} {{ states('sensor.grid_ct') | float * 1 }} {% else %} {{ (states('sensor.random_watts') | float - 5.5 ) / 1000 }} {% endif %}")' for attribute '_attr_native_value' in entity 'sensor.feed_in_power'
TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{% if (states('sensor.grid_ct') | float ) < 0 %} {{ states('sensor.grid_ct') | float * -1 }} {% else %} {{ (states('sensor.random_watts') | float - 5.5 ) / 1000 }} {% endif %}' but no default was specified') while processing template 'Template("{% if (states('sensor.grid_ct') | float ) < 0 %} {{ states('sensor.grid_ct') | float * -1 }} {% else %} {{ (states('sensor.random_watts') | float - 5.5 ) / 1000 }} {% endif %}")' for attribute '_attr_native_value' in entity 'sensor.grid_consumption'
TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{% if (states('sensor.battery_discharge_power') | float ) > 0 %} {{ states('sensor.battery_discharge_power') | float * 1 }} {% else %} {{ (states('sensor.random_watts') | float - 5.5 ) / 1000 }} {% endif %}' but no default was specified') while processing template 'Template("{% if (states('sensor.battery_discharge_power') | float ) > 0 %} {{ states('sensor.battery_discharge_power') | float * 1 }} {% else %} {{ (states('sensor.random_watts') | float - 5.5 ) / 1000 }} {% endif %}")' for attribute '_attr_native_value' in entity 'sensor.battery_discharge'
TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{% if (states('sensor.battery_discharge_power') | float ) < 0 %} {{ states('sensor.battery_discharge_power') | float * -1 }} {% else %} {{ (states('sensor.random_watts') | float - 5.5 ) / 1000 }} {% endif %}' but no default was specified') while processing template 'Template("{% if (states('sensor.battery_discharge_power') | float ) < 0 %} {{ states('sensor.battery_discharge_power') | float * -1 }} {% else %} {{ (states('sensor.random_watts') | float - 5.5 ) / 1000 }} {% endif %}")' for attribute '_attr_native_value' in entity 'sensor.battery_charge'
Originally posted by @Captain0Kangaroo in #22
Hi, currently there is only support for the H1 Version .
I own a H3-6.0E and tried the integration, but the registers seems to be wrong. I do not get any information.
I can confirm, that Port 502 is open, but that's it.
Maybe the registers are different!? @StealthChesnut can you share some information, how you found the correct registers for the H1 inverter interface?
I noticed the following in the HA log:
2023-03-05 13:12:48.334 WARNING (MainThread) [homeassistant.components.modbus.validators] Modbus sensor/Outer-BMS Cell Temp Reported address 11038_input_247 is duplicate, second entry not loaded!
And sure enough it is in there twice
- name: "Inner-Battery-Temp"
scan_interval: 60
slave: 246
address: 11038
state_class: measurement
unit_of_measurement: "..C"
scale: 0.1
precision: 1
data_type: int16
input_type: input
device_class: temperature
and
- name: "Outer-BMS Cell Temp Reported"
scan_interval: 30
slave: 247
address: 11038
state_class: measurement
unit_of_measurement: "..C"
data_type: int16
scale: 0.1
precision: 1
device_class: temperature
input_type: input
I checked the wiki, but couldn't see what the error is, but I wonder if (based on the pattern) if the second one (Outer-BMS Cell Temp Reported) should be 11049?
I get 2 errors in the home assistant log:
But the integration is working fine and all my data is filled in.
is this a bug in the integration or do I do something wrong?
Originally posted by mdt3k June 8, 2022
My H1-5.0-E inverter has a LAN port, in addition to the RS485 port that the WiFi logger dongle connects to.
I decided to connect a computer to it, and discovered the port hosts a ModbusTCP server. I doesn't appear fussy about what equipment address you poke it with (I tried 1 and 247), it will respond to requests for modbus input registers 300-399, and holding registers 30,000-30,027, 31,000-31,038 and 44,000-44,002 (it is possible it will respond to other registers, I only tried every 100th register). The server responds straight away, and the solar-related values change at least every 5 seconds (I have not logged data for a long period at a faster rate than this, when register scanning I queried every 0.25 seconds and this didn't seem to cause any problems). It is interesting (to me at least) that these are not the same register numbers that everyone else is reporting, and they do not seem to contain exactly the same information as available via the WiFi dongle. I have not yet worked up the enthusiasm to create an RS485 break out box, but for now I assume my dongle is working the same as everyone elses.
The registers return the following information:
My decode of registers 31,000-31,038:
All the values appear to be signed, and where a multiplier is listed they are fixed point values (x10 means a reported value of 2 should be interpreted as 0.2, x100 means 2 -> 0.02)
31000 PV1 Voltage x10
31001 PV1 Current x10
31002 PV1 Watts
31003 PV2 Voltage x10
31004 PV2 Current x10
31005 PV2 Watts
31006 Grid Voltage x10
31007 Generated AC Current x10
31008 Generated AC WattsCurrent x10
31009 Grid Frequency Hz x100
31010 unknown_1
31011 unknown_2
31012 unknown_3
31013 unknown_4
31014 Export Watts (negative = importing)
31015 unknown_5
31016 House Usage Watts
31017 unknown_6
31018 Ambient Temperature degrees C x10
31019 Inverter Temperature degrees C x10 (the fox cloud has these values transposed, but that makes no sense)
31020 Inverter Battery Voltage x10
31021 Inverter Battery Current x10
31022 unknown_8
31023 unknown_9
31024 unknown_10
31025 unknown_11
31026 unknown_12
31027 Inverter State (0 = Standby, 2 = On Grid, other values = ?)
31028 Possibly the “Inverter Mode” from the Fox protocol manuals
31029 Possibly the CT meter type from the Fox protocol manuals
31030 unknown_13
31031 unknown_14
31032 unknown_15
31033 unknown_16
31034 unknown_17
31035 unknown_18
31036 unknown_19
31037 unknown_20
31038 unknown_21
(there is no unknown_7 as I worked out what that was).
Can anyone shed any light on any of the unknown values? In particular the use of registers 300+ and 44000+?
Hi.
Thanks for the excellent work on this.
I apologise that this is only tangentially related to your code:
I am trying to get my head around how (if) the integration with Octopus, in terms of when the system is exporting and when it is importing, is managed with the foxESS kit
Does the use of the Modbus interface for local access using your code affect this - or is that managed between the Fox Cloud and the Octopus cloud....or something else?
Of the many inverters out there, any thoughts on Fox vs any of the others as a good solution?
Cheers!
Looking at sensors created by the integration in the settings area of Home assistant shows a message saying they can't be managed from the UI.
Add Unique IDs to prevent this.
I tried restarting HA but it didn't help. I'm not sure what info/log is needed for a fix and how to get it. Please let me know what and how I can provide it. Thank you
Nice, what about grid use vs export so we can drive automation when we're exporting?
Originally posted by @williamjeccles in #1 (comment)
After some testing I found that 11022 is CT2.
I now have my energy dashboard working.
Thankyou.
Originally posted by @delibury in #11 (comment)
Greetings!
Having an issue with setting up the w610 connected to a H1 inverter with a wired home network. Successfully followed the guide Stealth-chestnut created on here and the wiki article and received data from the H1 for several days. However it has moments of dropping out, and then no data is received intermittently.
To add to it on the network there is also a google mesh setup installed which seems to be causing somekind of "fight" between the w610 ip series addresses and the ip addresses assigned by the Mesh router.
The w610 is connected directly to n ethernet over power adapter then into a switch(hub) and then from there into the google mesh router.
Running an Ip scanner brings up several W610(s) and also the ip address series 10.10.100.. ect of the w610 gets assigned to some of the other devices on the network(tv, hue lighting system). Pretty lost on this one, and believe I need to start over again.
Wondering if someone has a guide for a ethernet wired setup of the 610? (I believe the link to wiki for setting up the w610 is for a wireless setup(which I cannot do due to distance from the inverter to the network hub)
Apologies that this is more of a network configuration issue(which I am unfamiliar with). Any help would be appreciated.
Tried setting this up and put ip that’s on inverter but keep’s failing to connect, how do I check its real ip ? I’ve tried connecting laptop to same lan lead and getting 50 meg bb so not as connecting problem even followed the YouTube video done today no luck spent countless hours trying to get this to work please help thanks
Error message I get is
Logger: pymodbus.client.sync
Source: components/modbus/modbus.py:386
First occurred: 19:51:35 (251 occurrences)
Last logged: 19:57:59
Connection to (192.168.0.043, 502) failed: timed out
Connection to (192.168.0.043, 502) failed: [Errno 113] Host is unreachable
And at startup
Logger: homeassistant.components.integration.sensor
Source: components/integration/sensor.py:184
Integration: integration (documentation, issues)
First occurred: 19:51:27 (8 occurrences)
Last logged: 19:51:27
sensor.load_sum could not restore last state unknown: [<class 'decimal.ConversionSyntax'>]
sensor.bat_charge_sum could not restore last state unknown: [<class 'decimal.ConversionSyntax'>]
sensor.bat_discharge_sum could not restore last state unknown: [<class 'decimal.ConversionSyntax'>]
sensor.feedin_sum could not restore last state unknown: [<class 'decimal.ConversionSyntax'>]
sensor.grid_consumption_sum could not restore last state unknown: [<class 'decimal.ConversionSyntax'>]
Running Home Assistant 2022.11.5
Supervisor 2022.11.2
Operating System 9.3
Frontend 20221108.0 - latest
but had issues been trying since 2022 11 ish tried to restore back to 10.5 but won’t restore properly so can’t go back before 11.2 but even had problems on 10.5 on both modbus and fox cloud hacs add on
Hi
These sensors appear to be missing are missing - where should they be obtained from please ?
sensor.time_period_1_start
sensor.time_period_1_end
sensor.time_period_2_start
sensor.time_period_2_end
They are used below :-
The LAN address for CT2 is 31015.
When using CT2 for PV power, load_power reads negative when exporting.
Please add the following templates to correct this.
ct2_power:
friendly_name: "CT 2 Power"
unit_of_measurement: 'kW'
device_class: power
value_template: >
{{ [0, (states('sensor.ct2_meter') | float(default=0) * 1)]|max }}
house_power:
friendly_name: "House Power"
unit_of_measurement: 'kW'
device_class: power
value_template: >
{% set load = states('sensor.load_power') | float(default=0) %}
{% set ct2 = states('sensor.ct2_meter') | float(default=0) %}
{% set power = ( load + ct2 ) | round(3) %}
{{ "{:.3f}".format(power) }}
Cheers!
Just put a vote in for a review of scan interval settings?
I use 30 seconds for most sensors, with 5 seconds for power sensors.
For example, do we need to scan BMS cell mV high / low every 5 seconds, would 30 seconds suffice?
Should there be !secret scan_interval setting so people can make a global change up or down to the default 30 seconds if they wish?
Had a brand new system installed today and was quite looking forward to just cracking on with the HA build and better integration direct without relying on FoxESS Cloud and their slow polling.
Anyone had any joy extracting sensor data from the network port on the most recent firmware? I can't understand why a vendor would disable or limit this interaction?!
I've set this up perfectly, all of the sensors are available in HA but no data ever seems to appear.
OK... add this in your sensor part of configuration.yaml (mine is just below the integration sensors for bat discharge, grid consumption etc.).;
- platform: random
name: random_watts
minimum: 1
maximum: 10
Then find your template for battery charge
and replace the zero indicated with this code;
{{ (states('sensor.random_watts') | float - 5.5 ) / 1000 }}
first curly bracket needs to line up with the others in the template so it looks like this;
Originally posted by @Daibutt in #14 (comment)
Based on recent experience, I think you could add KH single phase inverters to the list as an enhancement with a wiki page on setting this up?
Heres the thing: there is no ethernet port so you connect to RS485 via the CT connector. You hook up W610 to this and scan for modbus ports and you find 31000!
So, surprisingly, KH then just works with the modbusLAN sensor configuration and the IP address of W610.
You would need a USB serial port config in modbusLAN for it to work with a USB to RS485 adapter.
This is more a query than a fault....does the modbus interface allow local control of whether the inverter is charging from the grid, or supplying to the grid...or is it read-only?
Cheers!
I noticed that you are integrating H3 inverters into the repo. Having seen this form of integration before with other platforms I'm offering a suggestion for a new layout which should help the maintainer's sanity when propagating changes. This isn't a PR although you are welcome to take it.
Pros:
Cons:
https://github.com/rand12345/HA-FoxESS-Modbus/tree/new-layout-prototype
I have set my sensors with a scan_interval of 5 - 30 sec. However, the values update very differently, often there are some minutes no update, sometimes even up to 25 min. although the values change with the cloud integration very fast.
But since I prefer the solution via Modbus, I would like to find out if this is a normal behavior or if it can be due to a misconfiguration. Here are a few examples. In this case, there was bright sunshine and the battery was charging at about 3 - 4 KW, so the SoC sensor should have changed promptly, but instead there are jumps of ~20%.
My setup
SoC sensor config:
- name: "fox_bat_soc"
scan_interval: 30
slave: 247
address: 31038
state_class: measurement
unit_of_measurement: "%"
data_type: uint16
input_type: holding
device_class: battery
Modbus config
- name: FoxESS_Inverter
type: tcp
host: 192.168.XX.XXX
port: 502
retry_on_empty: true
retries: 3
timeout: 5
close_comm_on_error: false
in the same time template sensor (pv1_power & pv2_power) has delivered timely data:
so it looks like the inverter is providing data but very different in time, is there any explanation or way to change this?
I would like to have as accurate data as possible
regards
Issue with grid accuracy:
https://www.facebook.com/groups/foxessownersgroup/permalink/1577479335967576/
"For the last two days I've seen some funny values in my HA energy dashboard. Todays usage, for example, shows we've imported 5kWh from the grid when using the grid_daily sensor for the Grid consumption. But if I change that to use the Hildebrand Glow integration I only see 0.6kWh of consumption.
Yesterday was similar, and Octopus, Glow and even FoxEssCloud all seem to agree on consumption. It's just the grid_daily sensor that is wrong."
From work done on https://github.com/nathanmarlor/foxess_modbus, we've found what the W610 supports one read about every 700ms (sometimes it can do one quicker). It's capable of reading 8 registers at a time, but the modbus integration only reads 1 register at a time. This means that it theoretically takes 28s to read the 40 sensors in modbusUSB.yaml.
modbusUSB.yaml contains a range of scan_intervals, but they add up to more than 1 read every 700ms.
This means that the modbus integration spawns read operations more quickly than they can be completed. There's no logic to say "I want to refresh this sensor, but it's still waiting for the previous refresh to finish, so I'll hold off" -- it just keeps throwing read operations onto a queue inside home assistant. The queue gradually grows in size, which is going to slow things down, and might eventually crash home assistant. It also delays things like shutdowns and restarts. It also means that sensors aren't actually read at the interval that was requested.
However there's no indication of this unless you go and manually add logging calls to the modbus integration. I did this, and very quickly I've got to having tasks which have been sitting in the queue for 15 minutes+, and it's still rising.
To make matters worse, some people are discussing setting the scan_interval to 5 seconds, or even 1 second, without knowing the problems this causes.
You should probably increase the scan_intervals in modbusUSB.yaml so that they don't mess up home assistant for people who are using a W610 by default, and add some strong warnings not to decrease them?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.