Open JorgeMaTeixeira-zz opened 4 years ago
@JorgeMaTeixeira I don't have a cover devices, so I can't verify it, but I tried fixing it.
You can either apply the following changes or replace it with https://github.com/ollo69/ha_tuya_custom and deploy and validate my repository https://github.com/nao-pon/ha_tuya_custom with HACS ..
Please let us know the result.
I will try.. I'm a newbie in this, but i will read and try to do it.
Should I copy the files to the custom component or there will be a update at repository?
Later today I will take some time to merge last PR and so you just will need to update version from HACS. Please be patient, I'm a little bit busy in my job on this days...
@ollo69 It's fine when you have time. I will proceed with the verification :-)
@JorgeMaTeixeira Overwrite the modified file under custom_components/tuya_custom/tuyaha/devices and restart HA.
I´ve replaced base.py and cover.py (ha reboot) and the problem with cover is still present.
Please try update to last release (v0.0.3), should be fixed
Updated.. I'm testing and I will report later. But it seams fine.
It's not working fine, it takes a lot of time to update de status. There's anything I can do or provide to help?
The "always open" problem is solved, but theres is a huge delay in HA status for cover switches.
Pls explain better what delay is related and expeted behaviour. I don't have a cover so is not clear to me how status transition should be.
It seams that is with the same delay as switches before custom tuya.. I open and takes a lot of time to shouw oppening, and the same for closing.
Can you enumerate the possible expected state for cover device and when they should be? Eg:
Open -> The cover is open Opening -> The cover is opening Closing -> .... ... etc.
Thx
There's no state Open or Close, only oppening (during the time the relay opening is on) and closing (during the time the relay close is on).
The switch as no way to know if the cover is open or close, only know if it's opening or closing, when no relay is on, should stay unknow.
This is really different from what I see on the code (also for original integration). In the past opening and closing was showed to you? What is the lovelace control that you are using to control your cover?
Oppening and closing yes, was showing but not open or close. Maybe I'm not explaining well..
The switch as three buttons, open, close and stop You see oppening when oppening button is pressed and the oppening relay is energised, you see closing when closing button is pressed and the close relay is energised, and when you press stop the state is unknown (not oppening and not closing).
And the states report are fine, just with huge delay. Ex. I press open and takes several seconds or more than 1 minute to show oppening.. And the same for closing operation.
Ok, it is clear, but let me explain my concern: looking at the code, seems that the HA part is only using the attribute "is_open" that should reflect the final state "open" or closed" and not the state "opening" and closing", so probably the mapping in HA component is not correct. I think that this should be fixed populating the right attribute, but to be sure about this I would like to see the code of your lovelace card used to control your cover. Can you post it here?
Maybe i´m wrong i don´t know, i´m really a newby with HA. My explanation is from what i see in the UI.
This is when the cover is stopped, not doing nothing. (none of the relays are on)
This is when i press open button, and HA is taking a delay to reflect the state. (the open relay on the switch is on).
This is when HA reflects the oppen command i gave.
Cover Lovelace card (nothing really fancy, just the entity id. "entities:
And to be clear, all cover commands are working perfect, the only thing is the delay between the command and HA reflects the new state. The original problem, the one that let me create this issue is gone after the custom tuya update in hacs.
Open button pressed - Oppening Stop button pressed - no state (unknow) Close button pressed - Closing
What about SmartLive App? You have the same information? What is the physical device model that you use to control your cover?
Can you check with last release (v0.0.4). I changed a little bit the logic in HA integration.
For me I'm about to change from HA Tuya to the custom tuya but this thread concerns me. I had to use custom covers with template icons so that an open blind shows open and a closed blind shows closed icon. The unknown state breaks it always showing closed so I got rid of it using is_open state as per HA docs. If the custom tuya gives always up down controls but can show open/closed icons it would be perfect. Icon is selected based on previous state before unknown state due to is_open.
I understood that Tuya devices cannot provide the info that cover is closed, but you are stated different. Can you clarify the possible state that you expect to be managed? Cover entity in HA can be:
I need to remap each state base on information provided by Tuya, so please provide me this information to fix the component. Eventualy, if you are able, enable the component debug log adding this rows in configuration.yaml:
logger:
default: info
logs:
custom_components.tuya_custom: debug
Than operate for some times the cover and attach here log file so that I can see provided states.
Thx
@stjones-dev but how your cover switch know if the cover is open or close? Just by the last command? Becausse there's no any limit switch or other way to know.
@ollo69 my cover switchs in smart life tuya only say if is oppening or closing or nothing (when is stopped). The cover switch normally only have two relays, on for open and one for closing, the stop button only turn off both relays.
I'm testing latest version, it seams that have delay.. I send a close command and HA take a wile to show its closing. But I can live with this :p
Its because of is_open state ignoring unknown state so it's based on previous state.
Although icons revert to closed during unknown state the active colour is retained so I know more or less if covers are open or not.
Best I could do with no feedback. Using timers seemed likely to get out of sink with SmartLife but haven't tried it TBH.
None - this state should be when none of other operations is on.. Its the same in smart life.
Opening - this should be when open command is on (open relay is on)
Closing - when closing command is on (closing the relay is on)
Close - this only can be used by guessing, because the cover wall switch i have (and all I know about) don't have way to know.
Open - same above.
There are some switchs with more electronic that use current and time to calculate the position, they have some way of learning the time it takes to full open or full close by measuring the current passing on the relay and they can calculate, but mine don't do that, they just open or close, nothing more.
@ollo69 the log is in the home-assistant.log file at config folder?
The only problem I have now is the delay, the rest is fine.
Just released a new version where I try yo "deduct" is_closed state, please try it.
@ollo69 the log is in the home-assistant.log file at config folder?
Yes, it is. You have to reboot HA after changing configuration.yams
The only problem I have now is the delay, the rest is fine.
But you still have delay problem with last release? is_opening and is_closing should reflect immediatly.
@ollo69 with the latest is always opening..
The last one was faster, but with some delay I think..
I need to get back home to send you the file, I'm doing everything with my phone, but i can't download the log file.
See this screen recorder. https://photos.app.goo.gl/eYnKCjMYLJtJ88yc9
That video is with 0.0.5,because 0.0.6 is always opening regardless the command.
Ok, I wait for your log because probably I'm not properly mapping the states...
I can report that after changing to custom tuya switch states are reported much quicker for almost all switches. One of my covers has a name starting with 2, all others start with 1. The 2 has a different state to those with 1. When I get home I can provide better info as I only have my phone.
Ok, I wait for your log because probably I'm not properly mapping the states...
If I well understand status change in log:
1 = opening 2 = closing 3 = stopped
Please try again with version 0.0.7 and let me know
With 007 is always opening.
When I press close or stop is super fast to update the new state, but after the stop command is showing always opening.
Yes, try again (v0.0.8) :)
Now it seams perfect.. Thank you.
That's fine. Now Open or Closed status should be keeped, but keep in mind that in case you control your cover from phone app (eg start moving and than stopping in the middle) the component can detect wrong opened or closed state. As alternative solution I can remove this part of code used to determinate the state and leave only states opening and closing, that basically is as was original component. Please let me know prererred solution.
For me now all is perfect. Just one question. Why does HA give a window icon to covers? I have to create custom covers just to use the window-shutter icon.
Not a big deal really I suppose. I also see now the opening and closing states so can modify the custom covers to include those.
Great work and much appreciated.
For me now all is perfect. Just one question. Why does HA give a window icon to covers? I have to create custom covers just to use the window-shutter icon.
Default icon used is related to HA core and not to the componenet.
I don´t see open or close state, can you show me the log book for cover ?
How can i see open and close ?? If a send a open command i shoud see opening or opened ? Now i´m confused.
That's strange, I see open, opening, closing and closed states in my custom cover templates but in the original covers I see only opening, closing and unknown. So i recommend making custom covers like this:
- platform: template
covers:
office_blind2:
device_class: shutter
optimistic: true
friendly_name: "Office Blind"
open_cover:
service: cover.open_cover
data:
entity_id: cover.20770531bcddc2608c33
close_cover:
service: cover.close_cover
data:
entity_id: cover.20770531bcddc2608c33
stop_cover:
service: cover.stop_cover
data:
entity_id: cover.20770531bcddc2608c33
icon_template: >-
{% if is_state('cover.20770531bcddc2608c33', 'open') %}
mdi:window-shutter-open
{% elif is_state('cover.20770531bcddc2608c33', 'opening') %}
mdi:arrow-up-bold-box
{% elif is_state('cover.20770531bcddc2608c33', 'closing') %}
mdi:arrow-down-bold-box
{% else %}
mdi:window-shutter
{% endif %}
Strangely my logbook only shows open and closed even though I get opening and closing states which I use in lovelace.
July 5, 2020 2:55:37 PM Office Blind changed to open 2:12:50 PM Office Blind changed to closed 2:12:43 PM Office Blind changed to open 2:12:27 PM Office Blind changed to closed 2:12:21 PM Office Blind changed to open 2:12:19 PM Office Blind changed to closed 2:12:15 PM Office Blind changed to open 2:12:07 PM Office Blind changed to closed
Logbook not always show all event. Look at History
Same thing, the original only has opening, closing and unknown and the custom template has only open and closed. But for me the visual lovelace of the custom template has also opening and closing states so I'm very happy.
@stjones-dev the custom template should be in the configuration file? I shoud make a custom template for each cover?
Yes in the config file. Start a covers: section as in the above create all the custom covers and then after restart you can replace in lovelace. Each new cover should have the entity_id of the original cover its replacing.
I still have a delay of upto 10 seconds or so between clicking on the HA gui and the switch switching. However, status update is pretty much instant when it switches. Covers are instant weirdly. Just light switches that have the delay.
I´m using custom component installed using hacs, and is working much better now, no delay when using HA.. The only issue i found is with cover switches, HA is always reporting that covers are oppening, when they aren´t oppening.
Maybe this happen because of the undefined state of the cover switch. When the covers are stopped, the switch should stay in undefined state, that way i can open or close. Right now they keep forcing the open state, that way if i want to open, i need to use the stop command first and only then i can use the open command. Other thing is that closing state is not showing up, i can close, but the state is not showed in HA.