-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
is_open / is_closed not correctly reported if position is inverted #257
Comments
Thanks for pointing this out. def is_open(self):
"""Return if cover is open."""
return self.travelcalculator.is_open() ^ self.invert_position and same for is_closed in cover.py and leave travelcalculator as is (so we don't have to mess with movement directions and keep the calculator simple). Edit: Doesn't the travel calculator receive its position information in the same way regardless of inverted True or False? I would think position_range_from = 0 if invert_position else 100
position_range_to = 100 if invert_position else 0
self.position = RemoteValueScaling(
xknx,
group_address_position,
group_address_position_state,
device_name=self.name,
after_update_cb=self.after_update,
range_from=position_range_from,
range_to=position_range_to) should normalize its input. |
I tested it in my home assistant environment. The xknx cover device reports the correct percent value. So it reports 0 if the cover is fully open, 100 if it is fully closed and 20 if it is closed only a small part. So yes, the value is correctly scaled and calculated. Also the slider in the UI works correct to set a new position. But the TravelCalculator doesn't know about the inverted open/close values. It receives only the travel times. In the init method it is hardcoded to position_closed = 0. So it reports is_closed = true for the value 0. Although it is inverted in my environment. So I guess your first suggestion would be the simplest one? |
🤔 shouln't 0=open and 100%=closed be standard in KNX? |
Hmm, I don't know. I only have Jung actuators for blinds. Oh and I have an MDT actuator for my marquee and there it is the same, 100% is closed. |
@SoftXperience could you test this branch: https://github.com/farmio/xknx/tree/cover-fix-is-open |
Hmm... I'm new to the python ecosystem... I have a development environment for homeassistant, bit I believe xknx is not included, isn't it? So is there an easy way to integrate your branch in my test environment? Is it easily explained? Otherwise I have to google around a bit to get it working... |
Yes. See https://xknx.io/home_assistant Note that you will have to replace "knx" with "xknx" as platform in HA-configuration. |
Ok, I tested your branch. I still have to use the "invert_position=true" option?! If I do, fully open is reported as position 0 and open. Fully closed is reported as 100 and close. All positions inbetween are reported as open (which I think is correct). But now the buttons in the lovelace UI are still wrong. The up-button is closing the cover and vice versa. |
Yes. Unfortunately HA defines it contrary to knx so invert_position is still needed. Can you post your configuration? |
I just pulled and now the buttons have the correct direction (down-arrow closes, up-arrow opens). Sorry, didn't notice that you made further commits meanwhile. But still one problem: in closed state, only the down-arrow is enabled (and vice versa). Yes, 0 in ETS and openhab.
|
Ok. could you try this commit without invert_position: farmio@e48c3af |
The buttons (enable/disable) react correct. But now the position is inverted again. Fully open is correctly reported as "open", but the position is reported as 100 (which leads to the confusing slider). Before the position was correctly shown as 0. |
With |
Still same config with inverted = true |
Good. With invert set to false it should work correct now. |
No, I'm sorry. With inverted=false, fully open blind is in HA:
With inverted = true, fully open blind is in HA:
So still messed up... Still think the base version with just inverted close/open states may work correctly? Another question: I'm not sure if we really need the TravelCalculator... at least my two blinds actuators (Jung, MDT) have group addresses to set the new position and the acuator calculates and controls the travel times. So maybe we just need to write to the position group address (at least if it is set?) and ignore the calculator... |
Not all actuators support position states and we gain finer (calculated) states from actors that only send state when the target position is reached. Position 100 in HA is meant to be fully open. |
Hmmm, this is strange... How can I think a cover with 100% does cover nothing? For me this is not logical. Are you sure that it is meant this way? Is it documented somewhere? So maybe I have to retest your changes because I didn't thought that way. And I'm not sure how to go on, now because I don't like it that way and maybe have my own fork with that fixed. Which would be annoying in docker environment where my productive system will run... |
Be sure to check out the fork again. I made some more commits since. I don't know if it is defined in the documentation, but in the code. I have already linked it here: #257 (comment) I'd stay on normal HA and xknx builds to get updates. If you don't like the slider direction you can always customize a Lovelace card where it is reversed. |
Oh sorry, I didn't see the link. Ok, feels still very strange. I used fhem and (currently) openHAB before and none of them use it that way. Customizing the card is a good idea, but I guess I also have to invert all my scripts and automations. I'll try to test it again this evening. Your latest changes as well as the current implementation in HA, maybe everything works as intended (although I don't like it)... |
So with your current branch, the inverted=false mode looks very similiar. But also with wrong (in my opinion) position. But before we further test the implementation, I think we have to clarify what intended behaviour is... |
Description of problem:
The cover device directs the is_open and is_closed methods to the TravelCalculator. The problem is, that the TravelCalculator doesn't know about inverted position. So, is_open returns false if the position is 0. But with inverted position 0 is open.
I'm not sure where to fix it... should we change the TravelCalculator to correctly report open/closed? Or should we change the cover device which could check itself if current_position == open_position (which is correctly stored in the device).
Please give an advice and I could submit a PR
Version information:
KNX installation:
Using a cover actuator from Jung.
Problem-relevant
xknx.yaml
orconfiguration.yaml
entries (fill out even if it seems unimportant):name: bath
move_long_address: '8/2/1'
move_short_address: '8/1/1'
position_address: '8/3/1'
position_state_address: '8/4/1'
invert_position: true
Traceback (if applicable):
The text was updated successfully, but these errors were encountered: