New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split Interlock mode of 4 channel in 2 groups #824
Comments
As promised, find here the solution. you need to replace 2 procedures in the SONOFF tab and to activate it you add a new variable in user_config_override.h. Uncomment it, if you do not need it and the original code is active: In user_config_overide.h add the following: In sonoff, replace the procedure setRelay with below code: if (4 == sysCfg.poweronstate) { // All on and stay on In sonoff also replace the procedure do_cmnd_power with my below code uint8_t publishPower = 1; #ifdef Sonoff4CH_Interlock_SPLIT 0 // split your channels into 2 groups, each group allows one active channel only // find out if channel 1/2 or 3/4 are to be changed |
Another solution: |
Unfortunately the backlog solution does not work for the buttons and the webpage. And a long-press would not work like this either. In such a scenario I would prefer to solve it with MQTT as you would get a confirmation for each task. Of course it would be even cooler, if there would be a possibility to run small scripts on the SONOFF like on esayesp 2.0.
I want to avoid to explain to my wife, why she can not turn on the light, because an update on a mqtt server or openhab went wrong .... haha BTW.... there is a bug in the codes, which can cause that a power cut leads to a permament on relay, if you want to work with MQTT. |
Your enhancement makes absolute sense because not only shutter requires this behaviour. My irrigation pumps also need 2 relays to open and close and should never be ON both. I solved this with the pulsetimer, but as you already mentioned this is just a workaround. I do not need a configuration what relays belong to the group. This can be hardwired. E.g. Relay 1 and 3 one group and 2 and 4 the other. In the GPIO definition, you just add two new definitions RelaysGroup1 and RelaysGroup2 and assign them to both GPIO. The rest should be easy to implement. In this case, you don't break the original functions. I will check if I can implement this in my fork of TASMOTA. |
This would be even better! I will check your fork, as currently I need to apply the changes to each upgrade manually :) I like your Idea with 2 new GPIO definitions. Unfortunately I am not yet enough in the Tasmota code nor Arduino programming, to test your proposal. |
@lobocobra Could you help me out with a solution for this case? I think it will be similar to what you did. |
Never mind, did it. Solution is dirty, but working great. If anyone is interested let me know. |
I modified the patch to the 5.12 version: void SetDevicePower(power_t rpower) if (POWER_ALL_ALWAYS_ON == Settings.poweronstate) { // All on and stay on #ifdef Sonoff4CH_Interlock_SPLIT 0 // split your channels into 2 groups, each group allows one active channel only if (Settings.flag.interlock) { // Allow only one or no relay set if ((SONOFF_DUAL == Settings.module) || (CH4 == Settings.module)) { void ExecuteCommandPower(byte device, byte state) uint8_t publish_power = 1; #ifdef Sonoff4CH_Interlock_SPLIT 0 // split your channels into 2 groups, each group allows one active channel only // find out if channel 1/2 or 3/4 are to be changed
#ifdef USE_DOMOTICZ |
very good, I'm using a sonoff 4ch to control 2 roller shutters, and i need a interlocking mode working with group of two channels. |
you need to edit the SONOFF file and replace the SetDevicePower(power_t rpower) and ExecuteCommandPower(byte device, byte state) code for the suggested above methods. |
No need to ad this? In user_config_overide.h add the following: |
Yes its needed.
…________________________________
De: B1G1 <notifications@github.com>
Enviado: 26 de março de 2018 15:51
Para: arendst/Sonoff-Tasmota
Cc: diasarmando; Mention
Assunto: Re: [arendst/Sonoff-Tasmota] CH4 // Split Interlock mode of 4 channel in 2 groups (#824)
No need to ad this?
In user_config_overide.h add the following:
#define Sonoff4CH_Interlock_SPLIT 0
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#824 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/APaCCYO4fuFI6G2OkmPWZksWZwzd3Fk2ks5tiQB6gaJpZM4PLCO->.
|
Ok, can i update it from the administration page or i have to flash directly throug the serial? |
You need to build and upload (serial or OTA) the firmware with the code modifications.
…________________________________
De: B1G1 <notifications@github.com>
Enviado: 27 de março de 2018 16:56
Para: arendst/Sonoff-Tasmota
Cc: diasarmando; Mention
Assunto: Re: [arendst/Sonoff-Tasmota] CH4 // Split Interlock mode of 4 channel in 2 groups (#824)
Ok, can i update it from the administration page or i have to flash directly throug the serial?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#824 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/APaCCUs94_7nKVL54Ac4w6cLuhTQ3A0Qks5timESgaJpZM4PLCO->.
|
Hi, when i try to upload the compiled bin I get this error Upload buffer miscompare I read in other threads that the problem is a bad configuration of flash option, either 512 flash or no or to much spiffs, but in my Arduino ide is 1M (no SPIFFS) and it should be correct. What's the problem? |
Did you try this? Assuming that you double checked your settings with the wiki.... load a minimal version first, and then your patched one... |
Yes! It worked! |
@lobocobra
Regarding your problems for flashing, I experimented that with CH4 R2 and Dual R2 (both are ESP8285) you don't have to enter Programming Mode like other ESP8266 but keep GPIO0 at Gnd during flashing. |
As I had some requests to update the function see here the working update for version 6.00a. To implement the mod you need to download version 6.0.0a and to replace 2 functions completely with the code below and add one statement: In user_config_overide.h add the following:
In sonoff, replace the procedure SetDevicePower with below code:
In sonoff replace ExecuteCommandPower with:
Btw... I disabled all sensors that I do not need an knx and similar. So the bin has a size of 484k. @diasarmando, thanks for adapting it to v5.12. |
about your questions....
|
I make a proposal how to support the shutter usecase, without changing adding to much code to it. The functionality is already added to my branch. See stefanbode mod. Idea: Main change below in the interlock. PulseTime still works and set the corresponding relay after period
|
@lobocobra |
Yes, I was already thinking about this. The problem is not doing it, the problem is doing it in a smart way without adding to much code. Therefore using something that already exist is a good idea. A three state switch is nothing already be there. Just preventing two relays on is also something that you currently can simulate quite nice with the pulsetime, as long as you do not decide to switch during this period like my wife did. As far as I cann see the problem of the interlock is that you need to remember the old state to decide to switch off wich relay if in a request both are ON. If we solve this on the UI and the API that’s fine , too. I’m intrested to get this solved because I have some valves and a shutter to operate. |
Let me propose a simple solution. All,working in the group. If both relay OFF, all fine do nothing. If relay 1 or 2 ON also finen do nothing. If relay 1 and 2 are ON always switch OFF the second relay. Therefore you prevent mess but you cannot just move in the opposite direction by switching relay 2 to ON. You have to switch relay 1 OFF upfront manually or by a pulsetimer. If ok i can give it a try in my code and share results |
ok, done and checked in into my branch. Changes are small and smart. Here is how I did it. Honestly, easy way is just use my branch :-). In sonoff.ino
Additionally the wiping of all relays must be more conditional: change SetDevicePower For the nerds; What am I doing in the procedure? |
Hey stefanbode I like your idea to change as little code as possible, but your solution is almost obsolet if you use an CH4pro, as each switch can be connected with 2 cables, where one is always switched on. For me this is no solution and I will extend my mod with the aim:
If we want to have this mod added to arendst master, we would probably to have it programmed as a module. If not arendst will for sure not consider it (at least I would not in his place). |
Perfect you are the best, I will try it tomorrow.
Am 12. Aug. 2018, 16:49, um 16:49, lobocobra <notifications@github.com> schrieb:
…Here we are:
[sonoff.ino.bin.zip](https://github.com/arendst/Sonoff-Tasmota/files/2281033/sonoff.ino.bin.zip)
Now MQTT will report for which device you request the current status.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#824 (comment)
|
For those who are interested, I made now a new version that can deal with SPRINKLER or devices where you would like to know how much time there were on and how much this costs in Euro/Dollar. Example: I want to know how much water I use with my sprinkler and how much this costs. |
Cross-posting from #3709 The two and two grouping is one scenario. Logically one would group 1&2 and 3&4. But, for unforeseen reasons, one might select the channels in each group differently. I wouldn't, but someone might (say in a retrofit where they now want to take advantage of this new firmware feature but they had already wired something differently. Just surmising). One might want only one group and then the remaining channels ungrouped. The real reason this occured to me was a group of three scenario. I have this scenario for my ceiling fans. Three channels are used to control the speed of the fan. The interlocking varies from manufacturer to manufacturer. Full interlock: Hybrid interlock: I use the fourth channel to control the ceiling fan light. This channel operates independently from the other three. A part of the group configuration would be to specify which channels make up the group. Thus, if one has the ability to specify which three channels to group, then this same capability could be used in the 2/2 grouping to specify which channels are in each group. One could extend this thinking to a 5Ch switch (still two groups at most). |
I like your idea and will implement it in the next version |
1) Does your firmware work with Sonoff 4CH Pro R2? YES 2) 2-Which of these patterns can you use with your firmware? If you want to work with sonoff in pulse mode, then I recommend you the regular firmware, as all the add-on make no sense (with a pulse for start and a pulse for stop, you will never know the exact position of your shutter). Personally I do use 2 433mhz pulse-switches ( intertechno ywt , just google it) which are connected to the ch4-pro by 433mhz, but you can also use any other switch with my firmware. But in all cases, sonoff is not in the pulse-mode, only the switches are. 3- Do you have the firmware in the bin format? => let me know if you need support |
https://www.ebay.com/itm/1pc-DC12V-G3-4-Normally-Closed-Brass-Electric-Solenoid-Water-Valve-Fast-Install/323265864011?hash=item4b4425a14b:g:zkcAAOSw~RFa2Htu:rk:1:pf:0 Would such a valve be a good choice for use with the Sonoff 4ch or the R2 or the Pro versions of this hardware. Thanks in advance for advice! |
Do you have a 12V power supply for this application? Why not use a mains powered valve like the one used in a dish machine? |
Anyhow no problem here. Just some relays in front and you’re done. Standard installation |
Can you make a Pull Request with your Splitted Interlock Mode, please ? Thanks |
I hope to see the "Interlock mask funcionality", written by @stefanbode, implemented in the master Tasmota code because is usefull for various scenario. |
I already asked to both @lobocobra and @stefanbode for a PR to add that feature to Tasmota but there is no answer so far. They must be very busy. |
@lobocobra @stefanbode we trust in you ;) |
Ah sorry I was on vacation! I will do it :-) |
Hi, |
Hi gents. I’m still on holiday and can not commit a change he master branch until feb 2019. THe requested masking of specific relays is already implemented and tested. The code changes are quite a few. Not very complicated. |
@ascillato2 @Pako75 |
Added with PR #4910 from @lobocobra |
Thanks a lot for sharing this and thanks everyone for sharing theirs ideas. Very appreciated. 👍 |
@lobocobra |
Hi all
I wanted to use two 4CH Pro to control centrally 4 rollos. In consequence I needed to split the interlock mode of a 4CH/pro into 2 groups of 2 channels, in order to prevent, that the up/down motors can be activated the same time.
If somebody is interested my quick an dirty solution, you find it below. I tested it and it works like a charm. I combine it with PulseTime, which prevents, that the motors run by mistake forever.
You will need to add one variable and to replace two procedures in the code. In the answer section you will see the code. As this is quick an dirty, I doubt that it will make the way into the official code, but I would be ready to invest more time, so that it gets into the code.
!!! the current code only works with 4 CH devices and is not prepared for any hypothetical 3 or 6 Channel devices. For 2 Channels just use the Interlock function.
UPDATE 24.08.2018
The code evolved and you can find the solution now under:
The text was updated successfully, but these errors were encountered: