After a first attempt of making a network switch status card (switch-port-card) I was taken back by the number of entities you needed to declare to make it work.
I set out of making a SNMP integration with a new card that allows for 0 entities to be made before hand. The integration creates the needed entities internally. You also can configure and change the needed oids on the fly.
It supports any SNMP switch and you can configure the needed ports and other things in the options.
It was not easy but managed to create an snmp integration based on pysnmp 7.1. You can install the integration and basically in the dialog only have to set host ip (network switch ip) and the community string required by snmp. This first version works on v2c but you can also configure it in a later screen towards version 1 (version 3 support will come later if requested, but it is already based on the v3arch)
it is 99% HACS compliant except for the brands thing. I put in a ticket for it but was denied. If someone knows what to do, a hint would be appreciated. With this hurdle i can make it fully HACS compliant and add it to HACS
It is in basis an integration (although i started with a card). Is it possible to release an integration including the card or does this need to happen separately? The repo has the card in www/community directory and is fully functional
Hi & thanks for the work so far. However, I have a couple of problems.
How do I load the card?? I down-loaded the repository through HACS, re-started HA & added the integration. Then attempted to add the card by clicking the readme link but that returns “Repository partach/switch_port_card_pro_card not found”
However, trying to add the card via HACS custom repositories, HA says it’s already there - but the card is not listed to add to a dashboard.
Also, the integration configured 24 ports (the switch is a Cisco SG-200 18 port) so I unchecked the additional ports (ie selected ports 1-18) but the additional ports remain (now as unavailable).
Detected blocking call to listdir with args (‘/usr/local/lib/python3.13/site-packages/pysnmp/smi/mibs’,) inside the event loop by custom integration ‘switch_port_card_pro’ at custom_components/switch_port_card_pro/snmp_helper.py, line 28: _SNMP_ENGINE = SnmpEngine() (offender: /usr/local/lib/python3.13/site-packages/pysnmp/smi/builder.py, line 241: if f in os.listdir(self._srcName): # make FS case-sensitive), please create a bug report at GitHub · Where software is built (truncated)
Detected blocking call to import_module with args (‘custom_components.switch_port_card_pro’,) in /usr/src/homeassistant/homeassistant/loader.py, line 1078: ComponentProtocol, importlib.import_module(self.pkg_path) inside the event loop; This is causing stability issues. Please create a bug report at GitHub · Where software is built (truncated)
Thanks for the feedback, will help to make the card better.
Are you sure you added the customer repository switch_port_card_pro_card (with card at the end). The integration is named similar switch_port_card_pro (notice the word card missing). Probably you have this right, just want to make sure. As check good to see what system → dashboard → three dots → resources says (try to find the line with switch_port_card_pro_card and if it is correct).
Regarding the auto port detection, i have made some improvements in 0.8.1 and am tweaking more after user feedback. Problem is that every manufacturer implements SNMP slightly different in response values, which makes hard to make it perfect. Will launch a 0.8.2 with improvements today or tomorrow.
If i nail this auto port detection the extra entities should no longer appear…
Regarding the async - sync. This seems to be a known problem with the pysnmp (at least used to be). Somewhere in that code it does some synchronous call to filesystem loading MIB (in a async await call). That is what the warning is about. It is only a thing during initial load of the integration and a warning. I did not manage to find a way around it yet. If anyone knows, please let me know.
Thanks for the reply. The resource does not exist.
Yes, I saw ‘_card’ on the end but, when clicking on ‘add’ for the custom repository, the card repository doesn’t load (no error so I conclude the repository wasn’t found).
I’ll remove the lot & start again - will update then (24hrs or so).
I have released a new version (0.8.2) with very much improved port detection. Made a test suite to confirm it works with 4 manufacturers (at least some type of their switches), Ubiquiti (non unifi), Zyxel, Netgear and Unifi and even an asus router with merlin on it. So it should work hopefully for you as well.
First install re-install the integration, make sure it works. Then add the card via custom repositories (there is a pull request running for adding the card as separate entity on HACS for a few days, hopefully this comes through soon. If so you can add also the card directly via HACS)
I’ve removed the integration, restarted HA, downloaded switch_port_card_pro (edited), restarted HA, confirmed the integration was OK (V0.8.2 with 32 entities). Then HACS, custom repositories (partach/switch_port_card_pro_card, dashboard) & clicked ADD. It appeared to add (and the pycache folder was loaded into the \custom_components\switch_port_card_pro folder).
However, there is still no resource listed. Can I manually add the resource?
(fyi: HA 2025.12.3 in Docker container)
smart_switch_card_pro? typo?
theorethically you can add the resource, but that should have happened during install…? I am also at a loss here… Did you try to add the resource manually?
Oops! Yes, typo. switch_port_card_pro (edited above)
Yes, aware the resource should load automatically but it hasn’t. No, didn’t try to add the resource manually. If you can give me the syntax, I’ll add it and see what happens.
Well you already indicated the file (java script card) was installed in the right directory it should be:
/local/community/switch_port_card_pro_card/switch-port-card-pro.js
Type: Javascript
Make sure to test the directory in the fs, it should be:
…/config/www/community/switch_port_card_pro_card/switch-port-card-pro.js
So actually the same but resource uses /local/ in stead of /config/www/
Add the resource here (but you probably know that) Setting → Dashboard → tree dots in upper right corner → Resources
By the way if it installed correctly it would have shown as:
/hacsfiles/switch_port_card_pro_card/switch-port-card-pro.js?hacstag=xxxxxxx
I notice the card says “(plugin)”. Is this the issue? I’m running HA in a docker container. My (very) limited understanding was that plugins were very difficult to run in a Docker environment.
Plugin is the type of the hacs resource. Dashboard is indeed the good setting. I see both used in different circumstance. Terminolgy confusion also for me…
I dont have much understanding regarding docker installations.
So either:
Custom repository route (which should be the easier route), which should add the resource automatically. If this does not work:
Manual install. Forget hacs. install the card as shown above in /www/community/… Then add the resource as also shown above in Dashboard menu.
Do this:
remove custom repository if still there (just to be sure)
put the file in …/config/www/community/switch_port_card_pro_card/switch-port-card-pro.js
Add the resource:
/local/community/switch_port_card_pro_card/switch-port-card-pro.js
Type: Javascript
Done: this should work afaik
Your links in your documentation are incorrect and need to be fixed. People hate manually installing things, and it just takes some time from you to make some changes and not dismiss people,
I have spend a lot of time getting this right and helping people, see github reported issues as well. I have spent weeks trying to get it in HACS or getting answers on combining card and integration (which is not answered). So please be more respectfull and not assume.
I am dependent on the help of HACS integrators putting in the pull request, which is in wait on their side. I am spendig my free time trying to make something beautifull which cost you nothing.
The integration is on HACS in that it works for many people and the pull request was accepted for the integration. I can see in the code it is still there.
The card is another matter that does not work as part of the integration so had to make a separate repository so that people can install that easy via HACS as well. This card pull request to get it into HACS has not been approved yet