Replies: 23 comments 1 reply
-
Hi, Wrt 2, you should be able to connect from HA as well (from what I just read, it uses webconnect and this one may work https://www.home-assistant.io/integrations/sma/) Cheers, |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
jpc,
Thanks for getting back to me. To you your answer, basically no. I have not been able to get things working yet.
I initially started by loading the SMA Solar Integration.
I set up the host to be my local SMA WebBox IP address. (I can reach it's local Web Page by using it's IP using any browser).
I have tried various combinations of (Uses an SSL certificate) and (Verify SSL certificate) then also Groups User or Installer.
I have access to both through the web page. I then supply the correct password.
When I click on submit, it has a fail message of (Failed to connect). Then also, I tried with the port settings added to the IP. Still no luck.
I have also tried using it's host name but that does not work for me even if I try it through a web page.
At one time access using the host name worked, but since I changed routers it seems that I can't use this method anymore. (Maybe DHCP issue)?
I have seen posts from others having the same problem. Some say that there is a maximum character string length for the password.
I have tried various suggestions but still have not had any success.
I stumbled across your Github and thought I would give it a try. So that's where I'm at now.
I would be interested to see if you are doing something different in your SMA WebBox settings that maybe makes it work for you.
Here's a snip of my web box settings
[cid:cfafe17a-307a-48c7-a3c2-becb5823e505]
I suppose that it's also possible that the HA SMA integration poling is timing out before the web box comes back with a response.
Could also somehow be associated with my router?
So at this point I'm stuck and any help you can give would be appreciated.
…________________________________
From: jpcornil-git ***@***.***>
Sent: Wednesday, May 22, 2024 2:05 PM
To: jpcornil-git/HA-sma ***@***.***>
Cc: fkitzmann ***@***.***>; Author ***@***.***>
Subject: Re: [jpcornil-git/HA-sma] Adding https://github.com/jpcornil-git/HA-sma to custom repositories gives error (Discussion #16)
Hi,
Were you able to solve your issue ? OK to close this discussion ?
Cheers,
jpc
—
Reply to this email directly, view it on GitHub<#16 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AQV5RSZSZBZ3ZUVDKLUD7RDZDUCCRAVCNFSM6AAAAABH6AY25WVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TKMRXGIYDE>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
The SMA webbox supports a RPC protocol to read data (used by this integration) while most/all integrated web server uses SMA webconnect (SMA solar integration) => with a webbox, this integration should work while the other not. You can test connectivity/interopperability outside of HA by running the sma_webbox.py script directly from a console as described at the bottom of the README page), if that works it should also work within HA. |
Beta Was this translation helpful? Give feedback.
-
JP,
So I'm not quite grasping what all I need to have running. I'm more oriented with the hardware than I am with software, so I'm working in the dark.
In any case, This is what I think I need but is missing.
I gather that the script runs under Python. I don't have Python running on either the windows side or on HA.
So I started by downloading Python 3.12.3 on my PC machine. I opened up a python command window and tried
the following -
python3 custom_components/sma_webbox/sma_webbox.py 192.168.1.144
This gave me a invalid syntax error.
I also tried -
sma_webbox.py
and got -
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
sma_webbox.py
NameError: name 'sma_webbox' is not defined
Obviously I don't have things set up properly on the PC side.
So now I decided to move to the HA side and try that way.
Since I don't currently have Python running on HA I need to load it.
It looks like I need to have Remote Python debugger installed on HA.
In looking into this it seems that I need to install it's integration by adding (debugpy:) into my configuration.yaml
I have not done this yet and not 100% sure where to put it, or if it makes any difference.
This is my current config.yaml
[cid:057f1ef0-46b2-4b20-8791-987c1c87b6e0]
Do I just put the following line at the new line 12 -
debugpy:
Do I also need to include debugpy.start ?
Is there anything else I need to include?
I also see this in //Python Scripts
Start by enabling the Python Scripts integration and create the first script.
* Add to configuration.yaml: python_script:
* Create the folder <config>/python_scripts
Do I need to do any of the above?
Thanks
|
Beta Was this translation helpful? Give feedback.
-
sma_webbox.py is a python script, you should call python from a window command line not from within a python shell/command line. e.g. from the directory in which sma_webbox.py is located (replace with the name of the python program; py, python, "C:\Program Files\Python 3.12\python.exe", ...)
You don't need to touch/install anything on HA. Btw, could you describe your system; what HW is running HA (x86, RPi, ...), is this a HAOS/docker/... install, are you using HACS to install an integration like this one or are you cloning manually in custom_coponents, ... ? |
Beta Was this translation helpful? Give feedback.
-
Thanks for you help.
So this is where I'm at right now.
I put a copy of HA-sma from github and put everything on my local PC machine.
The sma_webbox.py python script is currently in my following PC directiory -
C:\Program Files (x86)\SMA\HA-sma-main\custom_components\sma_webbox
I also have Python 3.12 app loaded on my PC and I can open it to the command line window using the app.
I can't seem to get to the path that has the python.exe file in it. (neither when in file explore or from a windows cmd window).
It appears that it's located in - C:\Program Files\WindowsApps but the WindowsApps directory was originally hidden which I now have it exposed.
The problem I currently have is that the WindowsApps directory is currently protected and I don't seem to have the required access.
When I look at permissions it seems that I have Read & execute, so I seem to be stuck here for now.
As far as what HA equipment I'm running. I running - https://www.home-assistant.io/yellow/
*
[https://www.home-assistant.io/images/yellow/yellow_hero.jpg]<https://www.home-assistant.io/yellow/>
Home Assistant Yellow<https://www.home-assistant.io/yellow/>
Home Assistant Yellow is your Matter-ready, upgradeable, and extendable smart home hub. You won't need anything else.
www.home-assistant.io
with 500GB NVMe SSD.
Core 2024.5.5
Supervisor 2024.05.1
Operating System 12.3
Frontend 20240501.1
So It's basically using a Raspberry Pi Compute Module 4
I access my HA hardware through it's browser http://192.168.1.xxx:8123
|
Beta Was this translation helpful? Give feedback.
-
From your description, it seems that you installed python from the Microsoft Store. You should therefore be able to run python by opening a windows command prompt/interpreter/cmd window and then type "py" or "python" or ... cfr. I see that you cloned this repository into "C:\Program Files (x86)", this is not necessary, you can move it to your user directory e.g. C:\Users\MyUser\Documents (replace MyUser by your user name)
|
Beta Was this translation helpful? Give feedback.
-
JP,
Thanks again for your response.
So I made a copy of the HA-sma-main directory and tried to run sma_webboy.py.
I opened up a windows command window and tried the following -
C:\Users\fkitz\Documents\HA-sma-main\custom_components\sma_webbox> sma_webbox.py 192.168.1.144
This appears to be somewhat working and doing something, but can't totally tell what.
It flashes open another window for a short ~ .2 second period and then disappears.
It appears to have some text in it but it's not open long enough for me to read it.
Would you have an example of what the window should look like?
Would this be a login window that does not stick around for some reason?
Could I possibly add my login credentials to the string I'm sending?
Also, would you have an idea as to how to make the pop up window stay?
Maybe this is one reason that the HA SMA Solar integration fails for me when I try to add it.
|
Beta Was this translation helpful? Give feedback.
-
You should try with:
I guess your python setup starts a new command window when a python script is invoked as you did. |
Beta Was this translation helpful? Give feedback.
-
Hi JP,
Tried your suggestion and this is what I got.
[cid:141d1f7f-2e9e-4ae7-ae5e-2dee6cda64b0]
Looks like it did try and start.
Seems like the message of - ValueError: reuse_port not supported by socket module
Maybe it does not understand the IP address I'm using?
Note, http://192.168.1.34 changed from my prior since I had to re-boot my webbox. I can get to my webbox using this new IP in a browser.
Again, Is this supposed to open another window showing the various measured values?
Do you have an example of what I should be seeing when working correctly?
Thanks
…________________________________
From: jpcornil-git ***@***.***>
Sent: Monday, June 3, 2024 2:29 AM
To: jpcornil-git/HA-sma ***@***.***>
Cc: fkitzmann ***@***.***>; Author ***@***.***>
Subject: Re: [jpcornil-git/HA-sma] Adding https://github.com/jpcornil-git/HA-sma to custom repositories gives error (Discussion #16)
You should try with:
C:\Users\fkitz\Documents\HA-sma-main\custom_components\sma_webbox> python sma_webbox.py 192.168.1.144
I guess your python setup starts a new command window when a python script is invoked as you did.
—
Reply to this email directly, view it on GitHub<#16 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AQV5RSYYPI4NDFTXBZB3M7TZFQZRJAVCNFSM6AAAAABH6AY25WVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TMNBVHA2DG>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
# Create an UDP socket listening on port WEBBOX_PORT
# and from any interface
_, protocol = await loop.create_datagram_endpoint(
lambda: WebboxClientProtocol(loop, (url, WEBBOX_PORT)),
local_addr=("0.0.0.0", WEBBOX_PORT),
reuse_port=True,
) with # Create an UDP socket listening on port WEBBOX_PORT
# and from any interface
_, protocol = await loop.create_datagram_endpoint(
lambda: WebboxClientProtocol(loop, (url, WEBBOX_PORT)),
local_addr=("0.0.0.0", WEBBOX_PORT),
reuse_port=False,
) Note that once this is working/before adding the integration to HA, you will have to fix the ip address of your webbox, either:
Otherwise HA will lose connection with your webbox after another reboot/address change |
Beta Was this translation helpful? Give feedback.
-
JP,
Got it working under windows.
Thank you verry much.
[cid:f46a7b5c-5e73-49c1-9084-35bc47237847]
Some other questions now.
So when I add this to HA. Sounds like I should keep reuse_port to be True. Correct?
Then to add it to HA, should I be copying the top level HA-sma-main directory to HA and where should it end up directory wise in HA?
I'll go through the README.md to set everything up as described there.
Of course I'll also set my webbox to a static IP.
…________________________________
From: jpcornil-git ***@***.***>
Sent: Monday, June 10, 2024 11:48 PM
To: jpcornil-git/HA-sma ***@***.***>
Cc: fkitzmann ***@***.***>; Author ***@***.***>
Subject: Re: [jpcornil-git/HA-sma] Adding https://github.com/jpcornil-git/HA-sma to custom repositories gives error (Discussion #16)
reuse_port is not supported on Windows platforms; as illustrated below, just replace at line 398 "True" with "False" (only consequence of that is that you may have to wait a bit for the socket to be released by the OS when you start the script for the second time)
# Create an UDP socket listening on port WEBBOX_PORT
# and from any interface
_, protocol = await loop.create_datagram_endpoint(
lambda: WebboxClientProtocol(loop, (url, WEBBOX_PORT)),
local_addr=("0.0.0.0", WEBBOX_PORT),
reuse_port=True,
)
with
# Create an UDP socket listening on port WEBBOX_PORT
# and from any interface
_, protocol = await loop.create_datagram_endpoint(
lambda: WebboxClientProtocol(loop, (url, WEBBOX_PORT)),
local_addr=("0.0.0.0", WEBBOX_PORT),
reuse_port=False,
)
Note that once this is working/before adding the integration to HA, you will have to fix the ip address of your webbox, either:
* configure your webbox with a static ip address (outside the range used by your router DHCP to avoid potential ip address conflits)
* configure your router DHCP to always allocate the same ip address to this device (not always available)
Otherwise HA will lose connection with your webbox after another reboot/address change
—
Reply to this email directly, view it on GitHub<#16 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AQV5RSZIZHOMWXFCPWHDYW3ZG2MTPAVCNFSM6AAAAABH6AY25WVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMZUHE3TO>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
If First thing now, is to fix your webbox to a static IP. Once completed, you can install this integration using HACS (recommended) or manually as explained here: [core-ssh ~] ls /config/custom_components/sma_webbox/
config_flow.py __init__.py sma_webbox.py translations const.py manifest.json sensor.py strings.json You should not touch/modify |
Beta Was this translation helpful? Give feedback.
-
Were you able to get it working ? |
Beta Was this translation helpful? Give feedback.
-
Been busy and have not been able to try yet. Will update you.
Thanks.
…________________________________
From: jpcornil-git ***@***.***>
Sent: Sunday, June 16, 2024 1:21 PM
To: jpcornil-git/HA-sma ***@***.***>
Cc: fkitzmann ***@***.***>; Author ***@***.***>
Subject: Re: [jpcornil-git/HA-sma] Adding https://github.com/jpcornil-git/HA-sma to custom repositories gives error (Discussion #16)
Were you able to get it working ?
—
Reply to this email directly, view it on GitHub<#16 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AQV5RSYBPXIHE6IBGCRWNILZHXXVFAVCNFSM6AAAAABH6AY25WVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOOBYGM3DS>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
It looks like I'm not fully understanding how to get the HA-sma files properly into my Home assistant.
I'm following this information in the readme doc. ---
Installation
Using HACS<https://hacs.xyz/>
1. Add https://github.com/jpcornil-git/HA-sma to your custom repositories<https://hacs.xyz/docs/faq/custom_repositories/>
I open HACS and click on the 3 upperr right dots and select – Custom repositories
I then fill in Repository with --
https://github.com/jpcornil-git/HA-sma.git
[https://opengraph.githubassets.com/44384c1dc1d5c55c637b56b0e68373595ff5ad800dac74ac112b2e7afc640a9a/jpcornil-git/HA-sma]<https://github.com/jpcornil-git/HA-sma.git>
GitHub - jpcornil-git/HA-sma: SMA Sunny Webbox integration for Home Assistant<https://github.com/jpcornil-git/HA-sma.git>
SMA Sunny Webbox integration for Home Assistant. Contribute to jpcornil-git/HA-sma development by creating an account on GitHub.
github.com
With a category of Integration
After clicking on add, I then get a warning message of –
Repository 'jpcornil-git/ha-sma' exists in the store.
See snapshot -
[cid:40217397-407d-4939-be3b-22ee5c9fde18]
I also tried a Repository of –
https://github.com/jpcornil-git/HA-sma
As listed in the readme doc. Still got the same warning message and nothing further happens.
I also added the GitHub Integration thinking I needed that but did not help.
See snapshot -
[cid:86c0be3f-127e-477a-b2b6-dcb9c7f3848a]
I was expecting that it would automatically clone all files and sub directories from the GitHub
location and put somewhere on my local HA, but apparently not.
What am I doing wrong?
|
Beta Was this translation helpful? Give feedback.
-
Attached pictures are not visible (because of email reply rather than github reply probably) Based on your message, it seems that the repository has already been added to HACS custom repositories (when you add a new custom repository, exiting ones should be listed above the entry fields) When a custom repo is added, it just means that related component will be added to the list of all available HACS components, i.e. you still need to install the integration by clicking on HACS->Integrations->Explore and download then search for "SMA Sunny Webbox" and then download. After that you should see a sma_webbox in HA custom_components directory. Once there, you can restart HA and add this integration as any HA core integration. |
Beta Was this translation helpful? Give feedback.
-
JP,
So it looks like I now have all the sma_webbox files in my custom_components directory. See directory list -
[core-ssh homeassistant]$ cd custom_components
[core-ssh custom_components]$ ls -la
total 12
drwxr-xr-x 10 root root 4096 May 18 20:05 hacs
Drwxr-xr-x 3 root root 4096 May 25 18:01 pyscript
Drwxr-xr-x 4 root root 4096 Jun 18 20:16 sma webbox
[core-ssh custom components]$ cd sma_webbox
[core-ssh sma_webbox]$ ls -la
total 72
drwxr-xr-x 4 root root 4096 Jun 18 20:16 .
drwxr-xr-x 5 root root 4096 Jun 18 19:06 ..
-rw-r--r-- 1 root root 4745 Jun 18 19:06 init .pv
drwxr-xr-x 2 root root 4096 Jun 18 20:16 pycache
-rw-r--r-- 1 root root 5636 Jun 18 19:06 config_flow.py
-rw-r--r-- 1 root root 279 Jun 18 19:06 const.py
-rw-r--r-- 1 root root 336 Jun 18 19:06 manifest.json
-rw-r--r-- 1 root root 8727 Jun 18 19:06 sensor.py
-rw-r--r-- 1 root root 15565 Jun 18 19:06 sma_webbox.py
-rw-r--r-- 1 root root 803 Jun 18 19:06 strings.json
drwxr-xr-x 2 root root 4096 Jun 18 19:06 translations
I also now have SMA Sunny Webbox device that shows up in my HA's Electrical Energy Overview area.
Initially it did not have anything in Entities other than SMA Sunny Webbox update.
I looked for other Entities but could not find anything with the SMA or WEBBOX_x name, other then SMA Sunny Webbox update.
Seems that either I'm not seeing anything related to other SMA functions (sensors) like current power, etc.
Your README.md talks about Poll Sunny Webbox using rpc. Is there something more I need to add in my configuration.yaml?
This is what it currently looks like -
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sma_webbox:
ip_address: 192.168.1.9
port: 34268
scan_interval: 30
I do see sensor.py in /homeassistant/custom_components/sma_webbox/sensor.py
Seams like the above should take care of this and expose all sensors in the list.
Does something else need to be loaded or added to expose those other sensors?
When I run sma_webbox.py in a windows cmd window I see the following for my 3 inverters.
INFO:__main__:meta name value unit
INFO:__main__:GriPwr Power 107 W
INFO:__main__:GriEgyTdy Day yield 1083.555 kWh
INFO:__main__:GriEgyTot Total yield 133410.235kWh
INFO:__main__:OpStt Condition Ok, Ok
INFO:__main__:Msg Message
INFO:__main__:Devices
INFO:__main__: Key:0063:5a458b7b, Name:Bank 1 - 1514507131
INFO:__main__: Ipv DC current input 0.238 A
INFO:__main__: Upv-Ist DC voltage input 160 V
INFO:__main__: Fac Grid frequency 59.97 Hz
INFO:__main__: Pac Power 26 W
INFO:__main__: h-On Feed-in time 57209.64 h
INFO:__main__: E-Total Total yield 43295.732 kWh
INFO:__main__: Netz-Ein Number of grid connections 5681
INFO:__main__:Devices
INFO:__main__: Key:0063:5ca64cb9, Name:Bank 3 - 1554402489 Tkr
INFO:__main__: Ipv DC current input 0.394 A
INFO:__main__: Upv-Ist DC voltage input 206 V
INFO:__main__: Fac Grid frequency 59.97 Hz
INFO:__main__: Pac Power 66 W
INFO:__main__: h-On Feed-in time 54182.06 h
INFO:__main__: E-Total Total yield 31158.724 kWh
INFO:__main__: Netz-Ein Number of grid connections 5460
INFO:__main__:Devices
INFO:__main__: Key:0063:5dc83c93, Name:Bank 2 - 1573403795
INFO:__main__: Ipv DC current input 0.147 A
INFO:__main__: Upv-Ist DC voltage input 185 V
INFO:__main__: Fac Grid frequency 59.97 Hz
INFO:__main__: Pac Power 15 W
INFO:__main__: h-On Feed-in time 119840.4 h
INFO:__main__: E-Total Total yield 58955.776 kWh
INFO:__main__: Netz-Ein Number of grid connections 5397
INFO:__main__:-- Overview (Wed Jun 19 18:57:20 2024)
So I know that it can work that way and display different sensors.
If I look at https://www.home-assistant.io/integrations/sma
[https://www.home-assistant.io/images/default-social.png]<https://www.home-assistant.io/integrations/sma>
SMA Solar<https://www.home-assistant.io/integrations/sma>
Instructions on how to connect your SMA Solar Inverter to Home Assistant.
www.home-assistant.io
It shows a few sensors.
Thanks
…________________________________
From: jpcornil-git ***@***.***>
Sent: Tuesday, June 18, 2024 3:10 PM
To: jpcornil-git/HA-sma ***@***.***>
Cc: fkitzmann ***@***.***>; Author ***@***.***>
Subject: Re: [jpcornil-git/HA-sma] Adding https://github.com/jpcornil-git/HA-sma to custom repositories gives error (Discussion #16)
Attached pictures are not visible (because of email reply rather than github reply probably)
Based on your message, it seems that the repository has already been added to HACS custom repositories (when you add a new custom repository, exiting ones should be listed above the entry fields)
When a custom repo is added, it just means that related component will be added to the list of all available HACS components, i.e. you still need to install the integration by clicking on HACS->Integrations->Explore and download then search for "SMA Sunny Webbox" and then download.
After that you should see a sma_webbox in HA custom_components directory.
Once there, you can restart HA and add this integration as any HA core integration.
—
Reply to this email directly, view it on GitHub<#16 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AQV5RSYRFNF52ABSECKQS3TZICV5NAVCNFSM6AAAAABH6AY25WVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TQMJRGA4TE>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
Do you see MA webbox devices here ? (replace ip adress with yours) http://192.168.1.xxx:8123/config/integrations/dashboard |
Beta Was this translation helpful? Give feedback.
-
I'm entering this in windows browser - http://192.168.1.9:8123/config/integrations/dashboard and I get this - Unable to connect. |
Beta Was this translation helpful? Give feedback.
-
You are correct. Wrong IP. Was thinking I needed to use the Webbox's ip. |
Beta Was this translation helpful? Give feedback.
-
My pleasure/great to hear this ! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I’m new to HA and ran across your HA-sma in github. I have basically two Sunny Boy systems.
#1 Consists of Sunny WebBox with Bluetooth (WEBBOX-BT-20.GR1 running 01.05.08.R), String inverters - SWR 1800U x 3
#2 Consists of SMA_Multigate (MULTIGATE-US-10), Micro inverters – SB240-US-10 x 4
Since system #2 is only accessible using the SMA Energy IOS app and does not serve up any web page,
I’m only going to concentrate on system #1 since it looks like that's supported.
So I downloaded the HA-sma code. If I look at the README file it says to –
When I try and add it to HACS - Custom repositories I get the following warning message –
! <Template jpcornil-git/HA-sma> Repository structure for v2.1.1 is not compliant
Repository
https://github.com/jpcornil-git/HA-sma
Category
Template
It looks like I’m running HACS 1.34.0
Is there something I need to update or change?
Also, I'm running Home Assistant Yellow.
Beta Was this translation helpful? Give feedback.
All reactions