Giter Site home page Giter Site logo

Comments (19)

nagyrobi avatar nagyrobi commented on July 16, 2024
  • current_position: 0
  • position slider showing 0%
  • scripts called per logs: Open
  • actual state: curtain is fully opened

You have your scripts set up the other way around.
HA uses 100% for fully open state and 0% for fully closed state. So you have to set your scripts accordingly.

from home-assistant-custom-components-cover-rf-time-based.

jandusek avatar jandusek commented on July 16, 2024

Hmm, are you sure about that? Because then there'd be a disconnect in how the entity presents itself. When I swap the two scripts:

cover:
  - platform: cover_rf_time_based
    devices:
      study_curtains:
        name: Study curtains
        travelling_time_up: 11
        travelling_time_down: 11
        open_script_entity_id: script.curtain_study_close
        stop_script_entity_id: script.curtain_study_stop
        close_script_entity_id: script.curtain_study_open
        device_class: curtain

so that it is fully closed at 0% as you're suggesting, the reported state and button icons are now wrong.

The state reported by the entity at 0% is "open" (but the curtain is fully closed):
CleanShot 2022-08-08 at 17 50 54@2x

and vice versa, entity reports its "closed" for 100% (but the curtain is fully opened):
CleanShot 2022-08-08 at 17 53 04@2x

Plus, the two card buttons now do the opposite of what their respective icons indicate (the left one closes the curtain, the right one opens it):
CleanShot 2022-08-08 at 17 57 07@2x

Moreover, even if I swap the the two scripts as shown above, the position slider still invokes the opposite script (my original problem).

It sounds to me like the slider looks at the old position, the new position I moved it to, calculates what it needs to do, and then invokes the exact opposite script then it should (but for the right amount of time) to get to that point.

from home-assistant-custom-components-cover-rf-time-based.

nagyrobi avatar nagyrobi commented on July 16, 2024

I have 11 covers working perfectly here:
image
image

I think the RF commands or the Switch/Relays wiring for your curtains needs to be reversed.

from home-assistant-custom-components-cover-rf-time-based.

jandusek avatar jandusek commented on July 16, 2024

I see your point, but I can't imagine how this could be related to wiring, the scripts do exactly what the name implies (open script opens my curtains, close one closes them).

I did a bit of digging and it seems that curtains and shutters are treated differently:
CleanShot 2022-08-08 at 18 58 28@2x

CleanShot 2022-08-08 at 19 01 25@2x

Everything works perfectly for a curtain if I swap the two commands here:
https://github.com/nagyrobi/home-assistant-custom-components-cover-rf-time-based/blob/master/custom_components/cover_rf_time_based/cover.py#L331-L334
(i.e. line 332 = OPEN, line 334 = CLOSE)

So, it sounds like HA treats different types of devices differently in terms of what 0 vs 100 means in a somewhat confusing way.

from home-assistant-custom-components-cover-rf-time-based.

nagyrobi avatar nagyrobi commented on July 16, 2024

OK sorry I only use shutters. Don't know much about curtains and why does HA handle them differently.

from home-assistant-custom-components-cover-rf-time-based.

jandusek avatar jandusek commented on July 16, 2024

Curtain is a cover.

from home-assistant-custom-components-cover-rf-time-based.

jandusek avatar jandusek commented on July 16, 2024

Would it be possible to add some check into the code and swap the open/close logic inside set_position() if it's a curtain?

from home-assistant-custom-components-cover-rf-time-based.

nagyrobi avatar nagyrobi commented on July 16, 2024

Only curtain is affected?
I could add a list with the cover classes which need reversing of the logic.

from home-assistant-custom-components-cover-rf-time-based.

jandusek avatar jandusek commented on July 16, 2024

I'm only using curtains, so that's the only one I've tested. I think a simple test for this is changing a device_class of some device you already have configured to those from this list one by one, restart and see if at 0 position its reported as opened or closed.

Sorry, I'd test this myself, but having some unrelated HA issues after the last update that broke my restarts.

from home-assistant-custom-components-cover-rf-time-based.

nagyrobi avatar nagyrobi commented on July 16, 2024

I tried to look in HA code to see where the difference is but couldn't find it. If you could do the test for the list you mentioned (after you fix your HA), I'd implement something...

from home-assistant-custom-components-cover-rf-time-based.

nagyrobi avatar nagyrobi commented on July 16, 2024

Did you try the Show as functionality of HA?
Set up the cover as shutter (default, remove config line from yaml), restart HA and then using Lovelace set it to show as curtain (click the entity and then the cog icon top-right):
image
Result:
image

from home-assistant-custom-components-cover-rf-time-based.

jandusek avatar jandusek commented on July 16, 2024

Interesting. It does seem to work, but the Position now operates like with shutters (100% = open), which I'm starting to realize is probably why the HA folks decided to swap that for curtains. Position 100% being open is the opposite of what one would expect with a curtain by default.

Sorry, my bad, it still doesn't work - the exact same issue as originally, the Position is acting in the exact opposite way it should, only now the whole thing is a mirror image of what it used to be.

from home-assistant-custom-components-cover-rf-time-based.

nagyrobi avatar nagyrobi commented on July 16, 2024

There's a contradiction in your diagnosis.
If you set it to shutter, does it work as expected? Without your mod!

from home-assistant-custom-components-cover-rf-time-based.

rzulian avatar rzulian commented on July 16, 2024

I do have the same behaviour as @jandusek .
This is the starting point:
Screenshot 2022-08-10 at 13 33 58
Screenshot 2022-08-10 at 13 28 11

And this is the log when I'm moving the slider to the left, which should mean "open", but it's actually closing.

2022-08-10 13:34:28.516 DEBUG (MainThread) [custom_components.cover_rf_time_based.cover] Pergola Soggiorno Tenda Sud: async_set_cover_position: 72
2022-08-10 13:34:28.517 DEBUG (MainThread) [custom_components.cover_rf_time_based.cover] Pergola Soggiorno Tenda Sud: set_position
2022-08-10 13:34:28.517 DEBUG (MainThread) [custom_components.cover_rf_time_based.cover] Pergola Soggiorno Tenda Sud: set_position :: current_position: 100, new_position: 72
2022-08-10 13:34:28.517 DEBUG (MainThread) [custom_components.cover_rf_time_based.cover] Pergola Soggiorno Tenda Sud: start_auto_updater
2022-08-10 13:34:28.526 DEBUG (MainThread) [custom_components.cover_rf_time_based.cover] Pergola Soggiorno Tenda Sud: init _unsubscribe_auto_updater
2022-08-10 13:34:28.527 DEBUG (MainThread) [custom_components.cover_rf_time_based.cover] Pergola Soggiorno Tenda Sud: set_position :: command close_cover
2022-08-10 13:34:28.527 DEBUG (MainThread) [custom_components.cover_rf_time_based.cover] Pergola Soggiorno Tenda Sud: _async_handle_command :: DOWN
2022-08-10 13:34:28.970 DEBUG (MainThread) [custom_components.cover_rf_time_based.cover] Pergola Soggiorno Tenda Sud: auto_updater_hook
2022-08-10 13:34:28.989 INFO (MainThread) [homeassistant.components.camera] Setting up camera.generic
2022-08-10 13:34:29.050 INFO (MainThread) [homeassistant.components.script.pergola_soggiorno_tenda_sud_close] Pergola Soggiorno Tenda Sud Close: Running script sequence
2022-08-10 13:34:29.050 INFO (MainThread) [homeassistant.components.script.pergola_soggiorno_tenda_sud_close] Pergola Soggiorno Tenda Sud Close: Executing step call service

which is by design, line 331.

  if position < current_position:
            command = SERVICE_CLOSE_COVER
        elif position > current_position:
            command = SERVICE_OPEN_COVER

from home-assistant-custom-components-cover-rf-time-based.

nagyrobi avatar nagyrobi commented on July 16, 2024

I can't reproduce this, my covers work perfectly.
What kind of covers are yours? What's in the script?

from home-assistant-custom-components-cover-rf-time-based.

rzulian avatar rzulian commented on July 16, 2024

I'm not sure what's wrong. If I use

service: cover_rf_time_based.set_known_position
    data:
      entity_id: cover.pergola_cucina_tenda_est
      confident: true
      position: 0
      position_type: current

The entity is this
Screenshot 2022-08-11 at 18 42 10

Which is wrong, as the the position 0 should be closed
The UI is correct, accordingly to the state. You could only move up and the slider is to 0
Screenshot 2022-08-11 at 18 51 50

If you move the slider to the right, you close the blind correctly
Screenshot 2022-08-11 at 18 53 45

from home-assistant-custom-components-cover-rf-time-based.

nagyrobi avatar nagyrobi commented on July 16, 2024

Try updating to latest version. Maybe it's an issue related to a library version on your system?

from home-assistant-custom-components-cover-rf-time-based.

rzulian avatar rzulian commented on July 16, 2024

I've just update to the last version and it's showing the state correctly!

from home-assistant-custom-components-cover-rf-time-based.

nagyrobi avatar nagyrobi commented on July 16, 2024

Good news!

from home-assistant-custom-components-cover-rf-time-based.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.