Page 1 of 1

blinds control with percentage: arduino's relays+espeasy

Posted: Saturday 22 September 2018 15:34
by megamarco83
hi i have:
1) 2ch arduino relay
1) nodemcu with espeasy
3) domoticz last revision on raspberry pi

now i want to connect my blind to domoticz. i have 2ch relay:
1ch to UP blinds and 1ch to DOWN the blinds

i punt on espeasy:
gpio12 relay ch n°1 idx=26 that i would like to go UP
gpio15 relay ch n°2 idx=23 that i would like to go DOWN

i create dummy swithc on domoticz, i select simple switch as dummy, then go to switch page in domoticz, click on modify in switch icon and i choose from the internal page of switch "venetian blinds EU"
now i have to enter: action for switch on and action for switch off, but now stars my problems:
1) how i can menage STOP ?
2) the command that i know are:

Code: Select all

http://192.168.0.151/control?cmd=GPIO,12,1 
that activate relay ch1 to go UP

Code: Select all

http://192.168.0.151/control?cmd=GPIO,12,0 
that disactivate relay ch1

Code: Select all

http://192.168.0.151/control?cmd=GPIO,15,1 
that activate relay ch2 to go DOWN

Code: Select all

http://192.168.0.151/control?cmd=GPIO,15,0 
that disactivate relay ch2


but i have only two space to write in domoticz:
firts space: action for switch on
second space: action for switch off
how i can manage?

if i put on activate: http://192.168.0.151/control?cmd=GPIO,12,1
and in disactivate: http://192.168.0.151/control?cmd=GPIO,15,1

if i pres open blinds, and after two seconds close blinds, i will have active relay ch1 and relay ch2 and i could fire the motor's blind !?!?

what's the correct way to have relay ch1 to go UP relay ch2 to go down, a stop function, and a way that prevent to have switch ON relay ch1 and relay ch2?
thanks

Re: blinds control with percentage: arduino's relays+espeasy

Posted: Tuesday 02 October 2018 10:39
by megamarco83
some updating on my progress
now i'm able with EspEasy (using rules) to:
- use wall switch: - short press UP -> relay UP switched on for 1sec
- short press DOWN -> relay DOWN switched on for 1sec
- long press UP (more than 4sec) -> relay UP switched on for 46sec
- long press DOWN (more than 4sec) -> relay DOWN switched on for 46sec
- domoticz blind switch recognize the status of my blind if use wall switch (UP/open or DOWN/close), but i do not recognize the position of the blind (percentage)
i have in mind something but i do not know how to implement:

now with domoticz i should track the amount of sec that are passed since i press the switch, and a script convert the seconds in a percentage.
for example, starting from all close -> i longress UP (relay start to UP with a time of 46sec) -> after 15sec i want to stop my blind i press DOWN shortpress on the wall switch and the blind stop in that position that i choose -> script in domoticz should have counting this 15sec passed and give to domoticz that result: (15sec / 46sec ) * 100= 36% and show on the blind with percentage open 36%

if i use a shortpress wall switch -> i will activate the relay for 1sec -> send to domoticz the value 1sec -> domoticz calcolate (1sec / 46 sec) * 100 = 2% open
if i use again a shorpress from wall swith -> domoticz activate the relay for 1sec -> domoticz calcolate (1sec / 46 sec) * 100 = 2% open + 2% of previous position = 4%open

how i can implement that?

Re: blinds control with percentage: arduino's relays+espeasy

Posted: Wednesday 17 October 2018 12:42
by DarkG
You need a mapping function and a timer to write the position into a user variable. For me it was to complicated.
I did something in Blocky with Selector ans User Variables. But of course I need only 3 Positions for my blinds. Open, close and half open.
And I have no Wall switch. But via ESPEasy and Rules you can send Commands for Selector to Domoticz.