RavenSystem / esp-homekit-devices

Advanced firmware to add native Apple HomeKit and custom configurations, compatible with any SoC based on ESP32, ESP32-S, ESP32-C and ESP8266 series. (Shelly, Sonoff, Electrodragon, Tuya...)
Other
2.76k stars 361 forks source link

Shelly 1 Garage door opener with 2 magnetic reed contacts #818

Closed morphix9 closed 4 years ago

morphix9 commented 4 years ago

Hey guys,

has anyone tried to connect 2 magnetic reed contacts (NC) with the Shelly 1? One contact for fully open, one for fully closed. Could someone share the JSON? Which reed contacts do you prefer (where do you buy)?

fIctioN600 commented 4 years ago

Yes i do. Works without problems.

{"a":[{"t":40,"d":18,"b":[{"g":5}],"f3":[{"g":1,"t":0}],"f4":[{"g":1}],"f2":[{"g":3,"t":0}],"f5":[{"g":3}],"0":{"r":[{"g":4,"v":1,"i":0.5}]},"1":{"a":0},"2":{"r":[{"g":4,"i":1.5},{"g":4,"v":1,"i":0.5},{"g":4,"v":1,"i":2}]},"3":{"a":2}}]}

Shelly must be connected to 24V DC Adapter.

I use this contacts: https://www.amazon.de/gp/product/B000ZGI1Y6/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1

but any other NC contact will work to

morphix9 commented 4 years ago

Thanks @fIctioN600! Could you tell me how do you connect the reed switches to Shelly (wiring)?

fIctioN600 commented 4 years ago

first reed: one wire to GPIO 1 and the other to GND second reed: one wire to GPIO3 an the other also to GND

I used jumper cables to connect it.

morphix9 commented 4 years ago

first reed: one wire to GPIO 1 and the other to GND second reed: one wire to GPIO3 an the other also to GND

I used jumper cables to connect it.

Thank you for your help, I will try it out.

kn1gh1 commented 4 years ago

What does it means? GPIO 1 and Gnd?

On my shelly only. I O SW N L

fIctioN600 commented 4 years ago

Gpio 1 and GND are some of the connectors you use for flashing

https://forum.creationx.de/index.php?attachment/1981-shelly-1-pins-png/

kn1gh1 commented 4 years ago

Ah ok. but why does it switch twice? the gate opens and stops immediately with the second impulse. can you take it out? I want to connect a shelly parallel to the gate opener. It's a button, a push, gate opens, next push, door stopped, next push, door closed. Are you German because the Amazon link is German?

fIctioN600 commented 4 years ago

I am german yes. It does not switch twice in my installation. First push open or close second push reverse direction there is no stop

kn1gh1 commented 4 years ago

I also come from Germany. I tried again, my gate opens a little and then closes again. Too bad I thought that's exactly what I'm looking for. Did you write the json-config yourself?

kn1gh1 commented 4 years ago

funny, today my reeds get connected and working. also switches only once, without reeds twice. so everything is fine.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

morphix9 commented 4 years ago

Working fine on my end. This JSON could be added to the library.

Cunner commented 4 years ago

@fIctioN600 is it also possible to use NO reed contacts ? If so which parameters do I have to change? Thanks in advance!

morphix9 commented 4 years ago

@fIctioN600 you mentioned the shelly needs to be connected to 24v. Why? Is the gpio output different when connected to 220v? I’m having an issue when on 24v, because the sensor wires are too long (20m).

fIctioN600 commented 4 years ago

Yes input = output and at least my contacts cant handle 220v for the relay I O at the shelly it doesnt matter at all

Gumboot13 commented 4 years ago

output

Don't use the gpio pins while using 220v AC as the gpio pins are tied to the AC circuit and and could cause damage to you or your devices/sensors

Gumboot13 commented 4 years ago

first reed: one wire to GPIO 1 and the other to GND second reed: one wire to GPIO3 an the other also to GND

I used jumper cables to connect it.

Only issue using gpio1 is if held low on boot/reset the device won't boot.

Gpio3 is fine,. Gpio5 can also be used (the SW input terminal)

Both can be held low on boot without issues.

morphix9 commented 4 years ago

@Gumboot13 thanks for that. I will switch then from GPIO1 do GPIO3.

Are you sure that the pins are outputting 220V when on 220V power supply? I measured the output with a multimtter, but got around 4V.

What about if you power with 24V? Is the pin voltage dependant on that?

Gumboot13 commented 4 years ago

@Gumboot13 thanks for that. I will switch then from GPIO1 do GPIO3.

Are you sure that the pins are outputting 220V when on 220V power supply? I measured the output with a multimtter, but got around 4V.

What about if you power with 24V? Is the pin voltage dependant on that?

Have a read here http://www.thesmarthomehookup.com/the-shelly-1-smart-relay-is-it-better-than-the-sonoff-basic/

Apparently the gpio are tied to the AC side of it. On a plus side of using the 24v option then it is ok

morphix9 commented 4 years ago

first reed: one wire to GPIO 1 and the other to GND second reed: one wire to GPIO3 an the other also to GND I used jumper cables to connect it.

Only issue using gpio1 is if held low on boot/reset the device won't boot.

Gpio3 is fine,. Gpio4 can also be used (the SW input terminal)

Both can be held low on boot without issues.

How about using GPIO0 (instead of 4)? Can it be held low on boot?

Gumboot13 commented 4 years ago

first reed: one wire to GPIO 1 and the other to GND second reed: one wire to GPIO3 an the other also to GND I used jumper cables to connect it.

Only issue using gpio1 is if held low on boot/reset the device won't boot. Gpio3 is fine,. Gpio4 can also be used (the SW input terminal) Both can be held low on boot without issues.

How about using GPIO0 (instead of 4)? Can it be held low on boot?

Can't use gpio0 as if you hold it low on boot places the device into flash mode

morphix9 commented 4 years ago

Right. Where the hell is the GPIO4 then on a Shelly 1? :)

Gumboot13 commented 4 years ago

Right. Where the hell is the GPIO4 then on a Shelly 1? :)

Unsure

Gumboot13 commented 4 years ago

received_1557356317777954

morphix9 commented 4 years ago

Could you mark on that image where GPIO4 is? shelly1

Gumboot13 commented 4 years ago

Could you mark on that image where GPIO4 is? shelly1

Sorry misread your post about gpio4, thought you were talking about gpio3.

Will have a look into it for you and post back

Gumboot13 commented 4 years ago

Right. Where the hell is the GPIO4 then on a Shelly 1? :)

Believe I had gpio4 and gpio5 mixed up.

I know pins gpio3 and gpio5 are good to use at being held low on boot

morphix9 commented 4 years ago

Gpio5 is the switch input (see schematic above). It's not a pin like GPIO0, 1 or 3, where you cut put a wire on. Or am I wrong?

Gumboot13 commented 4 years ago

Gpio5 is the switch input (see schematic above). It's not a pin like GPIO0, 1 or 3, where you cut put a wire on. Or am I wrong?

Correct, just wire it into the screw down terminal

morphix9 commented 4 years ago

I've tried with GPIO 5 but can't get it running (switched from GPIO1 to 5) :(

My config is:

{"a":[{"0":{"r":[{"g":4,"v":1,"i":0.5}]},"1":{"a":0},"2":{"r":[{"g":4,"i":1.5},{"g":4,"v":1,"i":0.5},{"g":4,"v":1,"i":2}]},"3":{"a":2},"t":40,"d":52,"b":[],"f3":[{"g":5,"t":0}],"f4":[{"g":5}],"f2":[{"g":3,"t":0}],"f5":[{"g":3}],"s":1},{"1":{"s":[{"a":1}]},"i":0.5,"b":[],"s":0}]}

Could you share yours @Gumboot13 ?

@fIctioN600 you are running it with GPIO 1 and 3 without any issues (on startup)?

fIctioN600 commented 4 years ago

I do. Never recognized problems with it.

Gumboot13 commented 4 years ago

I've tried with GPIO 5 but can't get it running (switched from GPIO1 to 5) :(

Could you share yours @Gumboot13 ?

I'm running Esphome on my devices. Happy to share that config if you want

Gumboot13 commented 4 years ago

I do. Never recognized problems with it.

Have you tried holding gpio1 low on boot up?

morphix9 commented 4 years ago

I've tried booting it up with GPIO1 on low and it's not working (HAA not responding). @RavenSystem is this a Shelly 1 specific issue or HAA?

@Gumboot13

Do you have one sensor on GPIO5 (SW) and one on GPIO3? Could the GPIO5 sensor use ground from the GND pin output or does it have to be 24DC-? Maybe stupid question, but I'm not an electrician ;P

Gumboot13 commented 4 years ago

I've tried booting it up with GPIO1 on low and it's not working (HAA not responding). @RavenSystem is this a Shelly 1 specific issue or HAA?

@Gumboot13

Do you have one sensor on GPIO5 (SW) and one on GPIO3? Could the GPIO5 sensor use ground from the GND pin output or does it have to be 24DC-? Maybe stupid question, but I'm not an electrician ;P

I use ground for both. 3 wires for two reed switches. Ground, gpio3 and gpio5

myrcinos commented 4 years ago

Hi, I have a problem with a sensor connected to GPIO5. It simply doesn't work. Previously I had one sensor connected to GPIO1 and the other to GPIO3 but during the boot when GPIO1 was low, the device did not boot properly. This has been described above. So, I decided to use GPIO5 instead but I am unable to low it, I tried with L and GND pin. I'm using 12V DC. Can anyone help me? My JSON below:

{"c":{"b":[{"g":1,"t":5}]},"a":[{"t":40,"d":35,"c":49,"f3":[{"g":5,"t":0}],"f4":[{"g":5}],"f2":[{"g":3,"t":0}],"f5":[{"g":3}],"0":{"r":[{"g":4,"v":1,"i":0.5}]},"1":{"a":0},"2":{"r":[{"g":4,"i":1.5},{"g":4,"v":1,"i":0.5},{"g":4,"v":1,"i":2}]},"3":{"a":2}}]}

morphix9 commented 4 years ago

Hi, I have a problem with a sensor connected to GPIO5. It simply doesn't work. Previously I had one sensor connected to GPIO1 and the other to GPIO3 but during the boot when GPIO1 was low, the device did not boot properly. This has been described above. So, I decided to use GPIO5 instead but I am unable to low it, I tried with L and GND pin. I'm using 12V DC. Can anyone help me? My JSON below:

{"c":{"b":[{"g":1,"t":5}]},"a":[{"t":40,"d":35,"c":49,"f3":[{"g":5,"t":0}],"f4":[{"g":5}],"f2":[{"g":3,"t":0}],"f5":[{"g":3}],"0":{"r":[{"g":4,"v":1,"i":0.5}]},"1":{"a":0},"2":{"r":[{"g":4,"i":1.5},{"g":4,"v":1,"i":0.5},{"g":4,"v":1,"i":2}]},"3":{"a":2}}]}

I'm in the same boat as you. No idea why the GPIO 5 is not working. I was assuming a voltage drop because of a long cable line and thin wire (UTP, 50m). I'm powering it with 24V DC. Unfortunatellly can't use 220V on those pins. I've ordered a Sonoff SV, which has 2 working pins - will let you know.

myrcinos commented 4 years ago

I'm in the same boat as you. No idea why the GPIO 5 is not working. I was assuming a voltage drop because of a long cable line and thin wire (UTP, 50m). I'm powering it with 24V DC. Unfortunatellly can't use 220V on those pins. I've ordered a Sonoff SV, which has 2 working pins - will let you know.

Thx for your reply. I'm using 12V DC from a dedicated power supply, there is no voltage drop. I will try over the weekend with 24V DC dedicated power supply on a short cable. Will let you know. Sonoff SV is good, I have one in my garage but I wanted to use Shelly for outside gate. Sonoff SV is not a good option there as SV does not have housing.

Gumboot13 commented 4 years ago

I'm in the same boat as you. No idea why the GPIO 5 is not working. I was assuming a voltage drop because of a long cable line and thin wire (UTP, 50m). I'm powering it with 24V DC. Unfortunatellly can't use 220V on those pins. I've ordered a Sonoff SV, which has 2 working pins - will let you know.

Thx for your reply. I'm using 12V DC from a dedicated power supply, there is no voltage drop. I will try over the weekend with 24V DC dedicated power supply on a short cable. Will let you know. Sonoff SV is good, I have one in my garage but I wanted to use Shelly for outside gate. Sonoff SV is not a good option there as SV does not have housing.

I'm running a 24v DC setup with nil issues with the only difference is I don't use tasmota as the firmware.

Would you be in a position to try it with esphome to see if the same issue occurs?

If I get a chance I can try adding extra wire mine to see if it plays up

myrcinos commented 4 years ago

I'm running a 24v DC setup with nil issues with the only difference is I don't use tasmota as the firmware.

Would you be in a position to try it with esphome to see if the same issue occurs?

I'm using Ravensystem HAA not Tasmota. I have no experience with software other than HAA.

Gumboot13 commented 4 years ago

I'm running a 24v DC setup with nil issues with the only difference is I don't use tasmota as the firmware. Would you be in a position to try it with esphome to see if the same issue occurs?

I'm using Ravensystem HAA not Tasmota. I have no experience with software other than HAA.

Copy. I just noticed what topic I have been replying in. Sorry about any of the confusion.

But on a plus note I do have it working fine but with a different software

myrcinos commented 4 years ago

I have just checked using 24 DC, unfortunately same result: GPIO5 not working at all. Since it is ok on esphome, I think we found software issue. I'm running 2.5.7. Now I have a different issue, I'm unable to enter setup mode. I have a button defined in JSON and it used to work but not anymore. So I thought, I flash the device again. Surprisingly after I erase flash and then flash with new fullhaa.bin image, the device still remembers wifi settings. Is it normal? Can someone tell me what is going on?

morphix9 commented 4 years ago

I have just checked using 24 DC, unfortunately same result: GPIO5 not working at all. Since it is ok on esphome, I think we found software issue. I'm running 2.5.7. Now I have a different issue, I'm unable to enter setup mode. I have a button defined in JSON and it used to work but not anymore. So I thought, I flash the device again. Surprisingly after I erase flash and then flash with new fullhaa.bin image, the device still remembers wifi settings. Is it normal? Can someone tell me what is going on?

Having same issues with erasing flash. Sometimes it just doesn't erase (it takes 0.0 seconds). I try flashing the software again, and then flashing and so on. No idea what's going on.

DenisG1994 commented 2 years ago

Hi, I have a problem with a sensor connected to GPIO5. It simply doesn't work. Previously I had one sensor connected to GPIO1 and the other to GPIO3 but during the boot when GPIO1 was low, the device did not boot properly. This has been described above. So, I decided to use GPIO5 instead but I am unable to low it, I tried with L and GND pin. I'm using 12V DC. Can anyone help me? My JSON below:

{"c":{"b":[{"g":1,"t":5}]},"a":[{"t":40,"d":35,"c":49,"f3":[{"g":5,"t":0}],"f4":[{"g":5}],"f2":[{"g":3,"t":0}],"f5":[{"g":3}],"0":{"r":[{"g":4,"v":1,"i":0.5}]},"1":{"a":0},"2":{"r":[{"g":4,"i":1.5},{"g":4,"v":1,"i":0.5},{"g":4,"v":1,"i":2}]},"3":{"a":2}}]}

After a LOT of time and test I finally managed to use 2 sensors (open on GPIO3 and close on GPIO5) using the JSON down there... The "problem" (at least in my case) was that GPIO5 is "active low" so I had to invert the input. PS. I used the Json configurator so maybe there is some extra code that's not needed...

{"c":{"0":{"r":[{"g":4}]}},"a":[{"0":{"r":[{"g":4,"v":1,"i":0.5}]},"1":{"r":[{"g":4,"v":1,"i":0.5}]},"2":{"r":[{"g":4,"v":1,"i":0.5}]},"3":{"r":[{"g":4,"v":1,"i":0.5}]},"t":40,"d":27,"s":5,"b":[],"f2":[{"g":3,"t":0,"i":0}],"f3":[{"g":5,"t":0,"i":1,"p":0}],"e":35,"f4":[{"g":5,"t":1,"p":0,"i":1}],"f5":[{"g":3,"t":1}]}]}