a time gap between switching from “opening” to “closing”
the amount of “extra” time to make sure the system operates completely.
My window winders, take ~2 seconds from button press to actually start moving, so although in and out take 25 seconds, this is 25 seconds of movement, not including the startup time. Thus i have to run the relays for 27seconds to get a full open or close. Without the pulsetime2 moving for 2 seconds results in my windows not moving at all.
The system is simply using timing and maths to guesstimate the cover position.
So if the cover is at 100 and you ask for 24, it knows it has to move 76.
To move 76 it has to multiple pulsetimer1 * 76%, then add the pulsetime2, and then turn on the relay, wait that much time and then turn off the relay.
I maybe using 10th of a second calculations, but don’t have the code handy to check.
Since its only integer maths and truncated, the smaller the length of time, the less accuracy you will get (eg 25 seconds to open/close will only give you 25 values between 0 and 100, thus every 4 values in the 0-100 range will end up with the same result)
About HomeAssistant i use this code to command the cover. Do you have suggestion about?
Actually the issues are:
i loose the status of the cover at HA reboot until i open or close the cover
tilt position and position are not syncronized
i have this error in debug
2018-04-18 17:19:06 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on tele/sonoff02/LWT: b’Online’
2018-04-18 17:19:06 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to stat/sonoff02/RESULT
2018-04-18 17:24:25 WARNING (MainThread) [homeassistant.helpers.condition] Value cannot be processed as a number: –
2018-04-18 17:26:38 ERROR (MainThread) [homeassistant.components.cover.mqtt] UndefinedError: ‘value_json’ is undefined
2018-04-18 17:26:47 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on stat/sonoff02/RESULT: b’{“Cover1”:40}’
2018-04-18 17:29:28 WARNING (MainThread) [homeassistant.helpers.condition] Value cannot be processed as a number: –
2018-04-18 17:34:31 WARNING (MainThread) [homeassistant.helpers.condition] Value cannot be processed as a number: –
and someone suggest it, infact i’m able to have the correct cover position if i move the cover from HA or from Sonoff or manually… I don’t have the status (unknown) if i restart HA or if it loose connection with sonoff
When it works the received message is
2018-04-18 17:02:52 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on stat/sonoff02/RESULT: b’{“Cover1”:48}’
If you have an example how you configure your HA could be fine
Sorry, i dont understand your requirement.
The 0-100 is the percentage open.
On mine, i use the single button on the sonoff to cycle between open/stop/close/stop.
So you simply press the button on then press again to stop, or a couple of times to switch direction.
The positioning is updated, so all stays i sync.
Separate manual buttons via the sonoff could work, but the dual by default only has one button.
How did you do that? Im trying the same.
Everything works but if i use the hardware button in the wall it moves but Home Assistant dindnt get new position.
Hi,
testing with T1 (2 gang) shows this device is not fully supported yet (nobody had said that).
The T1 is a perfect device for covers: Has 2 relays like the Dual, and also has two buttons. Can be used as up and down. If mounted my 90°, it shows up and down in a nice manner.
@kabongsteve, you are a genius. I´ve been looking into automating my blinds for a year now, this is almost perfect.
Is there a way to use other GPIOs as wall switches? (I use a normal wall switch with all my sonoffs basic, shorting GND and GPIO14). I´m confident soldering stuff, but I lack the ability to code.
In theory, you can still use the standard Sonoff Tasmoto config for the extra GPIOs and set them as Buttons or Switches.
If you set an MQTT topic, then they simply send the topic and don’t act as direct buttons.
You can then use HA to activate cover via automation triggered from MQTT message.
If this doesn’t work, I think I could do some code changes, so that Switches without MQTT topics, could work in pairs, to open/close.
but this is assuming the switches are momentary action, and would start/stop the movement in the relevant direction.
Hi guys,
I’ve checked my code and the functions it uses and I can see no reason that it shouldn’t work, assuming the standard Tasmota firmware works as expected.
But looking at his comments on this device and the UK vs US versions, and how it works, this functionality may not work at all, as the template config for this device, doesn’t seem to match what the spiel about this device suggests.
Has anyone tried his standard firmware and go the relay switching to work from mqtt or web?
Hi @kabongsteve ! Thanks for your work, right now I have a Sonoff Dual with default Tasmota firmware with both GPIO01 and GPIO03 (Serial Out and In) connected to two wall switches (not momentary), one goes up and one goes down. I can control the cover using either Home assitant with MQTT cover or switching whe wall buttons.
Right now the home assistant cover is working correctly but I lack the option of knowing the cover open/close percentage.
Could your firmware work with these king of wall switches?