fsaris / home-assistant-awox

AwoX mesh light integration for Home Assistant
MIT License
84 stars 23 forks source link

Awox Smart Plug on Home Assistant #54

Closed Fyngah closed 1 year ago

Fyngah commented 2 years ago

Hi,

I have a SmartPLUG and would like to use it with Home Assistant. If you want we can try to integrate it together.

The first issue I have from the log of HA is the following:

2022-01-08 15:36:13 WARNING (MainThread) [custom_components.awox.config_flow] Skipped device, missing address - {'objectId': 'hidden', 'modelName': 'SMP-B16-FR', 'friendlyName': 'SmartPLUG', 'macAddress': 'hidden', 'uuid': 'hidden', 'room': 'Salon', 'displayName': 'SmartPLUG', 'owner': {'__type': 'Pointer', 'className': '_User', 'objectId': 'hidden'}, 'syncable': True, 'createdAt': '2017-01-22T09:26:48.164Z', 'updatedAt': '2022-01-08T10:54:37.972Z', 'address': '', 'typedRoom': {'__type': 'Pointer', 'className': 'Room', 'objectId': 'hidden'}, 'version': '1.0.7', 'vendor': 'Awox', 'type': '.ble.plug.switch.', 'provider': '', 'hardwareVersion': '', 'ACL': {'hidden': {'read': True, 'write': True}}}

I get an error when I try to add the HA integration. I guess it is because the SmartPLUG does not show an address as the lights.

So I removed the lines 159 to 161 and 179 from _configflow.py Now I have the AwoX Smart Connect Integration available with 1 equipment (AwoX mesh) and 3 entities. (sensor.awox_mesh, sensor.awox_mesh_last_connection, sensor.awox_mesh_last_rssi_check)

And this is where I'm stuck.

Let me know what you think about it entities Equipment integration

fsaris commented 2 years ago

It seems that you device doesn't have a mesh I'd/address. The 'address': '' is needed else the integration doesn't know how to reach your plug.

You only have a plug and no other Awox (Bluetooth) device. Maybe it only gets an mesh address when it's part of a Bluetooth mesh.

The integration (currently) only supports Bluetooth to connect/control awox devices

fsaris commented 2 years ago

What type of plug are you exactly using? I would have expected to see type': '.ble.tlmesh.wifi.bridge.plug.switch.powermeter. in the log. But looks that you have a different type then Eglo Connect Plug Plus.

fsaris commented 2 years ago

Ah, do you have the older non mesh type? https://github.com/sourceperl/smartplugctl

Fyngah commented 2 years ago

Thanks for the quick answer!

It seems that you device doesn't have a mesh I'd/address. The 'address': '' is needed else the integration doesn't know how to reach your plug.

You only have a plug and no other Awox (Bluetooth) device. Maybe it only gets an mesh address when it's part of a Bluetooth mesh.

The integration (currently) only supports Bluetooth to connect/control awox devices

Yes I only have the plug, no lights. Yes, the plug does not have an address, this is why I removed the lines 159 to 161 and 179 from config_flow.py so I can get the Integration. I also noticed that I have the following on the log:

2022-01-08 19:42:40 ERROR (MainThread) [homeassistant.components.switch] Error while setting up awox platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/awox/switch.py", line 49, in async_setup_entry
plug = AwoxPlug(mesh, device[CONF_MAC], device[CONF_MESH_ID], device[CONF_NAME],
KeyError: 'mesh_id'

So I added the following before line 40 on file switch.py : if CONF_MESH_ID not in device: device[CONF_MESH_ID] = None And now I get two equipments on the integration. I see the smartplug now but it only shows the switch. You made a pretty good job on this code!

Now I see the switch which is unavailable and I'm stuck with this error in the log: 2022-01-08 20:03:22 WARNING (AwoxMeshCommands-r6XDEwDs) [custom_components.awox.awox_mesh] Command failed, retry 3

What type of plug are you exactly using? I would have expected to see type': '.ble.tlmesh.wifi.bridge.plug.switch.powermeter. in the log. But looks that you have a different type then Eglo Connect Plug Plus.

I have the Awox SmartPLUG model: SMP-B16-FR

Ah, do you have the older non mesh type? https://github.com/sourceperl/smartplugctl

Not sure if it is the older non mesh type. But it looks exactly the same as your link. I used that link before to test it with a Raspberry Pi with success. That's why I want to add the plug to Home Assistant. two equipments two equipments2 two equipments3 two equipments4

fsaris commented 2 years ago

sorry, the non mesh communication is not supported by this integration.

SergioGomera commented 1 year ago

After some time my smart plug plus stop working as switch in home assistant, I don’t know in which version start the problems, but now only say don’t available. If you need logs or something tell me. Thx in advance.