Well if that delay worked properly it was supposed to only pulse the relay, not leave it on. Under the binary_sensor where I put on_press: you can also put a new line for on_release: and do a similar action, but switch.turn_off for the relay
Well the relay turned on right after I uploaded the code and stayed on. Then I pushed the button and it turned off for 1/2 sec then turned back on. Basically it was on before I pushed the button even so it was backwards. No big deal I don’t think.
I am still trying to figure out a way to mute the doorbell.
Also I took a look at the LEDs one. It seems pretty straight forward. The only thing I could not figure out was if I wanted to set a portion of the LEDs to one color and another portion to a different color. I don’t necessarily want them to change just remain two (or more) different colors.
I am starting to see how ESPHome works and I am starting to like it. It is definately a lot easier than writing the code in the Arduino software.
I am guessing I will have to do something with the lambda for the sound. But I am not sure how this would work. I have a switch setup in HA switch.doorbell_sound but unsure how to get this to work
No in my code I was able to flip a switch in HA so that if someone pushed the button the doorbell would not ring. So at night time I mute it or when the kids are taking naps so it doesn’t wake them up when we get a delivery.
Oh right! Now I get you. There’s a few ways to do that. You could use an input_boolean as a condition in the ESP automation. I’m on a plane about to take off, I’ll post the solution when I land
Cheers . Ok, I’m back on the ground. Do you mind sharing your current code so I don’t end up changing things back to the wrong pins etc?
I think the easiest way to create a ‘mute’ function is going to be to remove the automation code from the ESP and do this in HA instead, that way we can easily incorporate a condition for an input_boolean.doorbell_mute to be off
EDIT: I found another way, a way I was hoping for so that the automation stays within the ESP (so it can function irrelevant of HA status). I’ll post below.
i got that loaded in but getting this error. havent had time to look at it as i am away from home right now
src/main.cpp: In lambda function:
src/main.cpp:38:28: error: expected primary-expression before '.' token
return id(text_sensor.mute1).state == off;
^
src/main.cpp:38:34: error: 'id' was not declared in this scope
return id(text_sensor.mute1).state == off;
^
src/main.cpp:38:45: error: 'off' was not declared in this scope
return id(text_sensor.mute1).state == off;
^
Compiling .pioenvs/doorbell/lib95c/esphome-core/esphome/binary_sensor/pn532_component.cpp.o
src/main.cpp:39:3: warning: control reaches end of non-void function [-Wreturn-type]
});
^
*** [.pioenvs/doorbell/src/main.cpp.o] Error 1
========================== [ERROR] Took 11.26 seconds ==========================
I’m using the same code for my led strips, I would love to see how you implement effects from BRUH’s code to esphome. I did flash one of my led strips with EspHome, but I am missing effects that are in BRUH’s original arduino code.
Ok so I think I have this working now for the doorbell. See code below. I have yet to try the LED strips yet but that is next. Not sure if I will get them exactly the same but I don’t think I need to.