Superkikim / mh-maxsmart-hass

Power Strip and Smart Plug home assistant custom component for Revogi based devices
2 stars 1 forks source link

6-Port Revogi Strip is not identified correctly #3

Closed lmaertin closed 1 year ago

lmaertin commented 1 year ago

I have a 6-port Revogi Power Strip:

Details: 2023-08-11 19:03:07.083 INFO (MainThread) [custom_components.maxsmart.config_flow] Discovered devices without IP: [{'sn': 'SWW6010003003060', 'name': 'Revogi-Strip6326', 'pname': None, 'ip': '192.168.178.50', 'ver': '3.36'}]

As my revogi strip does not provide a "pname", the IF/ELSE for the #socket identification in function async def async_step_import() fails. I patched the function locally like this:

` pname = device.get("pname") name = device.get("name")

sw_version = device.get("ver")

        port_data = {}

        if "Revogi-Strip" in name:
            port_data = {
                "master": {"port_id": 0, "port_name": "0. Master"},
                "individual_ports": [
                    {"port_id": 1, "port_name": "1. Port"},
                    {"port_id": 2, "port_name": "2. Port"},
                    {"port_id": 3, "port_name": "3. Port"},
                    {"port_id": 4, "port_name": "4. Port"},
                    {"port_id": 5, "port_name": "5. Port"},
                    {"port_id": 6, "port_name": "6. Port"}
                ],
            }
        elif pname is None:
            port_data = {
                "master": {"port_id": 0, "port_name": "0. Master"},
                "individual_ports": [
                    {"port_id": 1, "port_name": "1. Port"}
                ],
            }
        else:
            port_data = {
                "master": {"port_id": 0, "port_name": "0. Master"},
                "individual_ports": [
                    {"port_id": i + 1, "port_name": f"{i + 1}. {port_name}"}
                    for i, port_name in enumerate(pname)
                ],
            }`

May you have a cleaner fix for this...

Superkikim commented 1 year ago

Indeed. 2023.7.0-beta1 doesn't work for cloud fw versions. Only for the local one. In switzerland, it's Maxsmart with FW version 1.30. I guess this would be FW 1.X for revogi.

Will publish suppor with generic names within the next hour as 2023.8.0-beta2