xoseperez / espurna

Home automation firmware for ESP8266-based devices
http://tinkerman.cat
GNU General Public License v3.0
2.98k stars 635 forks source link

unclear how to add ITEAD BN-SZ01 to the code as a separate device. #132

Closed xoseperez closed 6 years ago

xoseperez commented 7 years ago

Originally reported by: Axel Roest (Bitbucket: axello, GitHub: axello)


Hi, I forked the Espurna repo to add the ITEAD_BNSZ01 LED light. To do that I added extra lines in arduino.h, hardware.h and hardware.ino

However, when I compile it with

#!C

    #define RELAY_PROVIDER      RELAY_PROVIDER_LIGHT

it generates errors that lightState(status); and lightState(); are not defined.

These are also used in the AI_LIGHT configuration, but this module uses the my9291 dimmer module. The ITEAD_BNSZ01 uses a BP2838G chip, but what I gather from the following blogpost and using espeasy, it should be dimmable using a simple pwm value on GPIO12. itead-bn-sz01

My problem: how to define GPIO12 as a dimmable output using espurna source code and constants. See my fork for my try-outs Apparently RELAY_PROVIDER_LIGHT is in some way hard-coded to a LIGHT_PROVIDER_MY9192 or LIGHT_PROVIDER_RGB, and there is no LIGHT_PROVIDER_DIMMER or similar which only dims one LED channel?

I have adapted it now to use

#!C

    LIGHT_PROVIDER_RGBW

and redefined

#!C

    #define RGBW_WHITE_PIN          12

This compiles. But, I cannot understand how to connect a domoticz idx to this value; I don't understand the logic in the code to add idx channels.

fork at: https://bitbucket.org/axello/espurna_axel branch: ITEAD_BNSZ01

xoseperez commented 6 years ago

Removing milestone: 1.8.4 (automated comment)

xoseperez commented 6 years ago

Support for BN-SZ01 released with 1.9.0 using the new LIGHT_PROVIDER_DIMMER

xoseperez commented 7 years ago

Original comment by Axel Roest (Bitbucket: axello, GitHub: axello):


You say "it should be the same with any other LED device.", but the LIGHT_PROVIDER_MY9192 uses a special chip, and the LIGHT_PROVIDER_RGB apparently does some more magic to appear in the list to add Domotics #idx. Like the POW module does. If have tried the LIGHT_PROVIDER_RGBW option now. If that works, I can probably split of a LIGHT_PROVIDER_DIMMER option. Could you give me a hint in which direction to pursue to add a domoticz #idx to a single bit PWM channel?

xoseperez commented 7 years ago

Removing milestone: 1.8.1 (automated comment)

xoseperez commented 7 years ago

There is no one-channel dimmer yet in ESPurna. I don't have that particular device but it should be the same with any other LED device.