FreshlyBrewedCode / hacs-homee

a Home Assistant custom component to integrate the homee smart home platform
MIT License
18 stars 6 forks source link

Impulse type switches not discovered #23

Closed Taraman17 closed 1 year ago

Taraman17 commented 1 year ago

Type of problem

Version

2.0.2

Detailed description

I added my Homee (Hörmann Homee Cube). It has 2 devices:

These are in 1 Group ("Tore"). The group is sucessfully discovered, but if I add it, only the homee cube itself is discovered. On the first try, the Garage door was found, but after deleting and reinitialisizing, both devices are not discovered.

edit: The garage door is only found after the area is set for the homee base.

The Log does not show any errors.

Error log

2023-02-15 14:46:29.558 INFO (MainThread) [custom_components.homee.config_flow] got access token for homee
2023-02-15 14:46:29.559 INFO (MainThread) [custom_components.homee.config_flow] homee task created
2023-02-15 14:46:29.698 INFO (MainThread) [custom_components.homee.config_flow] homee connected
2023-02-15 14:46:29.699 INFO (MainThread) [custom_components.homee.config_flow] homee disconnecting
2023-02-15 14:46:29.722 INFO (MainThread) [custom_components.homee.config_flow] homee config successfully tested
2023-02-15 14:46:29.723 INFO (MainThread) [custom_components.homee.config_flow] created new homee entry with ID 00055112EACA
Taraman17 commented 1 year ago

With a line of log code added, I could confirm that the node is found, but not added in the UI:

2023-02-16 08:44:54.321 INFO (MainThread) [custom_components.homee.config_flow] got access token for homee
2023-02-16 08:44:54.322 INFO (MainThread) [custom_components.homee.config_flow] homee task created
2023-02-16 08:44:54.465 INFO (MainThread) [custom_components.homee.config_flow] homee connected
2023-02-16 08:44:54.465 INFO (MainThread) [custom_components.homee.config_flow] homee disconnecting
2023-02-16 08:44:54.501 INFO (MainThread) [custom_components.homee.config_flow] homee config successfully tested
2023-02-16 08:44:54.502 INFO (MainThread) [custom_components.homee.config_flow] created new homee entry with ID XXXXXXXXX
2023-02-16 08:44:57.963 INFO (MainThread) [custom_components.homee.helpers] node foundGaragentor
2023-02-16 08:44:57.963 INFO (MainThread) [custom_components.homee.helpers] node foundHoftor
2023-02-16 08:44:57.963 INFO (MainThread) [custom_components.homee.helpers] node foundGaragentor
2023-02-16 08:44:57.964 INFO (MainThread) [custom_components.homee.helpers] node foundHoftor
2023-02-16 08:44:57.964 INFO (MainThread) [custom_components.homee.helpers] node foundGaragentor
2023-02-16 08:44:57.964 INFO (MainThread) [custom_components.homee.helpers] node foundHoftor
2023-02-16 08:44:57.965 INFO (MainThread) [custom_components.homee.helpers] node foundGaragentor
2023-02-16 08:44:57.965 INFO (MainThread) [custom_components.homee.helpers] node foundHoftor
2023-02-16 08:44:57.965 INFO (MainThread) [custom_components.homee.helpers] node foundGaragentor
2023-02-16 08:44:57.966 INFO (MainThread) [custom_components.homee.helpers] node foundHoftor
2023-02-16 08:44:57.966 INFO (MainThread) [custom_components.homee.helpers] node foundGaragentor
2023-02-16 08:44:57.966 INFO (MainThread) [custom_components.homee.helpers] node foundHoftor
Taraman17 commented 1 year ago

Today I decided to have a closer look into the code and found the causes for my problem.

The yard gate is controlled by a radio-relay which is of type IMPULSE_RELAY (Protocol 43) which is not yet configured as switch. Also it does not have the Attribute Type ON_OFF (1), but WatchdogOnOff (385) 1.

At this point my efforts stalled, beacuse I could use some help setting up the Devcontainer. I have the ha-core running fine, but don't know how to properly integrate this component for development. So far I just copied the files manually into the HA devcontainer, but now I don't know where the pymee files reside, which need to be changed also.

If I could get some hints on this, I should be able to add proper support for my two devices.

Stklingner commented 1 year ago

@Taraman17 if you copy the repo files into vscode under custom_components/hacs-homee and then rebuild the container it should work IIRC

Stklingner commented 1 year ago

Let me know how you get on - there are a few things I'd like to have a look at (edit: when I get the time) and I can add this to the list

Taraman17 commented 1 year ago

@Taraman17 if you copy the repo files into vscode under custom_components/hacs-homee and then rebuild the container it should work IIRC

So that is copy the pymee files to a directory "vscode" in the custom_components/hacs-homee dir, or do you mean I copy them using vscode to the hacs-homee directory?

Stklingner commented 1 year ago

So that is copy the pymee files to a directory "vscode" in the custom_components/hacs-homee dir, or do you mean I copy them using vscode to the hacs-homee directory?

Sorry, half asleep today - copy the "homee" folder in "custom_components" from hacs-homee into a folder called "custom_components" in the core repository using vscode (you can just drag the folder from your explorer/finder into vscode's file list on the sidebar), then rebuild the container and it will install the dependencies.

Taraman17 commented 1 year ago

I got so far, but now I need to change files in the pymee library. How do I achieve that?

Stklingner commented 1 year ago

SW> I got so far, but now I need to change files in the pymee library.

How do I achieve that?

Nice job so far! So now we need to take a modified version of pymee that you’re going to be playing around with:

  1. Fork freshlybrewed’s pymee repo to your account
  2. open the terminal in your dev environment in vscode (down the bottom)
  3. Now you should be able to do pip uninstall pymee and then pip install git+https://"your repo"@"whichever branch you want"
  4. Modify your pymee code in another window, commit back to GitHub then reinstall as per 3 to try out (if in doubt, rebuild the container)
  5. Rinse and repeat

You used to be able to change the manifest requirement to a GitHub reference and use the “install all dependencies” command in the dev environment but this broke a while back…

Taraman17 commented 1 year ago

Great, thank you. Try that as soon as I have time.

Taraman17 commented 1 year ago

Ok, succeded in running the commands, but when I start Homeassistant in the DevContainer, pymee gets overwritten with the original version.

Edit: found it - HA has to be run with option "skip pip"

Taraman17 commented 1 year ago

First progress is made - I can discover the devices as switches and have the position sensor for the garage door. When I try to use the switches however I get errors.

Edit: I found out, that I looked for the wrong Switch-Attribute. That fixed, I still get the error:

2023-02-19 14:54:00.880 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall homee.set_value (c:01GSN2NRMX0B5EW5HSJCKA5HWS): node=3, attribute=22, value=1>
Traceback (most recent call last):
  File "/workspaces/ha-core/homeassistant/core.py", line 1749, in catch_exceptions
    await coro_or_task
  File "/workspaces/ha-core/homeassistant/core.py", line 1774, in _execute_service
    await self._hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/workspaces/ha-core/config/custom_components/homee/__init__.py", line 67, in handle_set_value
    hass.async_create_task(homee.set_value(node, attribute, value))
  File "/workspaces/ha-core/homeassistant/core.py", line 520, in async_create_task
    task = self.loop.create_task(target)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 438, in create_task
    task = tasks.Task(coro, loop=self, name=name)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 755, in call_soon
    self._check_thread()
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 792, in _check_thread
    raise RuntimeError(
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one
2023-02-19 14:54:00.882 ERROR (MainThread) [homeassistant] Error doing job: Task was destroyed but it is pending!:   File "/home/vscode/.vscode-server/extensions/ms-python.python-2023.2.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py", line 1118, in __call__
    ret = self.original_func(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 83, in _worker
    work_item.run()
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/workspaces/ha-core/config/custom_components/homee/__init__.py", line 67, in handle_set_value
    hass.async_create_task(homee.set_value(node, attribute, value))
  File "/workspaces/ha-core/homeassistant/core.py", line 520, in async_create_task
    task = self.loop.create_task(target)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 438, in create_task
    task = tasks.Task(coro, loop=self, name=name)
Taraman17 commented 1 year ago

Research showed that this might be related to the debugging environment, so today as the updated pymee lib was available I tested on my production HA and there it works. ;-)

Pr0mises commented 1 year ago

@Taraman17 are you also able to control your Garagentor with hass? I only get the current status (most of the time i need to update the device status in the homee app to have the current status in hass) and a position slider which does nothing.

Taraman17 commented 1 year ago

@Pr0mises after the update I get the Garagedoor as a switch and a sensor. Before there was the slider which did not work, since the opener only accepts impulses to start/stop and not position commands.

Yesterday on testing it worked well - this morning it doesn't. Need to find out why.

Pr0mises commented 1 year ago

@Taraman17 did you mean it reverted back to the slider? The update didn't do anything to my garagedoor. I'll try to purge homee from hass and connect it again if it changed for you

Taraman17 commented 1 year ago

I noticed that the slider is still present. I need to also change cover.py so that it does not reacts on impulse operators

Taraman17 commented 1 year ago

@Stklingner follow up question: Is there a way to get the logs from the pymee library out of the DevContainer? I saw it logs quite a lot of interesting stuff.

Stklingner commented 1 year ago

@Taraman17 As you've surmised, they should be somewhere in the container but I'm not sure where to begin - the structure is explorable via the vscode terminal so should be findable!

I only used python scripts when dealing with pymee; I find that there's so much going on in HA it's difficult to really see what it's doing...

Taraman17 commented 1 year ago

@Stklingner Thx, I figured out, that if I put logging to debug, I see it in the HA Logs via the UI.

serdar-22 commented 1 year ago

hello

since the update i have the issue, that only sometimes can open the garage door.

i have to click at least 5-6 times, that sometimes garage door will open. i dont found any errors in the log.

thank you very much for your support

serdar-22 commented 1 year ago

sorry after restart its ok 👍🏾

Pr0mises commented 1 year ago

v2.3 is working for me. Good job !

spainpiio commented 1 year ago

All of a sudden, all of my dimmer switches have disappeared and are shown as unavailable. The sensors of these dimmers, however, are available. They are Fibaro & Qubino dimmers that work directly in Homee. I have already deleted the integration and reinstalled, restarted.... Does anyone have any ideas?

Taraman17 commented 1 year ago

Can you set the logging to info and post the logs from HACS-homee?

spainpiio commented 1 year ago

Logger: homeassistant.components.light Source: custom_components/homee/light.py:42 Integration: Licht (documentation, issues) First occurred: 08:52:43 (1 occurrences) Last logged: 08:52:43

Error while setting up homee platform for light Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/homee/light.py", line 107, in async_setup_entry devices.append(HomeeLight(node, light_set, index, config_entry)) File "/config/custom_components/homee/light.py", line 153, in init self._supported_features = get_light_features(self) File "/config/custom_components/homee/light.py", line 42, in get_light_features features |= ColorMode.BRIGHTNESS # TypeError: unsupported operand type(s) for |=: 'int' and 'ColorMode'

and

Logger: homeassistant.helpers.service Source: helpers/service.py:645 First occurred: 08:52:44 (4 occurrences) Last logged: 09:42:59

Unable to find referenced entities light.pb_oficina_luz or it is/they are currently not available

Taraman17 commented 1 year ago

Thx, should be fixed

Taraman17 commented 1 year ago

Fixed with https://github.com/FreshlyBrewedCode/hacs-homee/pull/32