pawlizio / my_velux

Custom component of velux integration for Home Assistant
32 stars 9 forks source link

[Feature Request] invert state & percentage of sunblind -> open/closed #24

Closed Puncher4444 closed 11 months ago

Puncher4444 commented 1 year ago

Hello,

thanks for that really good integration - works actually perfectly fine! Nevertheless, I´ve got an issue with the state of my sunblind. When the sun is shining and I need to pull out the sunblind on my terrace, the state is then "closed- 0%". When sun is gone, I´ll get the blind back into the case and state is "open - 100%". I know that this is actually located in Home Assistant itself (or at least in the understanding of the wording), but in the german language its seems to be a bit strange that the blind is "closed" and at 0% when the sun is shining.

Example:

Sun is shining - sunblind is out of its case: image

Sun is NOT shining - sunblind is in its case: image

I hope you get the point I was trying to make ;)

Is there a possibility to invert the state of a specific blind and invert the %-number as well!?

Thanks Daniel

pawlizio commented 1 year ago

Hi Daniel,

can you share what kind of node_type the actuator provides. You'll find those info in the logs if you activate debugging.

I would assume Markisen should be something like, but I want to be sure prior to modify the code. node_type="NodeTypeWithSubtype.HORIZONTAL_AWNING"

The config section you need to add to your configuration.yaml in order to activate debugging:

logger:
  default: warning
  logs:
    pyvlx: debug
    custom_components.velux: debug

Best regards, Paul

Puncher4444 commented 1 year ago

Hi Paul,

thanks for your feedback! Yes, you are right, the node_type is exactly what you assumed. The following informations I got in the log after initializing the integration:

2023-08-30 10:29:12.864 DEBUG (MainThread) [pyvlx] REC: <FrameGetAllNodesInformationNotification node_id="0" order="0" placement="0" name="Markise" velocity="Velocity.SILENT" node_type="NodeTypeWithSubtype.HORIZONTAL_AWNING" product_group="0" product_type="0" node_variation="NodeVariation.NOT_SET" power_mode="0" build_number="0" serial_number="None" state="UNKNOWN" current_position="UNKNOWN" target="UNKNOWN" current_position_fp1="UNKNOWN" current_position_fp2="UNKNOWN" current_position_fp3="UNKNOWN" current_position_fp4="UNKNOWN" remaining_time="0" time="2023-08-30 10:22:05" alias_array=""/>

Hope that helps!

Thanks Daniel

pawlizio commented 1 year ago

Hi Daniel,

ich kann über die Velux Integration nur steuern wie die Position der Markise sein soll, aber ich kann die Darstellungslogik in HA nicht ändern. HA gibt vor das Offen = 100% ist und Geschlossen = 0%. Ich kann über die Integration lediglich definieren, an welcher Position die Markiesen sein sollen im offenen und geschlossenen Zustand. Zur Verdeutlichung: (HA) Prozent = (HA) Status-Anzeige (Offen/Geschlossen) = (VELUX) Position der Markiese

Markise (aktuell) 100% = Offen = Markise voll eingefahren (kein Sonnenschutz) 0% = Geschlossen = Markise voll ausgefahren (voller Sonnenschutz)

Ich könnte diese Logik wie folgt invertieren:

Markise (invertiert) 100% = Offen = Markise voll ausgefahren (voller Sonnenschutz) 0% = Geschlossen = Markise voll eingefahren (kein Sonnenschutz)

Was aus der Integration heraus nicht geht ist die Anpassung der Darstellungslogik, also folgendes:

Markise 0% = Offen = Markise voll eingefahren (kein Sonnenschutz) 100% = Geschlossen = Markise voll ausgefahren (voller Sonnenschutz)

Gruß, Paul

pawlizio commented 1 year ago

https://github.com/home-assistant/frontend/blob/530208cb6ab3e794f726cae4e7af7a8b8dfe860c/src/data/cover.ts#L21-L33 that line are the ones you're looking for, the logic implementation when a blind is assumed fully opened or fully closed. This belongs to HA frontend, so even not in the HA core. Unfortunately it is hard coded in this area, no chance to invert. For some users it is quite strange to understand the logic, why a cover at 100% is fully open and not fully closed.