Superkikim / mh-maxsmart-hass

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

Not able to Add Integration #6

Closed noreithe closed 11 months ago

noreithe commented 1 year ago

Hi, I am using latest HAOS and not able to add Integration after installing those 4 files into filesystem generation error

Config flow could not be loaded: {"message":"Invalid handler specified"}

Logger: homeassistant.config_entries Source: config_entries.py:864 First occurred: 9:21:09 PM (1 occurrences) Last logged: 9:21:09 PM Error occurred loading flow for integration maxsmart: No module named 'custom_components.maxsmart.const'

I did tried to upload a file const.py as well. It did started to look promissing showin Please wait, starting configuration wizard for Max Hauri Maxsmart

but ended up Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble

This error originated from a custom integration.

Logger: aiohttp.server Source: custom_components/maxsmart/config_flow.py:14 Integration: Max Hauri Maxsmart (documentation, issues) First occurred: 9:30:31 PM (1 occurrences) Last logged: 9:30:31 PM

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin return await func(self, request, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 147, in post return await super().post(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post result = await self._flow_mgr.async_init( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/config_entries.py", line 846, in async_init flow, result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/config_entries.py", line 874, in _async_init result = await self._async_handle_step(flow, flow.init_step, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 394, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/maxsmart/config_flow.py", line 45, in async_step_user await self.hass.config_entries.flow.async_init( File "/usr/src/homeassistant/homeassistant/config_entries.py", line 846, in async_init flow, result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/config_entries.py", line 874, in _async_init result = await self._async_handle_step(flow, flow.init_step, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 394, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/maxsmart/config_flow.py", line 64, in async_step_import num_of_ports = await async_get_number_of_ports(self.hass, ip_address) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/maxsmart/config_flow.py", line 14, in async_get_number_of_ports state = await hass.async_add_executor_job(device.check_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 128, in check_state response = self._send_command(511) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/maxsmart/maxsmart.py", line 86, in _send_command raise Exception("Failed to send command to power strip after multiple retries") Exception: Failed to send command to power strip after multiple retries

Thanks for help.

Superkikim commented 1 year ago

What is the version of the integration you installed and how did you install it ?

noreithe commented 1 year ago

What is the version of the integration you installed and how did you install it ?

I did downloaded Zip of the master branch and used a guide:

Navigate to the config directory of your Home Assistant installation.
If you don't have a custom_components directory inside the config directory, create it.
Inside the custom_components directory, create another directory named maxsmart.
Download the four files from this repository (__init__.py, manifest.json, config_flow.py, switch.py) and place them inside the maxsmart directory.

after restart of HA I did tried to add integration from HA settings - Integrations and got those errors

Superkikim commented 1 year ago

Seems you used an old guide. Please point me to it so I can change it if I made it.

Your best bet to install the integration nowadays is to use HACS.

In HACS, on top right, click on Integrations, and on the top right, click the three dots menu button and select "Custom repositories". Add this repository, and then enable "Show beta versions".

Latest beta release is 2023.8.0-beta3

noreithe commented 1 year ago

Seems you used an old guide. Please point me to it so I can change it if I made it.

Your best bet to install the integration nowadays is to use HACS.

In HACS, on top right, click on Integrations, and on the top right, click the three dots menu button and select "Custom repositories". Add this repository, and then enable "Show beta versions".

Latest beta release is 2023.8.0-beta3

Originally I did followed your Installation part on gitgub

Now I did tried Installing as you did wrote me - after adding repository in HACS, downloading mentioned beta everything was ok. When I am trying to add Integration from HA - Settings - Integration and I do still end up with error:

500 Internal Server Error Server got itself in trouble

Logger: aiohttp.server Source: custom_components/maxsmart/config_flow.py:14 Integration: Max Hauri Maxsmart (documentation, issues) First occurred: 00:17:41 (1 occurrences) Last logged: 00:17:41

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin return await func(self, request, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 147, in post return await super().post(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post result = await self._flow_mgr.async_init( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/config_entries.py", line 846, in async_init flow, result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/config_entries.py", line 874, in _async_init result = await self._async_handle_step(flow, flow.init_step, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 394, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/maxsmart/config_flow.py", line 45, in async_step_user await self.hass.config_entries.flow.async_init( File "/usr/src/homeassistant/homeassistant/config_entries.py", line 846, in async_init flow, result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/config_entries.py", line 874, in _async_init result = await self._async_handle_step(flow, flow.init_step, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 394, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/maxsmart/config_flow.py", line 64, in async_step_import num_of_ports = await async_get_number_of_ports(self.hass, ip_address) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/maxsmart/config_flow.py", line 14, in async_get_number_of_ports state = await hass.async_add_executor_job(device.check_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 128, in check_state response = self._send_command(511) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/maxsmart/maxsmart.py", line 86, in _send_command raise Exception("Failed to send command to power strip after multiple retries") Exception: Failed to send command to power strip after multiple retries

Superkikim commented 12 months ago

Have you success with the http command ? If you send directly an HTTP command with command 511 to your device, do you get an answer ?

Also, if you search the log for maxsmart, you should find the discovery details. Can you check ?

i.e.

http://<device_ip>/?cmd=511

You should get something like:

{"response":511,"code":200,"data":{"watt":["82.22","0.00","0.00","0.00","0.00","0.00"],"amp":["37.5","14.3","0.2","0.2","0.2","0.2"],"switch":[1,1,0,0,0,0]}} Also please share more details about your devices: Brand, type, firmware level (strip ? plug ?)

noreithe commented 12 months ago

Have you success with the http command ? If you send directly an HTTP command with command 511 to your device, do you get an answer ?

Also, if you search the log for maxsmart, you should find the discovery details. Can you check ?

i.e.

http://<device_ip>/?cmd=511

You should get something like:

{"response":511,"code":200,"data":{"watt":["82.22","0.00","0.00","0.00","0.00","0.00"],"amp":["37.5","14.3","0.2","0.2","0.2","0.2"],"switch":[1,1,0,0,0,0]}} Also please share more details about your devices: Brand, type, firmware level (strip ? plug ?)

I seems to get no answer on http command. I am trying to remember if I did tried it in past. I think I were able to get info from http command but currently getting info from this power plug (should be Revogi Smart Power Plug SOW018 firmware 5.07) with UDP command on ESP8266 though. Can it be UDP only?

Superkikim commented 11 months ago

Well, please give a look to the maxsmart module documentation: https://github.com/superkikim/maxsmart

Unfortunately, your devices are too recent, and are not in the scope of my development.