That’s what I thought too. Would be surprising (well, actually nothing will surprise me again with Tuya ).
We could try uppercase, or maybe @juan11perez could provide a screenshot of the DPs drop down list while the curtain is being moved with the physical buttons.
@juan11perez, does the Stop button work, at least?
Almost Now it isnt unavilable but no matter what I set it always ends with set temperature to 5C.
Good day gents.
So i operated the curtain with the physical button, which is an rf remote as there’s no other buttons and the scroll bar where DP values are didnt change.
I also tested the stop command and it doesnt work either.
Ok I think we have to convert to integer the value to request. Will do it and I think we’re finished
Sorry maybe I didn’t explain myself enough. The drop down menu won’t change, you have to operate the curtain manually BEFORE you enter that config page, because the values are read just once when loading that page.
Anyway, the fact that the Stop button doesn’t work either seems to prove the uppercase hypothesis, @postlund I think we can introduce an autodetection for uppercase status, agree?
Once again thank you for your help. As mentioned earlier the position command works well and with this cover template i can control it.
sofia_curtains_template: # using localtuya
friendly_name: Sofia Curtains
value_template: "{{state_attr('cover.curtains_sofia','current_position')<=5}}"
# position_template: "{{state_attr('cover.curtains_sofia','current_position')}}"
open_cover:
service: cover.set_cover_position
data:
entity_id: cover.curtains_sofia
position: 1
close_cover:
service: cover.set_cover_position
data:
entity_id: cover.curtains_sofia
position: 100
stop_cover:
service: cover.stop_cover
entity_id: cover.sofia_curtains # this is from the hass tuya integration
icon_template: >-
{% if state_attr('cover.curtains_sofia','current_position')==100 %} mdi:window-closed
{% else %} mdi:window-open {% endif %}
unique_id: sofia_curtains_template
device_class: curtain
One shortcoming I have is that I cant use the slider in the template. I tried adding the position_template variable pulling the state from the “source” cover but it doesn’t work. it shows an inactive slider.
Sure, auto detection should be easy to do I guess.
@juan11perez can you please make the test I asked (entering the config flow page right after you used the manual command)? As an alternative, you can patch the code in cover.py by adding .upper()
to the open/close/stop commands like this:
self._device.set_dps(self._open_cmd.upper(), self._dps_id)
If it works, we have the fix ready to be released.
You should not need to create a cover template, everything should be working natively…
It is working rospogrigio!!!
You are the greatest programmer ever. Now i think its ready to GO, definitely with working mandatory features. Thank you for your work.
ok, removed the cover. pressed the remote and went to configflow. no change in the dp parameters. same as above picture.
modified cover.py per your instructions as below:
def open_cover(self, **kwargs):
"""Open the cover."""
_LOGGER.debug("Launching command %s to cover ", self._open_cmd)
self._device.set_dps(self._open_cmd.upper(), self._dps_id)
def close_cover(self, **kwargs):
"""Close cover."""
_LOGGER.debug("Launching command %s to cover ", self._close_cmd)
self._device.set_dps(self._close_cmd.upper(), self._dps_id)
def stop_cover(self, **kwargs):
"""Stop the cover."""
_LOGGER.debug("Launching command %s to cover ", COVER_STOP_CMD)
self._device.set_dps(COVER_STOP_CMD.upper(), self._dps_id)
stop button now works. but arrows still do nothing.
if use open_close the slider works and reports correctly. The arrows dont work
If I use on_offf the slider doesnt work. however, if I move it to say full close and then I press the close arrow the cover closes.
Ahahah I’m flattered but no, it took me 3 attempts to fix a trivial issue so no, I’m not that good (with python at least, I’m a C++ developer actually)… Postlund is the master here ok then I guess we’ll release this shortly.
Thank you for the feedback!
Haha, you are wlcome
I have more requirement¨s for future development
Right now the ON/OFF button can only turn thermostat OFF, I would appriciate if it can work as a toggle button, set in to ON from OFF state and conversely (to ID1, true, false).
Setting to heat mode from HA does nothing, it send payload to ID4: auto or heat, but my themostat supports only these mods:
“Program”
“Manual”
“Holiday”
So it could be:
HVAC_MODE_HEAT=“Manual”
HVAC_MODE_AUTO=“Program”
for preset:
AWAY=“Holiday”
What you wrote is really strange and makes little sense. The position commands have nothing to do with the arrow commands so there should be no connection. The Stop command works so the upper case plays a role but it’s not the only issue.
We have to understand the right commands for open/close I guess… Can you try to run the tuyadebug scripts, and report the output when the device is operated manually?
I also don’t understand the last part you wrote: how could it close further with the Off command if it was already fully closed?!?
Thank you. I’ll have a look at debut and revert.
what I meant was that using the on_off option the arrows do not work if i just press them.
If I first move the slider to the desired position (say open) and then press the open arrow, the cover movers to open position ( if it was closed).
Maybe you can try up/UP and down/DOWN as well? Just replace for instance self._open_cmd.upper()
with one of them and try to open the cover.
Hi @rospogrigio @postlund
I saw that we give you a lot to work in this period!
Can I do some tests to solve my previous problems?
I don’t know if you remember, I can’t integrate a SonOFF (ID not recognized) and the value of my bulbs should range from 0 to 1000 instead of 0 to 255.
Thanks in advance
I have not looked into that yet, been keeping busy with other things. But as soon there’s something to test we’ll let you know!
He already set all the commands to upper… I am starting to believe that this device has some peculiarity, or maybe it supports only Position commands. Tuyadebug is what will help us figure out things, @juan11perez you should report the output status in different situations, when operating it manually and/or via the Tuya app so we can understand which commands it is expecting to receive.