Git Product home page Git Product logo

Comments (21)

LubergAlexander avatar LubergAlexander commented on June 19, 2024 1

from swifitch.

ArnieX avatar ArnieX commented on June 19, 2024 1

I have tested it out and it works flawlessly, I have already pushed it to the repo and added credits to readme to thank you for the idea ;), check it out.

from swifitch.

LubergAlexander avatar LubergAlexander commented on June 19, 2024 1

Thanks! I will

from swifitch.

ArnieX avatar ArnieX commented on June 19, 2024

Hi Alexander,

I'm happy you like it ;)

1, I don't know about 110V but I think that HLK-PM01 is capable to run on 110V too. So it should be ok in US.

2, It's actually D2 and yes you can connect analog switch. What you need is L/N cables under switch to power Swifitch. It need to have both and N isn't always available under switches so it depends on your house wiring.

3, Wiring of analog switch is easy, just completely remove any high voltage wires from the analog switch and connect the contact to 3V3 from Swifitch to analog switch, output from analog switch to pin D2 and then bridge D2 and GND on Swifitch with 10k Ohm resistor which will pulldown the D2 pin to register correctly when analog switch is disconnected from 3V3. All the functionality should be in firmware itself, I have done the changes for my friend who has wiring so he could use it this way and he is happy with that. Thought it wasn't designed with analog switch in mind.

Hope this is clear ;), otherwise let me know.

BR,

Martin

from swifitch.

LubergAlexander avatar LubergAlexander commented on June 19, 2024

Thanks for a quick reply!

I will later remove one of the faceplates to figure out the current wiring and will post it here. Still a little bit unclear to me.

for the 3. Thanks! I was thinking why not to connect D2 to the switch and the other end to the GND, and set D2 to INPUT_PULLUP in the firmware, I thought this way it will not require bridging and will be less wires :) I have recently connected a button to an arduino this way, correct me if Im wrong.

from swifitch.

ArnieX avatar ArnieX commented on June 19, 2024

Hey good point ;) I wasn't aware of this possibility. I have draw quick scheme how to wire it up.

swifitch_analog_switch

Could you please when you try that out with INPUT_PULLUP push this change to swifitch-software repository? I will review and approve. Thanks in advance.

Martin

from swifitch.

ArnieX avatar ArnieX commented on June 19, 2024

So if I get it right you suggest this scheme and enabling INPUT_PULLUP option?

swifitch_analog_switch_gnd

from swifitch.

LubergAlexander avatar LubergAlexander commented on June 19, 2024

from swifitch.

LubergAlexander avatar LubergAlexander commented on June 19, 2024

from swifitch.

ArnieX avatar ArnieX commented on June 19, 2024

OK if the change is just pinMode(D2,INPUT_PULLUP); and swapping LOW/HIGH I will do the change and test it. Will include the scheme too.

from swifitch.

LubergAlexander avatar LubergAlexander commented on June 19, 2024

@ArnieX Here is the diagram of my light switch wiring:
Switch wiring

the light switch itself has 2 black wires and 1 copper(ground) connected. 2 white wires(neutral) are connected together.

Do you think it will work? If yes, can you help me with the mapping between N, L, NO, NC and my wires ?

from swifitch.

ArnieX avatar ArnieX commented on June 19, 2024

Hi Alex,

you are good to go. I would disconnect Ground wire from the switch as this is not needed when it is connected to low power part of swifitch. Then you need to connect neutral to N, black input to L (line), then black output wire to NC or NO this means Normaly Open or Close. Close is that when there is no power to relay it is ON, when you choose Normaly Open it means that the connected appliance is OFF when there is no power to relay. Than programatically you change the default state by applying power to relay. Just pick one, try how it works for you and you could change that later. My recommendation is to start with NO. Then you need to replace those black wires with low voltage ones and connect swifitch to switch pin D2 and GND. Make sure no high voltage cables are connected to the switch anymore. If you are unsure I’m not electrician and I do not know US standards so if not sure let someone to check if you have it wired correctly. Please do not get yourself killed. Let me know how it went. It should be pretty straightforward.

So N (white), L (black input comming from bottom), NO (black going to light).

Make sure that white wire go to swifitch and still continue to light, it won’t work otherwise.

from swifitch.

LubergAlexander avatar LubergAlexander commented on June 19, 2024

Thank you very much!
Also forgot to ask: What would you recommend for two-way and three-way switches(when you control same light from multiple locations).
Three-way

Do I need to somehow wire the swifitches in a similar way? Or this should be solved on MQTT level using rules? I can imagine its possible to write a handler which just accepts a message over message queue to flip the status of the boolean without actually toggling the relay. Would be cool to implement multi-way switches on that level(will send a pull request if I do that)

from swifitch.

ArnieX avatar ArnieX commented on June 19, 2024

This is always the hardest scenario ;). You basically need to install ONE swifitch that will actually toggle the light. In the other switch you will need to sacrifice one swifitch to not do anything else other than sending command that switch was flipped. Then the other swifitch will toggle relay, this logic is better to do in Node RED than directly in swifitches. For the "dumb" swifitch you do not need to solder relay, diode and transistor at all and save it for other swifitch. Share some video when you have it working ;).

from swifitch.

ArnieX avatar ArnieX commented on June 19, 2024

Hi @LubergAlexander,

how is your project going?

BR,

Martin

from swifitch.

LubergAlexander avatar LubergAlexander commented on June 19, 2024

from swifitch.

ArnieX avatar ArnieX commented on June 19, 2024

Yeah that can happen ;). Otherwise awesome. Looking forward for the code updates. I'm open to any improvements.

from swifitch.

LubergAlexander avatar LubergAlexander commented on June 19, 2024

@ArnieX I will get back to you on that, but while I am still building the first one, here are a few improvements I would like to make:

  1. Implement configurable optimistic strategy. At the moment when you toggle the button it switches the relay first, and then sends the update to mqtt. I would like to add a checkbox on the configuration screen: optimistic: true/false. If disabled, it would send the request to mqtt first and will switch the relay only if got the approval from the server. This would be useful to disable certain switches programmatically(for switch controlled outlets for example)

  2. HTTPS support for MQTT transport. I know that ESP8266 is pretty slow, but I saw some solutions on SSL implementation, would like to try them.

  3. Some code cleanup, code style and unit tests if I ll have time :)

from swifitch.

ArnieX avatar ArnieX commented on June 19, 2024

Sounds interesting.

1, I can't imagine usecase for this, but may have some for some people. How about just adding topic to disable/enable analog switch? That would maybe do this easier. Instead of asking for permission on demand, it will already know if it has it or not.

2, Good luck ;). I don't think it's necessary for local setup but may be good for remote locations.

3, Hmm ;) this sounds like I still got lot to learn :D, but unit tests could be good to have thought.

from swifitch.

LubergAlexander avatar LubergAlexander commented on June 19, 2024

@ArnieX quick update - finally tried to connect it - worked the first try! Toggled the lights with MQTT commands. I will do some cleanup, want to embed a couple boxes behind existing switches and then will post a connection diagram and pics!

from swifitch.

ArnieX avatar ArnieX commented on June 19, 2024

Well done! Congratulation ;). Looking forward.

from swifitch.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.