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

support for dali devices #182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

support for dali devices #182

wants to merge 1 commit into from

Conversation

jheling
Copy link
Owner

@jheling jheling commented Mar 29, 2024

Add extra function_id's

@cweyer
Copy link

cweyer commented Apr 4, 2024

First of all, a big thank you for great work here! It is really appreciated.

I downloaded and installed this branch via git as a custom component in my Home Assistant setup and ran it. Unfortunately the DALI controlled lights do not show up. I assume this is because lights are entities which are exposed by a device. For my regular lights those devices are named like Sensor/ Schaltaktor 8/8fach, REG and in turn expose the lights connected to them as entities. I was wondering if the same must be done with DALI? So the DALI controller is exposed in HA as a device which in turn exposes the lights as it's entities. Otherwise there would be no hierarchy path to the lights themselves? I hope this answer makes sense, I am pretty new to HA and haven't wrapped my head around all the concepts yet, but since all my other lights don't show up directly but through their device I was wondering if the same must be done with the DALI controller?

@jheling
Copy link
Owner Author

jheling commented Apr 5, 2024

Yes, the dali controller should appear as a device and the controlled lights (channels) should appear as entities.
I assume you don't see any errors in Settings/System/Logs?

Could you adjust the logging level in your configuration.yaml like this? :

logger:
  default: warning
  logs:
    custom_components.freeathome: info

This should show more information in the log about the available entities.

@cweyer
Copy link

cweyer commented Apr 5, 2024

Ah okay, since I didn't see any code related to that I assumed it was omitted.

Anyhow, this might be helpful (I renamed the integration freeathome-dev to be able to run the stable version and branch on the same system)

Looks like the return value for self.rgb_color is not an integer

2024-04-05 17:03:51.100 ERROR (MainThread) [homeassistant.components.light] Error while setting up freeathome-dev platform for light
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/freeathome-development/light.py", line 23, in async_setup_entry
async_add_devices([FreeAtHomeLight(device_object)])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/freeathome-development/light.py", line 63, in __init__
self._rgb_color = self.light_device.get_rgb_color()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/freeathome-development/fah/devices/fah_light.py", line 164, in get_rgb_color
blue = self.rgb_color & 255
~~~~~~~~~~~~~~~^~~~~
TypeError: unsupported operand type(s) for &: 'str' and 'int'
2024-04-05 17:03:56.439 DEBUG (MainThread) [custom_components.freeathome-development.fah.pfreeathome] received datapoint 807A7F04E8CD/ch0013/idp0007 = 0
2024-04-05 17:03:56.439 DEBUG (MainThread) [custom_components.freeathome-development.fah.pfreeathome] received datapoint 807A7F04E8CD/ch0013/idp000A = 65
2024-04-05 17:03:56.439 DEBUG (MainThread) [custom_components.freeathome-development.fah.pfreeathome] received datapoint 807A7F04E8CD/ch008B/idp0007 = 0
2024-04-05 17:03:56.440 DEBUG (MainThread) [custom_components.freeathome-development.fah.pfreeathome] received datapoint 807A7F04E8CD/ch008B/idp000A = 65
2024-04-05 17:03:56.440 DEBUG (MainThread) [custom_components.freeathome-development.fah.pfreeathome] received datapoint 807A7F04E8CD/ch00B9/idp0000 = 0
2024-04-05 17:03:56.440 DEBUG (MainThread) [custom_components.freeathome-development.fah.pfreeathome] received datapoint 807A7F04E8CD/ch00B9/odp0009 = 65
2024-04-05 17:03:56.440 DEBUG (MainThread) [custom_components.freeathome-development.fah.pfreeathome] FahThermostat Wohnzimmer: received datapoint 807A7F04E8CD/ch00B9/odp0009 = 65
2024-04-05 17:03:56.440 INFO (MainThread) [custom_components.freeathome-development.fah.devices.fah_thermostat] thermostat Wohnzimmer (807A7F04E8CD/ch00B9) dp odp0009 ecomode 65
2024-04-05 17:03:56.440 DEBUG (MainThread) [custom_components.freeathome-development.fah.pfreeathome] received datapoint 807A7F04E8CD/ch00B9/odp000A = 0

@cweyer
Copy link

cweyer commented Apr 5, 2024

Ok, so typecasting it to int worked, now it shows up. I can control on/off and brightness (with a bit strange feedback though), but not colour. The colour map is all black and selecting a colour brings up this error message:

Screenshot 2024-04-05 at 17 22 25
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2542, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2579, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 631, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/config/custom_components/freeathome-development/light.py", line 152, in async_turn_on
    self.rgb_color = kwargs[ATTR_RGB_COLOR]
    ^^^^^^^^^^^^^^
AttributeError: property 'rgb_color' of 'FreeAtHomeLight' object has no setter```

@jheling jheling force-pushed the jhe/dali branch 2 times, most recently from 9366ab3 to 346e0a0 Compare April 7, 2024 10:58
@jheling
Copy link
Owner Author

jheling commented Apr 7, 2024

Hello, I have made some changes to light.py. Hope it now works better.

@jheling
Copy link
Owner Author

jheling commented Apr 19, 2024

@cweyer, Did you have time to test it with the changes i made?

@cweyer
Copy link

cweyer commented Apr 20, 2024

@cweyer, Did you have time to test it with the changes i made?

Unfortunately I was pretty busy in the last couple of days, but I will be able to test it some time next week, sorry for the delay.

@cweyer
Copy link

cweyer commented May 12, 2024

Sorry for getting back just now, I had a lot of work the last couple of weeks.

So I applied your patches and there seems to be a wrongly named method, it's calling is_rgb_colour but there is only a is_rgb method. Also, since this patch, it only discovers one of my 4 DALI entities.

Screenshot 2024-05-12 at 20 53 28 (Sorry for the screenshot, the web UI terminal doesn't allow me to copy text)

@jheling
Copy link
Owner Author

jheling commented Sep 8, 2024

@cweyer . Can you try the latest changes? Another user has tested the white-tone adjustable lights and they seem to be working.

@cweyer
Copy link

cweyer commented Sep 8, 2024

Sure, will install the branch tomorrow evening

@cweyer
Copy link

cweyer commented Sep 9, 2024

I tried the latest commit from the jhe/dali branch, but it won't boot the integration:

Logger: homeassistant.config_entries
Source: config_entries.py:604
First occurred: 20:03:58 (2 occurrences)
Last logged: 20:10:53

Error setting up entry 192.168.2.160 for freeathome
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/__init__.py", line 84, in async_setup_entry
    await sysap.find_devices()
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 954, in find_devices
    await self.xmpp.find_devices(self._use_room_names, self._switch_as_x)
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 836, in find_devices
    await self.update_devices(config, initializing=True)
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 534, in update_devices
    monitoring_device.update_datapoint(datapoint_id, value.text)
  File "/config/custom_components/freeathome/fah/devices/fah_light.py", line 195, in update_datapoint
    self.color_temp = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '12.1569'

It could be a remnant from a previous attempt, so tomorrow I will fiddle around with the registry and delete all DALI entities and see if it boots up then. Unfortunately my configuration is rather complex and removing the add-on and reinstalling it is not an option, otherwise I would have to reassign 64 devices to different rooms again.

@jheling
Copy link
Owner Author

jheling commented Sep 10, 2024

Yes, this seems to be a white tone adjustable light and the value should be max one byte. I first thought it was a rgb value (3 bytes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants