Superkikim / mh-maxsmart-hass

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

maxSmart #1

Closed gruiny closed 1 year ago

gruiny commented 1 year ago

Hi Thanks for doing this i have MaxSmart Sockets. But unfortunately I have already made a FW update to 2.xx, according to my test the instructions work exactly the same as with FW 1.xx. So I can send via terminal the cmd commands analog to the instructions of altery. Unfortunately, I always get the following error message when trying to integrate my power strip with your plugin in HomeAssistant:

"Error The configuration flow could not be loaded: 500 Internal Server Error Server got itself in trouble"

can you help me to fix this? 😅

Superkikim commented 1 year ago

Hey. I certainly can help. If it works with 2.X, it would be great.

We can either organize a remote session (Zoom, kMeet, Google Meet ?) or you can share here the content of the log related to this issue.

Superkikim commented 1 year ago

@gruiny please get back to me :) I'd really be happy to make it work for v2 firmware as it would be useful for way more users than version 1.

I've added sensors for power consumption today.

Let me know your availability so we might work together on making it work.

gruiny commented 1 year ago

dear @Superkikim i think the problem is the integration MaxSmart posible here 🤔

i am not so good in coding 🙈

here are the log output: File "/config/custom_components/maxsmart/config_flow.py", line 23, in async_step_user devices = await self.hass.async_add_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/maxsmart/maxsmart.py", line 52, in discover_maxsmart MaxSmartDiscovery._validate_firmware_versions(maxsmart_devices) File "/usr/local/lib/python3.11/site-packages/maxsmart/maxsmart.py", line 61, in _validate_firmware_versions raise IncompatibleFirmwareError(f"Device with IP {device['ip']} has firmware version {firmware_version}. This module has been tested with MaxSmart devices with firmware version 1.30.") ^^^^^^^^^^^^^^^^^^^^^^^^^ NameError: name 'IncompatibleFirmwareError' is not defined

i hope this is help full 😅

otherwise of course its posible for me with a zoom meeting :D

Thanks for your help 👍

Superkikim commented 1 year ago

It definitely help. I have no issue because I have firmware 1.30. If you don't it should just raise a warning in the log, but this is a coding error, not due to firmware ^^

Let me give it an eye, and then you can update and test again.

BTW Where are you located ?

Superkikim commented 1 year ago

@gruiny I have fixed the error handling. It should work now. Can you please do the following:

  1. In the maxsmart folder, edit manifest.json and change maxsmart version from 0.1.7 to 0.1.8
  2. Restart home assistant
  3. Try to add the devices

If it doesn't work, would help if we can either spend sometime on a zoom or other tool together, or if you could lend me a version 2 device for some days and I would make it work if I can.

gruiny commented 1 year ago

@Superkikim Thanks for your helping Hand :) I have tried it according to your instructions. but unfortunately there still seems to be a problem. But there is already a small ray of hope in the sky, it gives me in the LOG file a correct IP address of the MH device.

I live in the Zurich agglomeration ;)

how it is easiest for you. I can borrow you a power strip and a plug for the tests, or we can look at it together in a zoom meeting.

I am flexible :D and very grateful if we can integrate this into Home Assistant :D

attached the current log file:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/maxsmart/maxsmart.py", line 52, in discover_maxsmart MaxSmartDiscovery._validate_firmware_versions(maxsmart_devices) File "/usr/local/lib/python3.11/site-packages/maxsmart/maxsmart.py", line 61, in _validate_firmware_versions raise ValueError(f"Device with IP {device['ip']} has firmware version {firmware_version}. This module has been tested with MaxSmart devices with firmware version 1.30.") ValueError: Device with IP xxx.xxx.xxx.xxx has firmware version 2.05. This module has been tested with MaxSmart devices with firmware version 1.30.

gruiny commented 1 year ago

but now he tells me the IP of MaxSmart an the FW Version ;) i think we are on the right way ;) 🥳

gruiny commented 1 year ago

or is it Posible to give them the Infos Manually? i have all needed Infos (IP and SN) ;)

bevor i have sent my comands with a http request like the methods of altery Like: GET http://<IP>/?cmd=200&json=%7B%22sn%22:%22SWP1234000000000%22,%22port%22:1,%22state%22:0%7D

Superkikim commented 1 year ago

or is it Posible to give them the Infos Manually? i have all needed Infos (IP and SN) ;)

bevor i have sent my comands with a http request like the methods of altery Like: GET http://<IP>/?cmd=200&json=%7B%22sn%22:%22SWP1234000000000%22,%22port%22:1,%22state%22:0%7D

We need first to fix the configflow. Normally (but I couldn't test), if the discovery fails, it should ask for IP address. Yet given the IP is correct in the log, it means discovery worked fine. So now the problem is just fixing the configflow :) Don't worry. We will.