Code Monkey home page Code Monkey logo

Comments (23)

samoswall avatar samoswall commented on September 24, 2024 1

Hi!
Finally, I understand you! :)) (Maybe it's a language barrier)
It is possible to set the offset from above - this is min_position.
You want to make an offset from the bottom.
When the curtain goes down by 85% (15% remains open), you need to display 100% closed on the card (the value of open is 0%).
I understand correctly that: the value of the current_position attribute of the cover entity changes from from 100 to 15 for your case?

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024 1

I will add a bottom offset setting, but I need time to check how it will affect other functions.

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024 1

Added support in version v.1.2.2

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024

Microsoft Edge Версия 124.0.2478.80 (Официальная сборка) (64-разрядная версия)
FireFox Browser 125.0.3 (64-разрядный)
Yandex Browser Версия 24.4.2.887 (64-bit)
Chrome Version 124.0.6367.119 (Official Build) (64-bit)

Everything works in these browsers!
Home Assistant:
Core 2024.5.1
Supervisor 2024.04.4
Operating System 12.2
Пользовательский интерфейс 20240501.0

from pic-shutter-card.

aigle1234 avatar aigle1234 commented on September 24, 2024

Ok let's see
Thank you for your very fast feeback !

In addition, would you think it could be possible to add an offset parameter to match the real position of the cover ?

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024

offset parameter - Which?

from pic-shutter-card.

aigle1234 avatar aigle1234 commented on September 24, 2024

When I set the cover entity to 50% for example in home assistant, my expectation would be that the cover goes down half way. However when setting a cover to 50% its more like 80% closed because once the shutter touches the ground the motor continues running until all the slits are closed completely.
With the offset, that 50% in the app is actually half way down the window and not 50% through the runtime of the motor powering the blinds.

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024

Decrease the value shutter_max_position int (px)
shutter_min_position + shutter_max_position = 131 px (default) = 100% height (height in pixels)

from pic-shutter-card.

aigle1234 avatar aigle1234 commented on September 24, 2024

It's working for middle-low position but the issue is now when it's full opened, the picture window is not full opened:
That's why I'm thinking about an "offset".

image

image

type: custom:pic-shutter-card
entities:
  - entity: cover.volet_musique
    shutter_animation: show
    shutter_max_position: 107
    shutter_min_position: 24

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024

Скриншот 05 05 24_20 00 09

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024

Скриншот 05 05 24_20 04 50

from pic-shutter-card.

aigle1234 avatar aigle1234 commented on September 24, 2024

Unfortunately, I don't see how to play with shutter_max_position / shutter_min_position / shutter_top and solve this issue (the shutter touches the ground the motor continues running until all the slits are closed completely).

The goal will be to have an new parameter "offset" (int) to change the behavior:
current behavior : % (picture position) <-> % (cover.entity position)
target behavior : % (picture position) <-> % (cover.entity position + offset)

Here is the logic for the Offset and picture update calcul:
-if % (cover.entity) < offset <-> % (picture position) = 0
-if % (cover.entity) >= offset <-> % (picture position) = % ( (cover.entity) - offset) * (100 / (100 - offset)))

Example:
Offset 15
% (picture position) 0 <-> % (cover.entity) 0
% (picture position) 0 <-> % (cover.entity) 5
% (picture position) 0 <-> % (cover.entity) 10
% (picture position) 0 <-> % (cover.entity) 15
% (picture position) ((25 - 15) * (100 / (100 - 15)) = 11,8 <-> % (cover.entity) 25
% (picture position) ((100 - 15) * (100 / (100 - 15)) = 100 <-> % (cover.entity) 100

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024

There is a shutter_min_position for this.
Reduce it by 15

from pic-shutter-card.

aigle1234 avatar aigle1234 commented on September 24, 2024

There is a shutter_min_position for this. Reduce it by 15

If I use shutter_min_position, I will find this min position on the picture when the cover is fully opened, the goal is to have the picture also fully opened.

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024

If the value of the current_position attribute of the cover entity changes from 0 to 100, then the position of the curtain image is displayed from shutter_min_position to shutter_max_position.
Negative values can be used for shutter_min_position and shutter_top.

from pic-shutter-card.

aigle1234 avatar aigle1234 commented on September 24, 2024

Ok thank you for all these feebdack
which value would you use as shutter_min_position shutter_max_position shutter_top in case of offset of 15 to test please ?

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024

Try clearing the browser cache
Code

type: custom:pic-shutter-card
entities:
- entity: cover.roll_1

equal to

type: custom:pic-shutter-card
entities:
- entity: cover.roll_1
  shutter_min_position: 4
  shutter_max_position: 127
  shutter_top: 17

for this image
Скриншот 05 05 24_22 47 27

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024

decreasing the shutter_top will raise the curtain up by the desired pixel value
shutter_min_position - creates the appearance of a curtain, for beauty, it can be made equal to 1
in other cases, when the curtain cannot be fully raised up, this value is increased

from pic-shutter-card.

aigle1234 avatar aigle1234 commented on September 24, 2024

I agree, but how can I change the settings for the picture takes into account my offset ?
For example: I need that 65% of my cover equals to the picture on the right which represents the real position of my cover ?
image
For me the algorithm of the picture should be for offset of 15 for example:
(picture position) 0% <-> (cover.entity) 0%
(picture position) 0% <-> (cover.entity) 5%
(picture position) 0% <-> (cover.entity) 10%
(picture position) 0% <-> (cover.entity) 15%
(picture position) ((25 - 15) * (100 / (100 - 15)) = 11,8% <-> (cover.entity) 25%
etc....
% (picture position) ((100 - 15) * (100 / (100 - 15)) = 100% <-> (cover.entity) 100

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024

I don't understand your problem.
You have everything displayed correctly!
Скриншот 06 05 24_01 29 12
If you have an inverse percentage display, then use

invert_percentage: true

from pic-shutter-card.

samoswall avatar samoswall commented on September 24, 2024

Скриншот 06 05 24_01 42 00

from pic-shutter-card.

aigle1234 avatar aigle1234 commented on September 24, 2024

Hello,
Sorry pictures were not cleared enough, and maybe my explanations too.
I have just found another guy who had the exactly same issue and has developped a fix to add the offset feature.
Here are links:
Offset Explanation
Fix code

I have quickly tested to inject on your current js file and it seems to work.

The only remains feature to be perfect will be to find a workaround to fix 'set the shutter to real 0% when
when we have reached the remaining offset':

image

from pic-shutter-card.

aigle1234 avatar aigle1234 commented on September 24, 2024

Hello,

When the curtain goes down by 85% (15% remains open)

-> Yes, curtain is on the ground but has not still finished (15% left)

you need to display 100% closed on the card

-> Yes, we can consider the card 100% closed

With the fix code link:
=> card is OK
=> if we slide down to the bottom of the card, 100% closed is displayed on the card but there is still 15% missing on the curtain to be fully closed.
image
image

from pic-shutter-card.

Related Issues (2)

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.