W00D00 / home-assistant-elero

Elero Centero component
GNU General Public License v3.0
39 stars 10 forks source link

emulate set position and tilt by time driven down and up commands #35

Open bit72 opened 2 years ago

bit72 commented 2 years ago

Hello and big thanks to developer(s) of this component!

Since it is unfortunately not possible with elero transmitter stick to set position and tilt by HW (set_position, open_tilt, close_tilt, stop_tilt, set_tilt_position) would it maybe be possible to emulate this by time driven down and up commands? What i could experiece Elero MultiTel is doing so. There is just some time in 1-second steps for Intermediate position and some 0.1-second time for tilt position.

In case I explaned not detaild enough please let me know. Thanks in advance!

Schnabulation commented 2 years ago

It's funny - I was thinking about this some days ago aswell. That would be very nice but has some drawbacks: It would only work from the top end position or bottom end position. Otherwise the time would not be accurate. But that would still be worth it.

Maybe one could even code it so that if the roller is not in one of the end positions it would first go to the nearest end position and then move from there to the selected position. But don't forget: different roller lengths have different closing times.

bit72 commented 2 years ago

Works best from top and end position... you are right. But theoretically - if only homeassiant is controling the cover - the actual position could be hold internally in this elero component as well. Sure this would not be perfect but it should work good enough. I have seen this approach in ESPHome. There is a time-based-cover (https://esphome.io/components/cover/time_based.html) which worked good for me on my shelly-based covers.

For the beginning counting from top would be already great since even elero MultiTel cannot do more than that and at least I am somehow fine with this ;-)

Schnabulation commented 2 years ago

if only homeassiant is controling the cover - the actual position could be hold internally in this elero component as well

That's a neat idea - but I demand this to be optional Because I also have wall remotes for the covers. :-D

If it helps I had a nice conversation with Elero some time ago and learned that the newer motors don't need to have the end stop learned in. They just roll down until the relay of the motor falls off which in turn means that the cover is in its end position. If the relay does not fall of it rolls for 3 minutes.

u20p17 commented 2 years ago

Hi, i am using this custom component for my roller shutters with elero motors and at the moment I am only getting 0%, 100% and 50% when it is moving. If I understand correctly this is due to the fact that the elero api does not send the actual position.

If I understand this issue correctly you were talking about a new feature which measures the total time the roller shutter needs from 0% to 100% and then it could calculate an aprox. position depending on the time which it needed? This would be very nice and exactly what I am looking for! Would be nice to have such a featue in the future! :)

Thanks to all developers!

Schnabulation commented 2 years ago

If I understand correctly this is due to the fact that the elero api does not send the actual position

I think it's not the API that does not send the actual position - it's the motor itself that does not know the position. But yes, the idea would be that one could calibrate the runtime per shutter and then it would calculate the position based on the runtime. It would - however - only work from the top and the bottom position.

u20p17 commented 2 years ago

that would be a very nice feature :D

But why it would only work from top or bottom position? E.g.: The roller shutter is at 0%. Moving to 100% take the roller shutter 10s. Assuming the shutter moves always at constant speed it would take 2,5s for going to 25%. If I now stop the shutter and save the position (25%) and after a while want to go to 75% then I just have to drive another 5s in the same direction. So it should be possible to drive intermediate steps without always going to the top/lowest position. Of course after a reboot of HomeAssistant/custom component you have to go once to the top or lowest position again. Or do I overlook something?

Schnabulation commented 2 years ago

Or do I overlook something?

Yes. :) I have a non-smart wall remote which I use to control the shutter without Home Assistant. HA does not know the position if I adjust it using the remote.

u20p17 commented 2 years ago

Okay, didn't thought about that. I mainly use NodeRed and HomeAssistant to control my roller shutters... But I have a MultiTel2 remote control and did some tests now: If I press move downwards on the remote control the elero state in HomeAssistant also changes from 'top position stop' to 'moving down'. So it would also be possible to detect manual roller shutter movements (via the remote control) and therefore it should be possible to move from example 25% to 75% (you just would have to start the timer when the elero state changes...) without opening or closing it completely... maybe you have a different constellation at your home where this is not valid?

Schnabulation commented 2 years ago

state in HomeAssistant also changes from 'top position stop' to 'moving down'.

This is actually a really great idea - yes, I can replicate that on my side. This would actually work I guess.

However: I'm not the original creator of this integration and not really that good at coding so I think it's up to @W00D00 to help us here.

u20p17 commented 2 years ago

I saw that @dfigus also commited to this repository the last days - maybe he could also help us with this topic :)

W00D00 commented 1 year ago

Hi Guys,

unfortunately, the Elero system does not support the state info. So we cannot get any info about the real position of the shutters just what I have developed. Plus, the Elero Transmitter Stick is buggy. I would be happy that I can serve you with this feature however, as I see now it is not possible. The time-based solution would be not as accurate as you expected. So, I do now want to spend time on this. However, if you describe your idea better in written form to me, I can fork a dev branch where we can try out something without any risk of this working main branch. Hm, so...

Thanks, István

Schnabulation commented 1 year ago

Hi István

Thank you for taking over this project - really appreciate further development.

I am aware that Elero does not support the state info appart from "open", "closed" and "vent/tilt". However our idea is based on the constant movement speed of the motors. Meaning: it always takes the same time from fully open to fully closed and the other way around.

So knowing this we could calibrate each shutter by measuring the total time it needs to travel and then based on this, calculate the travel time for each shutter position.

Ex: the shutter needs 30 seconds from fully open to fully closed. If we now want to have the shutter go to 20% closed we move it 6 seconds (30 / 100 * 20). If the shutter is in an unknown state, we first move it to the very top and then move it down 6 seconds.

u20p17 commented 1 year ago

any news on this topic? would be nice if @W00D00 has some time for the dev branch which we could at least try and see if the idea with the 'position calculation' based on the constant movement speed of the motors is good enough or not. :)

W00D00 commented 4 months ago

Hi All,

unfortunately, I do not have time for this development. Next to this, as I know, we cannot know so much about the running time of the motors, because we do not know exactly when the command was sent out to the motor. After all, the HA system does not provide a callback to this. If someone knows something special, please share the knowledge and experience to verify the idea.

Thanks, István

u20p17 commented 3 months ago

Hi @W00D00 , I did a bit of research and found out that the knx integration does something similiar:

https://github.com/XKNX/xknx/blob/main/xknx/devices/travelcalculator.py

I think that we could use the 'elero state' as the trigger for the command send from HA, because when I send a command I immediately can see the state changing.

What do you think?