Closed degrammont closed 1 year ago
I'm experiencing similar issues.
+1 Unfortunately I am unable to get logs because HA is not reachable anymore if the sensor is configured. Is this an issue with newer Switch firmware versions? Which is the last known working version?
I tried this component also some time ago. Was not working for both my gs110tpv3 switches with firmware 7.0.9.5. Same after HA restart unable to open HA and massive errors in logs (looking as same error here).
What I think is happening : the component tries to get a login cookie when opening http://-switchip-/login.cgi. But at my switches this isnot working as it is using html auth and not cgi.
Manually entering http://-switchip-/login.cgi redirects me to the html login page.
So either we need to find the correct cgi file for login, or the component needs to be rewritten to use html auth.
Sorry but cannot help getting neither of them as I'm not a programmer.
I'll take a look into it. However HA starts for me with this integration (Home Assistant 2022.12.9)
Looks like your HomeAssistant environment does not have a temp filesystem, I will change that.
I removed the tempfile in 166e736a531547e04358a50e63008174ba781029 Could you check if it works now?
Tested it with
cd src/ckw-ha-gs108e/custom_components/ckw_hass_gs108e
python
import utils
utils.get_switch_infos("192.168.178.5", "password")
Results
{'switch_ip': '192.168.178.5', 'response_time_s': 0.9566987780272029, 'ports': [{'port_nr': 1, 'port_name': 'Port 0', 'traffic_rx_bytes': 0, 'traffic_tx_bytes': 0, 'speed_rx_bytes': 0, 'speed_tx_bytes': 0, 'speed_io_bytes': 0, 'crc_errors': 0}, {'port_nr': 2, 'port_name': 'Port 1', 'traffic_rx_bytes': 52986, 'traffic_tx_bytes': 2187785, 'speed_rx_bytes': 55384, 'speed_tx_bytes': 2286806, 'speed_io_bytes': 2342190, 'crc_errors': 0}, {'port_nr': 3, 'port_name': 'Port 2', 'traffic_rx_bytes': 16849, 'traffic_tx_bytes': 36856, 'speed_rx_bytes': 17611, 'speed_tx_bytes': 38524, 'speed_io_bytes': 56135, 'crc_errors': 0}, {'port_nr': 4, 'port_name': 'Port 3', 'traffic_rx_bytes': 0, 'traffic_tx_bytes': 0, 'speed_rx_bytes': 0, 'speed_tx_bytes': 0, 'speed_io_bytes': 0, 'crc_errors': 0}, {'port_nr': 5, 'port_name': 'Port 4', 'traffic_rx_bytes': 0, 'traffic_tx_bytes': 3234, 'speed_rx_bytes': 0, 'speed_tx_bytes': 3380, 'speed_io_bytes': 3380, 'crc_errors': 0}, {'port_nr': 6, 'port_name': 'Port 5', 'traffic_rx_bytes': 352, 'traffic_tx_bytes': 3298, 'speed_rx_bytes': 367, 'speed_tx_bytes': 3447, 'speed_io_bytes': 3814, 'crc_errors': 0}, {'port_nr': 7, 'port_name': 'Port 6', 'traffic_rx_bytes': 2223710, 'traffic_tx_bytes': 81190, 'speed_rx_bytes': 2324357, 'speed_tx_bytes': 84864, 'speed_io_bytes': 2409221, 'crc_errors': 0}, {'port_nr': 8, 'port_name': 'Port 7', 'traffic_rx_bytes': 0, 'traffic_tx_bytes': 0, 'speed_rx_bytes': 0, 'speed_tx_bytes': 0, 'speed_io_bytes': 0, 'crc_errors': 0}], 'sum_port_traffic_rx': 2293897, 'sum_port_traffic_tx': 2312363, 'sum_port_traffic_crc_err': 0, 'sum_port_speed_bps_rx': 2397719, 'sum_port_speed_bps_tx': 2417021, 'sum_port_speed_bps_io': 4814740}
With the latest version I get the following error "Platform error sensor.ckw_hass_gs108e - Integration 'lxml' not found."
I confirm the same error for me with the new tag. Seems related to the new manifest.json file.
I fixed that
In the log I can see "The ckw_hass_gs108e platform for the sensor integration does not support platform setup. Please remove it from your config". I think it is normal as the CKW GS108e Integration is now available with a UI setup.
However when I enter IP and password I get the following error: "Connection or login error: please check your configuration" (I verified both IP and password several times using a direct connection to the switch). I don't know how to get additional logs.
Which Firmware version? I'm using 2.00.05
And yes, setup via configuration.yaml
isn't supported any more.
I get the same error as @degrammont. The latest firmware version is 2.06.17 which is also the one I use. If it's possible you should upgrade to the latest since it covers security vulnerabilities. You can download the latest one here.
I figured it out with 2.06.17, passwords gets encrypted on the frontend before transmitted to the switch. For a quick fix, open your Browser Developer Console and look for login.cgi when entering the password and submitting the form. Use the generated password in the integration.
The encryption is done in http://192.168.178.8/login.js?v1.10
function encryptPwd(){
var password = document.getElementById("password").value;
var randNum = document.getElementById("rand").value;
var resultStr = merge(password,randNum);
document.getElementById("submitPwd").value = md5(resultStr);
}
Thanks for your help. Now with the encrypted password I can create the integration but all sensors give an "Unknown" status (except IP Address and Reponse Time).
Yes, i'm aware of that. The new firmware changed the structure of portStatistics.cgi too, I'm working on this
Reworked again , please test again. Thank you all for testing <3
Please remove the switches you added with the hashed/encrypted password and re-add them with the real password (see https://github.com/ckarrie/ckw-ha-gs108e/issues/6#issuecomment-1373418905)
Tested succesfully on the Raspberry Pi (using HA OS 2023.1.0) I'm using for test, but I got the following error with an HA docker container on my NAS (2022.12.1).
"Unable to prepare setup for platform ckw_hass_gs108e.sensor: Platform not found (cannot import name 'UnitOfDataRate' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)). and I can't see any entity.
Unfortunately it only works with Home Assistant 2023.1.0 at the moment, I can spent some time for backwards compatibility
I did a test with the latest version and it worked with 2023.1.1 for me.
I close this issue for now, thanks for all the tests.
Hello, Tested with 2 HA deploiement (one with an HA container in Docker, one on Raspberry Pi using HA OS with only this integration) with the same error. GS108Ev3 Firmware Version V2.06.16EN Here is the stack. Thanks for your help.