your integration will be ok, but are you getting all the readings from the SMA?
When I login in the SMA webconnect portal and I do see daily_yield values and few others. Some I could not find when I login as a user.
I logged in as installer and put the tcp server “on”. After doing so i could use them all. Try to get that code from the company that installed yours or ask them to do it for you
Updated the TCP and tried with user and installer accounts and I still do not see these values. I will keep researching and see if I am missing something from my end.
I tried using the modbus option and i do get daily yield but that is a very long number as others have mentioned. Hopefully there is a fix for that and my setup for SMA is complete.
I use this and never had any issue. Hope this helps for you. keep me posted if it did
modbus:
-
type: tcp
host: IP from the inverter
port: 502
sensor:
-
platform: modbus
scan_interval: 60 #time in seconds for getting values
registers:
-
name: SMA_Power_AC
unit_of_measurement: W
slave: 3
register: 30775
count: 2
data_type: int
-
name: PV Daily Yield
unit_of_measurement: kWh
slave: 3
register: 30517
scale: 0.001
precision: 3
count: 4
data_type: uint
-
name: PV Total Production
unit_of_measurement: MWh
slave: 3
register: 30513
scale: 0.000001
precision: 3
count: 4
-
name: Grid Voltage
unit_of_measurement: V
slave: 3
register: 30783
count: 2
scale: 0.01
precision: 2
data_type: uint
-
name: Grid frequency
unit_of_measurement: Hz
slave: 3
register: 30803
count: 2
scale: 0.01
precision: 2
data_type: uint
-
name: SMA_temp
unit_of_measurement: °C
slave: 3
register: 30953
count: 2
scale: 0.1
precision: 1
data_type: int
-
name: SMA_status
slave: 3
register: 30201
count: 2
-
name: SMA_grid
slave: 3
register: 30217
count: 2
-
name: Insulation
slave: 3
register: 30225
count: 2
scale: 0.001
unit_of_measurement: kOhms
-
name: SMA_Residual_current
slave: 3
register: 31247
count: 2
scale: 1
unit_of_measurement: mA
-
name: Apparent Power
unit_of_measurement: VA
slave: 3
register: 30813
scale: 1
precision: 0
count: 2
data_type: int
-
name: Reactive Power
unit_of_measurement: VAr
slave: 3
register: 30805
scale: 1
precision: 0
count: 2
data_type: int
-
-
platform: template
sensors:
modbus_sma_pv_power:
entity_id: sensor.sma_power_ac friendly_name: 'Power Output' value_template: >- {% if states('sensor.sma_power_ac')|float < 0 or states('sensor.sma_power_ac')|float > 10000 %} 0 {% else %} {{ states('sensor.sma_power_ac') }} {% endif %} unit_of_measurement: "W" icon_template: mdi:flash-circle
modbus_sma_pv_apparent_power:
entity_id: sensor.apparent_power friendly_name: 'Apparent Power' value_template: >- {% if states('sensor.apparent_power')|float < 0 or states('sensor.apparent_power')|float > 10000 %} 0 {% else %} {{ states('sensor.apparent_power') }} {% endif %} unit_of_measurement: "VA" icon_template: mdi:flash-circle
modbus_sma_pv_reactive_power:
entity_id: sensor.reactive_power friendly_name: 'Reactive Power' value_template: >- {% if states('sensor.reactive_power')|float < 0 or states('sensor.reactive_power')|float > 10000 %} 0 {% else %} {{ states('sensor.reactive_power') }} {% endif %} unit_of_measurement: "VAr" icon_template: mdi:flash-circle
modbus_sma_pv_residual:
entity_id: sensor.sma_residual_current friendly_name: 'Residual Current' value_template: >- {% if states('sensor.sma_residual_current')|float < 0 or states('sensor.sma_residual_current')|float > 10000 %} 0 {% else %} {{ states('sensor.sma_residual_current') }} {% endif %} unit_of_measurement: "mA" icon_template: mdi:flash-circle
modbus_sma_temperature:
entity_id: sensor.sma_temp friendly_name: 'Inverter Temp' value_template: >- {% if states('sensor.sma_temp')|float < 0 or states('sensor.sma_temp')|float > 100 %} 0 {% else %} {{ states('sensor.sma_temp') }} {% endif %} unit_of_measurement: "°C"
modbus_grid_frequency:
entity_id: sensor.grid_frequency friendly_name: 'Grid Frequency' value_template: >- {% if states('sensor.grid_frequency')|float < 30 or states('sensor.grid_frequency')|float > 100 %} Not Measured {% else %} {{ states('sensor.grid_frequency') }} {% endif %} unit_of_measurement: "Hz"
modbus_grid_voltage:
entity_id: sensor.grid_voltage friendly_name: 'Grid Voltage' value_template: >- {% if states('sensor.grid_voltage')|float < 180 or states('sensor.grid_voltage')|float > 300 %} Not Measured {% else %} {{ states('sensor.grid_voltage') }} {% endif %} unit_of_measurement: "V"
modbus_inverter_status:
entity_id: sensor.sma_status friendly_name: 'Inverter Status' value_template: >- {% if is_state('sensor.sma_status', '307' ) %} OK {% elif is_state('sensor.sma_status', '303' ) %} Off {% elif is_state('sensor.sma_status', '455' ) %} Warning {% elif is_state('sensor.sma_status', '35' ) %} Fault {% endif %}
modbus_grid_contactor:
entity_id: sensor.sma_grid friendly_name: 'Grid contactor' value_template: >- {% if is_state('sensor.sma_grid', '51' ) %} Closed {% else %} Open {% endif %}
Yes. I am using the same one. But for Daily Yield I get a very large number as others above have mentioned.
I have been looking into this more and the register 30517 is not a valid value for the version in US and that could explain why this random value. I looked into the sunny web portal and seems like it is calculating based on the 5 minute intervals it gathers data from the TotWh (30513) register and displaying in the UI. I am not sure how I go about adding the date parameter to this sensor and do the calculation to make it happen. This way we can calculate Today, Yesterday and daily generation from SMA.
Not sure if you’ve been able to fix it already, but i had the same and it was solved after i’ve updated the firmware of my Sunny Boy
I have the same issue and I am on the latest firmware as well but it is not resolved.
Hi all, I’m new to the hassio scene.
Main reason I’m getting in to it is our SMA solar installation. I’m trying to use the SMA integration that’s included, but can’t connect to our home manager. Can anyone tell me to where I should connect as the ‘host’? Tried ip adress and serial number, but I can’t seem to connect. Is there a setting I should change in the home manager or something?
Hi, I have tried to follow your example, but I got this far and then it’s over for me now it’s about the sensors that I can’t call up and always get an error message.
Maybe something is wrong with the settings in the inverter.
@csacre I used your very nice sma_bridge AppDeamon class and it was working perfectly since a few days. It seems that SMA changes sommething at there Sunny Portal website. Is your’s still working? or maybe can you share an adjustment, if you already did one?
Even if I am using modbus now, a lot better, I tried my legacy integration in AppDaemon and it still work. I only tested the part that is getting data from the portal. Could you be more specific ? MAy be an error in the AppDaemon log ?
I have put some log output inside the getSMAData to see the result of the request:
…
response = session.get(url,headers=myheaders)
if response.status_code == 200:
myhtml = response.content
self.log(“myhtml:” + str(myhtml))
…
And the problem is, that there is no more json returned but the html page. Seems that maybe the login did not work anymore, even if it tells " INFO sma_bridge: SMA Logon :200 ".
Maybe you have any idea where to look for?
On my side, I still receive JSON data so it works.
So it may be location dependent (I am in Belgium)
If you see the data in the HTML page, it wold be anyway possible to parse the content.
Do you see the production data in the HTML page ?
If you send me a copy of the data, I can parse this and update the code.
Hello,
I state that I have several gaps with English and moreover I am a novice in the use of home assistant.
I come to the point, I configured in my configuration.yaml file what was reported by mamra andreas, it seems that it does not give me any errors; however I cannot find the way to view the inverter information from the home assistant; someone tell me how to do it?
by the way, the inverter is Sunny Boy TL6000-21 and is installed in Italy.
thank you
@csacre
I did some more debugging and traced out the content of the response after the login around here:
self.log (“SMA Logon :” + str(response.status_code))
The result is an html page with the login page again and above user and passowrd field the message:
Unknown e-mail address or incorrect password
So i copy and pasted the login data from the script to the real website and tried to login and it was working - so login data in the script is correct.
I don’t know what happens. Maybe they are blocking something.
Did you changed your password ? Do you have special characters in your password ?
no nothing special, no change
So far I tested locally on my PC. I created a test class to run in from AppDaemon4 and still working.
Do you use AppDaemon4 ?
Do you have beautifulsoup4 in the packages for AppDaemon4 (configuration) ?
I am getting out of ideas.
init_commands: []
python_packages:
- beautifulsoup4
system_packages: []
2022-02-16 21:33:14.258517 INFO test: TEST SMA calendar START
SMA Logon :200
getSMAData:{'__type': 'LiveDataUI', 'Timestamp': {'__type': 'DateTime', 'DateTime': '2022-02-16T21:33:19', 'Kind': 'Unspecified'}, 'TimestampUtc': {'__type': 'DateTime', 'DateTime': '2022-02-16T20:33:19', 'Kind': 'Utc'}, 'PV': 0, 'FeedIn': None, 'GridConsumption': None, 'DirectConsumption': 0, 'SelfConsumption': 0, 'SelfSupply': 0, 'TotalConsumption': 0, 'DirectConsumptionQuote': None, 'SelfConsumptionQuote': None, 'AutarkyQuote': None, 'BatteryIn': None, 'BatteryOut': None, 'BatteryChargeStatus': None, 'OperationHealth': {'__type': 'StateOfHealth', 'Ok': 1, 'Warning': 0, 'Error': 0, 'Unknown': 0}, 'BatteryStateOfHealth': None, 'ModuleTemperature': None, 'EnvironmentTemperature': None, 'WindSpeed': None, 'Insolation': None, 'BatteryMode': None, 'InfoMessages': [], 'WarningMessages': [], 'ErrorMessages': [], 'Info': {}}
{'__type': 'LiveDataUI', 'Timestamp': {'__type': 'DateTime', 'DateTime': '2022-02-16T21:33:19', 'Kind': 'Unspecified'}, 'TimestampUtc': {'__type': 'DateTime', 'DateTime': '2022-02-16T20:33:19', 'Kind': 'Utc'}, 'PV': 0, 'FeedIn': None, 'GridConsumption': None, 'DirectConsumption': 0, 'SelfConsumption': 0, 'SelfSupply': 0, 'TotalConsumption': 0, 'DirectConsumptionQuote': None, 'SelfConsumptionQuote': None, 'AutarkyQuote': None, 'BatteryIn': None, 'BatteryOut': None, 'BatteryChargeStatus': None, 'OperationHealth': {'__type': 'StateOfHealth', 'Ok': 1, 'Warning': 0, 'Error': 0, 'Unknown': 0}, 'BatteryStateOfHealth': None, 'ModuleTemperature': None, 'EnvironmentTemperature': None, 'WindSpeed': None, 'Insolation': None, 'BatteryMode': None, 'InfoMessages': [], 'WarningMessages': [], 'ErrorMessages': [], 'Info': {}}
2022-02-16 21:33:19.968221 INFO test: TEST SMA calendar END