@javicalle If I add a cover with your code, then I get the following error:
Logger: homeassistant.setup
Source: setup.py:213
First occurred: 09:02:59 (1 occurrences)
Last logged: 09:02:59
Setup failed for knx: Unable to import component: cannot import name 'XknxConnectionState' from 'xknx.core' (/usr/local/lib/python3.10/site-packages/xknx/core/__init__.py)
@javicalle
I did the same changes which are described in the links above on my own (and also other like is_opening) and now it worked.
Probably you could update your files?
The problem comes if you have a RFLink integration and the Knx integration too.
My custom component fixed the xknx dependency version and that creates all the trouble. I have removed the pinned version from the requirements and added it like a dependency (without a version).
Please don’t do that. Copy that one travelcalculator.py module you need for your thing (maybe attach xknx’ licence on top) and ship it with your custom component. You really only need that 160 lines of its 16k lines of knx code (and neither do you need its dependency tree).
It will save some headache for you and the xknx developers.
Hi @farmio,
I want to apologize for any problem that my ignorance may have caused you. Nothing further from my will.
I followed your advice and included the travelcalculator module inside my custom_component.
I’m not sure how ‘attach xknx’ license on top’ would be appropriate. I’ve created a travelcalculator.readme file, but feel free to tell me the best way to include your credit in my component.
Don’t worry, I had no troubles with that. There has been a similar custom_component - and I was quite surprised to find the reason for the knx integration not working for users of it back then. I’m just trying to prevent this from happening again.
For the licence thing, I’m no expert, but I’d just copy it on top as module docstring.
"""
license
"""
from __future__ import annotations
from enum import Enum
import time
class TravelCalculator:
I have a Somfy RTS electric awning at which i’m not able to program the my-Position. Dont know why but also i dont need it.
So if i press the my-Position Button, the Somfy RTS just stops and dont goes further.
Is it possible to disable the my-Position e.g. by yaml-configuration?
If i just delete the rts_my_position doesnt works.
Hi, not sure what do you mean.
If you don’t configure the rts_my_position the stop button in HA should behave just as stop button. Isn’t that in your instalation?
If you want to alter the behavior of the physical remote it is not possible.
If i delete rts_my_position in my config, the cover wont work anymore in Homeassistant.
Leaving empty like
rts_my_position: []
or
rts_my_position:
doesn’t work also.
The problem is when i press on the physical remote the my-button while the cover is not moving, the rflink integration sets the state curent_position in HomeAssistant to the rts_my_position’ from the config, which is wrong
edit:
I reached my goals by editing the cover.py
From
def _handle_my_button(self):
"""Handle the MY button press"""
self._require_stop_cover = False
if self.tc.is_traveling():
_LOGGER.debug('_handle_my_button :: button stops cover')
self.tc.stop()
self.stop_auto_updater()
elif self._rts_my_position is not None:
_LOGGER.debug('_handle_my_button :: button sends to MY')
self.tc.start_travel(self.shift_position(self._rts_my_position))
self.start_auto_updater()
to
def _handle_my_button(self):
"""Handle the MY button press"""
self._require_stop_cover = False
if self.tc.is_traveling():
_LOGGER.debug('_handle_my_button :: button stops cover')
self.tc.stop()
self.stop_auto_updater()
elif self._rts_my_position is not None:
_LOGGER.debug('_handle_my_button :: button sends to MY')
self.tc.stop()
self.stop_auto_updater()
and comment out the my_position attribute
@property
def device_state_attributes(self):
"""Return the device state attributes."""
attr = {}
super_attr = super().device_state_attributes
if super_attr is not None:
attr.update(super_attr)
# if self._rts_my_position is not None:
# attr[CONF_MY_POSITION] = self._rts_my_position
if self._travel_time_down is not None:
attr[CONF_TRAVELLING_TIME_DOWN] = self._travel_time_down
if self._travel_time_up is not None:
attr[CONF_TRAVELLING_TIME_UP] = self._travel_time_up
return attr
So let’s fix the issue and then see if something else must fixed.
Can you check if there are any errors in the HA start when you remove the attribute? Or when you press any button (with the attribute removed)?
Yes of course we can.
When i comment out rts_my_position the logs say:
Nr 1.:
Logger: homeassistant.components.cover
Source: custom_components/rts_rflink/cover.py:110
Integration: Abdeckung (documentation, issues)
First occurred: 22:54:01 (1 occurrences)
Last logged: 22:54:01
Error while setting up rts_rflink platform for cover
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/rts_rflink/cover.py", line 124, in async_setup_platform
async_add_entities(devices_from_config(config))
File "/config/custom_components/rts_rflink/cover.py", line 110, in devices_from_config
rts_my_position = config.pop(CONF_MY_POSITION)
KeyError: 'rts_my_position'
Nr. 2:
2023-04-01 22:54:00.681 INFO (MainThread) [homeassistant.components.rflink] Initiating Rflink connection
2023-04-01 22:54:00.684 INFO (MainThread) [homeassistant.components.rflink] Connected to Rflink
2023-04-01 22:54:01.355 ERROR (MainThread) [homeassistant.components.cover] Error while setting up rts_rflink platform for cover
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/rts_rflink/cover.py", line 124, in async_setup_platform
async_add_entities(devices_from_config(config))
File "/config/custom_components/rts_rflink/cover.py", line 110, in devices_from_config
rts_my_position = config.pop(CONF_MY_POSITION)
KeyError: 'rts_my_position'
Hello @javicalle,
i have this error msg when trying to add the repo through HACS. <Integration javicalle/custom_components> Repository structure for master is not compliant
Is that normal ?
Thanks
The custom component is not prepared for HACS. I tried it at some time ago but ran into trouble at some point and gave it up.
You can add in HACS this other repository that contains the same version, but as you will see it does not have any details nor is it documented: