I use this very basic code to turn lights on or off ( by using esphome); however if the light status in home assistant is on, the light is off and vice versa. Is there any way to make the light statue in home assistant and esp home to be the same as the real light status?
First off: Please format your code to make it more readable. Indentation matters in yaml and it’s hard to spot errors when code isn’t formatted. Select the code and click on the </> symbol - or insert ´´´ before and after the code.
Secondly: I don’t know what kind of light you’re using, but you can try to add inverted: true in the output component:
I have another problem if you could thankfully help me to solve it. Once the esp is connected to power, the esp turns on the relay for mile seconds then turns off again. how can i it make it directly turns off without it turning on for mile seconds at the beginning?
Both pins are low at boot, so it all sounds to me like you have chosen to use the NC configuration on the relay. You could try the other option of using NO on the relay instead. If you do, also remember to set reverse: false in the output component in your yaml.
Read more about NO (Normally Open) and NC (Normally Closed) here:
I am Using a relay module like this one, the led at the module lights up when the status on home assistant was OFF (before adding the reverse line). nothing is hooked up to the relay right now but i know if the esp is sending power to the relay from the led indicator at the relay board as I mentioned. The reverse line fixed that but the flicker in the beginning is what i can’t fix yet
Once again; please format your code, as outlined in my previous post.
And yet again, try doing what I posted above.
You have two wires from the lamp going into the relay; leave the middle one where it is, but swap the other over to the other port. Look how it’s done on the page I linked to above.
Of course not, i am thankful for your support, but i don’t always just understand some of the things that you recommends to me for my lack of experience. I also think that i might not be always to make my point clear for helpers like you to understand (also for my inexperience). If we could communicate on another platform (may be a call where i can share my setup or any other way you are comfortable with), so we can understand each other better. I am really thankful and trying to do everything you recommend. I do appreciate your time and effort dear