JeffResc / Sonoff-D1-Dimmer

Sonoff D1 Dimmer running ESPHome
https://jeffresc.dev/blog/2020-10-10
MIT License
8 stars 6 forks source link

Sonoff D1 RF Custom File Doesn't Work #1

Open robbz23 opened 3 years ago

robbz23 commented 3 years ago

I tried the rf file today with a remote here and I had a couple of issues. I was able to fix them myself and would like to upload a pull request. or I can just send you my changes.

  1. last brightness and last binary don't seem to be filled and used. This causes problems when turning off with the remote so it wouldn't update esp and HA.

  2. the brightness value that is sent over serial is a hex percentage. Hex 64 = 100 which I can see the confusion. So the line that is round (brightness/64) should be just brighness/100 since esphome is looking for a number between 0 and 1.

  3. I set a variable called isReceivedBrightness when receiving a value from the dimming/rf chip. This way I don't send it back over serial to the same chip that sent it to esp.

  4. Yaml should have default_transition_length: 0s as transitions are handled by the dimming chip on the D1.

JeffResc commented 3 years ago

@robbz23, I did the best I had with the information I have and I'm glad about the amount of work done to get this working in ESPHome in such a short amount of time. Thanks for pointing all this out to me. If you'd like to open a pull request with the changes, I'd be happy to take a look at it and merge it.

JeffResc commented 3 years ago

@robbz23 So I actually tried setting default_transition_length: 0s and realized the on/off switch doesn't work. Did you change something else as well to make that work?