Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orvibo Smart Sockets Config YAML No Longer Working #106923

Closed
emericklaw opened this issue Jan 3, 2024 · 4 comments · Fixed by #107162
Closed

Orvibo Smart Sockets Config YAML No Longer Working #106923

emericklaw opened this issue Jan 3, 2024 · 4 comments · Fixed by #107162

Comments

@emericklaw
Copy link
Contributor

The problem

I have lost access to my Orvibo smart sockets since the 28th December which was also the day I installed the first beta of 2024.1.0b5

The error in the logs (full log included further down):

    ba = bytearray(self._mac)
         ^^^^^^^^^^^^^^^^^^^^
TypeError: string argument without an encoding

I tried to change the format of the YAML, adding quotes around the MAC address, changing the file encoding from UTF8 but nothing has made a difference.

The latest beta 2024.1.0b5 still has this issue.

What version of Home Assistant Core has the issue?

core-2024.1.0b5

What was the last working version of Home Assistant Core?

core-2022.12.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Orvibo

Link to integration documentation on our website

https://www.home-assistant.io/integrations/orvibo/

Diagnostics information

No response

Example YAML snippet

switch:
  - platform: orvibo
    discovery: false
    switches:
      - host: 10.10.11.101
        mac: AC:CF:23:83:3C:FC
        name: "Conservatory Fairy Lights"

Anything in the logs that might be useful for us?

2024-01-02 23:40:16.419 ERROR (MainThread) [homeassistant.components.switch] Error while setting up orvibo platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/orvibo/switch.py", line 67, in setup_platform
    S20Switch(data.get(CONF_NAME), S20(host, mac=data.get(CONF_MAC)))
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/orvibo/s20.py", line 143, in __init__
    ba = bytearray(self._mac)
         ^^^^^^^^^^^^^^^^^^^^
TypeError: string argument without an encoding

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Jan 3, 2024

@nozza87
Copy link

nozza87 commented Jan 4, 2024

The problem seems to be with the underlying orvibo/s20.py not forcing encoding on the new data types that the HA update has added.
I don't understand how to get this fixed properly (updating s20.py) but below is a working patch :)


Either copy attached files to:
/root/homeassistant/custom_components/orvibo/
Orvibo Fix.zip


Or to manually apply the patch yourself:
Copy all 3 files (__init__.py, manifest.json, switch.py) from here:
https://github.com/home-assistant/core/tree/dev/homeassistant/components/orvibo
to:
/root/homeassistant/custom_components/orvibo/

Modify manifest.json to include a version ("version": "1.0.0") as this is now a requirement:

{
  "domain": "orvibo",
  "name": "Orvibo",
  "codeowners": [],
  "documentation": "https://www.home-assistant.io/integrations/orvibo",
  "iot_class": "local_push",
  "loggers": ["orvibo"],
  "requirements": ["orvibo==1.1.1"],
  "version": "1.0.0"
}

Modify switch.py to force a string type for the MAC Address:
Replace line 67:
S20Switch(data.get(CONF_NAME), S20(host, mac=data.get(CONF_MAC)))
with:
S20Switch(data.get(CONF_NAME), S20(host, mac=data.get(CONF_MAC).encode('utf-8').decode('utf-8')))


Hopefully someone can fix this properly for us?

@joostlek
Copy link
Member

joostlek commented Jan 4, 2024

The issue is that the mac isn't a string anymore and this check is failing.

https://github.com/happyleavesaoc/python-orvibo/blob/master/orvibo/s20.py#L139-L142

@joostlek
Copy link
Member

joostlek commented Jan 4, 2024

emericklaw added a commit to emericklaw/home-assistant-core that referenced this issue Jan 4, 2024
@emericklaw emericklaw mentioned this issue Jan 4, 2024
20 tasks
joostlek pushed a commit that referenced this issue Jan 4, 2024
* Bump python-orvibo version

Fixes #106923

* Add version number

* Remove version

* Bump python-orvibo version
frenck pushed a commit that referenced this issue Jan 5, 2024
* Bump python-orvibo version

Fixes #106923

* Add version number

* Remove version

* Bump python-orvibo version
@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants