logo elektroda
logo elektroda
X
logo elektroda

Control of fan coils via Sonoff S26 sockets and Sonoff Basic switch

zduniakjacek 1824 24
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19710416
    zduniakjacek
    Level 5  
    Hello

    I am asking for help in solving a problem concerning the SONOFF S26 socket control. I have a heat pump in the house which runs the central heating circulation pump with 230 volts via the controller. There are four fan coil units with very poor automation in the rooms, where the blower runs all the time regardless of the temperature of the circulating fluid. I wanted to automate this system on the basis that when the central heating pump is not working it remotely switches off the power on the SONOFF S26 sockets connected to the fan coils. The sellers on Allegro recommended me a SONOFF BASIC switch and to create a scene in the EWLINK application. I bought this switch and connected the wires from the heat pump to the input and the wires to the CO pump to the output. I made a scene in the application SONOFF BASIC ON- sockets S26 ON and SONOFF BASIC OFF- sockets S26 OFF. The circuit works but only when SONOFF BASIC is switched off in the application or with a button on the housing. When there is a voltage loss at the SONOFF BASIC input, the device goes into offline mode and does not switch the sockets off and does not start them up when this voltage appears. Has anyone perhaps encountered this problem, if so how did they solve it? Alternatively can the problem be solved by some other software e.g. Tasmota ?
  • ADVERTISEMENT
  • #2 19711759
    xury
    Automation specialist
    zduniakjacek wrote:
    When there is a power failure at the SONOFF BASIC input, the device goes into offline mode
    .
    At the moment when the sonoff has no power it does not work according to the maxim "Electrical devices work much better when they are connected to power".
    To be honest I don't know how the sonoffs behave on the original FW. In Tasmota you can set it so that when the power goes out and you reconnect, the state of the relays is as it was when the power went out.
    However, Tasmota deprives you of the cloud and control from anywhere in the world if you don't have a public IP or VPN.
    Tasmota works well in tandem with some kind of home automation system that supports MQTT. If you don't have one then rather stay on the Chinese cloud.
  • #3 19711849
    zduniakjacek
    Level 5  
    Thank you for your reply.
    The original Sonoff software, i.e. Ewlink, also has a function to restore the operating state after a power outage and reappearance, but it does not send information about this to the server, which means that the other devices (i.e. S26 sockets) do not switch off and on. My question is whether such a dependency can be set in the Tasmota software? Generally, I do not care about controlling these devices (i.e., pump and fan coils) via the internet, I have network control of the heat pump and this is enough for me. On Allegro, sellers are offering to change the software on the SONOFF S26 and Basic to Tasmota, but before I decide to do this I would like to get advice from someone who has experience and knowledge on the subject. Will such a system work on this software?
  • #4 19712865
    xury
    Automation specialist
    Yes it is possible to set up such an operation in Tasmota. However, you will have to try a little. In Tasmota, for such things (if you do not use MQTT), you have to use rules and the websend command to send a command from one device to another.
    I recommend reading Tasmota's rules and commands and deciding for yourself if you can manage it.
    https://tasmota.github.io/docs/Rules/
    However, I have never done something like this myself, as I use the MQTT broker in conjunction with NodeRed, Domoticz and Home Assistant.
  • #5 19716956
    zduniakjacek
    Level 5  
    Thank you for your advice. I will send the sockets for reprogramming and try to set them up to work after the power changes. If I manage to do this I will describe it in a post, perhaps someone will find it useful.
  • ADVERTISEMENT
  • #6 19760080
    zduniakjacek
    Level 5  
    Welcome back

    I reprogrammed the sockets and relay to Tasmota, configured the devices, entered a rule in the Sonoff Basic console:

    Rule1 on power1#state to WebSend [192.168.2.6] POWER1 on endon

    Rule1 1

    where [192.168.2.6] is the ip address of the SONOFF socket S26.

    The circuit works but only when there is power on the Sonoff Basic. That is, it is exactly like the Ewlink. When I switch the Basic on or off with a button on the chassis or in the software, the S26 starts up or shuts down. On the other hand, when I disconnect the power to the Basic, the S26 does not switch off, the same when switching the power on, the socket does not start up. Perhaps the rule is inappropriate.
    Maybe someone who knows the commands and rules in Tasmota well can help :cry: .
  • #7 19768543
    xury
    Automation specialist
    Insofar as when applying power to the Sonoff Basic it is to do something like:
    Rule1 on System#Boot to WebSend [192.168.2.6] POWER1 on endon
    That is, when Sonoff Basic boots it will send a command to the S26. Provided the S26 is powered of course.
    The problem is when the power from Basic disappears unexpectedly, because then it won't send anything.
    An alternative solution would be, for example, to use some computer in the network which, when the Sonoff basic IP ping disappears (Basic disappears from the LAN), will send a command after a GET. i.e. curl in Linux, for example.
  • #9 19768591
    xury
    Automation specialist
    Oh look! I didn't even know it was possible to ping from Tasmota myself.
    Except that I don't know if this option is included in the precompiled binaries:
    Quote:
    This requires #define USE_PING and Tasmota version 8.2.0.3 or newer
    .
  • #10 19768612
    starob
    Level 29  
    I don't know either, but maybe instead of pinging, query the relay status with /cm?cmnd=Power ?
  • #11 19768667
    zduniakjacek
    Level 5  
    WELCOME

    Someone on the Tasmota Users Google group forum suggested I use a Shelly 1 relay instead of the Sonoff Basic. This has a constant power supply and the control signal is fed to the SW connector. I think I'm going to head for this solution, as creating rules for Basic is getting complicated and not to my knowledge on the subject. Maybe some of you have experience with this relay? Will it work with S26 sockets programmed to Tasmot in the circuit I am trying to create?
  • #12 19768719
    starob
    Level 29  
    Provided you reprogram Shelly.
  • #13 19768736
    zduniakjacek
    Level 5  
    Apparently in Shelly 1 you can send a message via HTTP to another device and then you don't need to upload Tasmota, but will this work ?
  • ADVERTISEMENT
  • #14 19770500
    xury
    Automation specialist
    I have compiled a version with USE_PING also you can try to do on this principle:
    Sonoff Basic switches on the S26 socket by when it switches on and connects:

    Rule1 on System#Boot do WebSend [192.168.2.6] POWER1 on endon
    .

    And Socket S26 pings Sonoff Basic every minute and if there is no ping it will switch itself off
    Rule1
      ON Time#Minute|1 DO Ping3 192.168.2.7 ENDON
      ON Ping#192.168.2.7#Success==0 DO POWER1 off ENDON
    Rule1 1
    .
    Assuming that the IP of the Sonoff Basic is 192.168.2.7
    Attached tasmot 10.1.0 with ping support.
    Attachments:
  • Helpful post
    #15 19770571
    starob
    Level 29  
    If @zduniakjacek decides to do an OTA update, it will probably fail due to low memory.

    First you have to update with tasmot-minimal.bin and only to the target .... is this true?
  • Helpful post
    #16 19770655
    xury
    Automation specialist
    True to form. Tasmota-minimal can be downloaded from the web. Due to my long friendship with Tasmota I don't think about it anymore.
    So first we update with the tasmota-minimal.bin.gz file and then with the one from the attachment.
    I recommend using the compressed *.bin.gz files because with 1MB of flash on the uncompressed ones you may get an out of memory error.
  • ADVERTISEMENT
  • #17 19771754
    zduniakjacek
    Level 5  
    Thank you very much for your help in solving the problem. I had a bit of trouble in reprogramming the devices, but it went. Thanks especially to Xury, who wrote me ready-made rules. Both booting sockets via the Boot command and immobilising via pinging work.
    However, while testing the whole setup, another problem arose. When the power to the router is switched off (e.g. during a house power outage) and switched on again, the IP addresses of the devices change. For example, socket 192.168.2.6 changes to 192.168.2.9, etc. I don't know if this is a matter of some setting in the router or a defect in the router.
  • Helpful post
    #18 19771888
    xury
    Automation specialist
    In the router, look for IP address assignment settings by MAC address. The second way is to set fixed IP addresses in the Tasmota console.
  • #19 19771953
    zduniakjacek
    Level 5  
    I've searched all the options on the router but haven't found anything like this. I have a D-Link DWR-116 router, and it might be easier to assign IP addresses to devices in Tasmota, just not sure how to do it. What command do I need to enter into the console to assign a fixed address?
  • Helpful post
    #20 19772033
    starob
    Level 29  
    zduniakjacek wrote:
    I searched all the options in the router, but I did not find something like that.
    .
    If you don't have something like this ... then you have no option on your router
    https://eu.dlink.com/pl/pl/wsparcie-techniczn...es-ip-moim-urzadzeniom-podlaczonym-do-dwr-921

    From the tasmota console it looks like this:
    https://hobbytronics.com.pk/config-sonoff-tasmota/
  • #21 19789060
    zduniakjacek
    Level 5  
    Welcome back.

    The circuit is working, but after a few days of testing I have noticed that sometimes the sockets spontaneously switch off despite Basic being on. I suspect this is due to a lack of connectivity between the sockets and Basic, perhaps the router is failing or there is some interference on the WIFI network. I have tried modifying the rule so that additionally when pinging when the socket is OFF and Basic is ON it will turn on:

    Rule1 ON Time#Minute|1 DO Ping3 192.168.2.3 ENDON ON Ping#192.168.2.3#Success==0 DO POWER1 off ENDON ON Ping#192.168.2.3#Success==1 DO POWER1 on ENDON

    Unfortunately this rule does not work. While the socket is in OFF mode it pings but does not turn on.
  • #22 19824023
    zduniakjacek
    Level 5  
    I corrected the rule, it now works ok, after a momentary WIFI network outage and reappearance the sockets turn on by themselves. Instead of ,,Success==1" it should be ,,Success>0". I give the whole rule, maybe someone will find it useful:
    Rule1 ON Time#Minute|1 DO Ping3 192.168.2.3 ENDON ON Ping#192.168.2.3#Success==0 DO POWER1 off ENDON ON Ping#192.168.2.3#Success>0 DO POWER1 on ENDON
  • #23 21413136
    zduniakjacek
    Level 5  
    After updating the S26 and BASIC to Tasmota version 14.4.1, the circuit stopped working. I entered the command again, after which a message appears in the S26 console:
    RESULT = {"Rule1":{"State": "ON", "Once": "OFF", "StopOnError": "OFF", "Length":146, "Free":365, "Rules": "ON Time#Minute|1 DO Ping3 192.168.1.23 ENDON ON Ping#192.168.1.23#Success==0 DO POWER1 off ENDON ON Ping#192.168.1.23#Success>0 DO POWER1 on ENDON"}}

    Rule1 1

    TIME#MINUTE|1 performs 'Ping3 192.168.1.23'.
    RSL: RESULT = {"Command": "Unknown", "Input": "PING3 192.168.1.23"}

    A message still appears:

    Stored uncompressed, would compress from 146 to 84 (-42%)

    Do you have to change the commands somehow due to this update?
  • Helpful post
    #24 21413593
    xury
    Automation specialist
    The golden rule says: If everything works then don't update.
    You don't have the Ping command compiled in. So either compile your own or go back to the soft what had.
  • #25 21511833
    zduniakjacek
    Level 5  
    Welcome once again

    This time a slightly different problem has arisen. The fact is that it has been occurring since the very beginning with this circuit, but lately it seems to have intensified and is repeating itself more frequently. It consists in the fact that all the S26 sockets switch off despite the Sonoff Basic transmitter power being on. In the console it looks as if the ping signal is not reaching the Basic, with the Basic on. I have attached two printscreens from the console to illustrate the problem. The S26 K file is for the smart socket at the fan coil unit, while the BASIC CO file is the Sonoff Basic transmitter connected to the CO pump. The problem occurred at 15:01, the socket switched off despite the Sonoff Basic being switched on. I replaced the Sonoff Basic R2 transmitter with a new one, I suspected it might be faulty and not always receiving a signal, but this did not solve the problem. Perhaps there is some interference on the home Wi-Fi network and hence the problem, but how do I diagnose this and how do I fix the problem?

Topic summary

The discussion addresses automating control of fan coil units powered via SONOFF S26 smart sockets, coordinated with a SONOFF Basic switch controlling a central heating circulation pump. The original EWLink firmware supports restoring relay states after power outages but lacks inter-device state communication, limiting automation. Reprogramming devices with Tasmota firmware enables advanced control using rules and WebSend commands to synchronize power states between the Basic switch and S26 sockets. Challenges include ensuring sockets switch off when the Basic loses power unexpectedly, which Tasmota alone cannot detect. Solutions involve implementing ping-based watchdog rules where S26 sockets periodically ping the Basic; loss of ping triggers socket shutdown. Fixed IP addressing is necessary to maintain reliable communication, achievable via router DHCP reservations or static IP configuration in Tasmota consoles. Firmware updates require careful handling, often starting with tasmota-minimal.bin to avoid memory issues. Network instability and Wi-Fi interference can cause sockets to switch off erroneously despite the Basic being powered on, indicating potential reliability issues in the wireless control scheme. Alternative hardware like Shelly 1 relays with constant power and HTTP messaging were suggested but require reprogramming or compatibility checks. The latest Tasmota versions may lack built-in ping support, necessitating custom firmware compilation or rollback to earlier versions for full functionality.
Summary generated by the language model.
ADVERTISEMENT