diff --git a/README.md b/README.md index af21fe8..a2d80f5 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,23 @@ -# esphome IKEA LED matrix components for Frekvens & Obegränsad +# ESPHome IKEA LED matrix components for Frekvens & Obegränsad +Both Frekvens and Obegränsad are 16 by 16 LED Matrixes from IKEA and they are Hackable for Usage with HomeAssistant / ESPHome. -A custom component for esphome to interface with IKEA's Frekvens Cube and Obegränsad panel. +This Repository is a custom component for ESPHome to interface these two Matrixes. -## Sources +I will create a custom PCB for both Frekvens Cube and Obegränsad Panel that you can build yourself for a sleek integration. ❗❗❗TODO❗❗❗ -This repo is heavily based on the original [FrekvensPanel library by @frumperino](https://github.com/frumperino/FrekvensPanel). +## Wiring -It's also inspired from the esphome component PCD8544. +You have to wire your ESP32 or ESP8266 according to this Schematics. -## Usage +### Frekvens -Currently there is a dependency upon Adafruit GFX library. In your esphome config, add these lines: +❗❗❗TODO❗❗❗ -- Declare necessary libraries -- Define frekvenspanel component +### Obegränsad -```yaml - lib_deps: - - Wire # Also required by GFX. - - SPI # Also required by GFX. - - adafruit/Adafruit BusIO # Required by GFX Library. - - adafruit/Adafruit GFX Library # Required for FrekvensPanel. - - me-no-dev/ESPAsyncTCP -``` +❗❗❗TODO❗❗❗ + +## Software Here is a short config to demonstrate the usage to display time on Frekvens and Obegränsad: @@ -41,7 +36,7 @@ esphome: - me-no-dev/ESPAsyncTCP external_components: - - source: github://phiten/esphome-ikea-led-matrix@master + - source: github://sascha-hemi/esphome-ikea-led-matrix@master components: [ frekvens_panel ] light: @@ -96,7 +91,7 @@ esphome: - me-no-dev/ESPAsyncTCP external_components: - - source: github://phiten/esphome-ikea-led-matrix@master + - source: github://sascha-hemi/esphome-ikea-led-matrix@master components: [ obegraensad_panel ] light: @@ -135,9 +130,3 @@ display: it.strftime(4, 8, id(b03), "%M", id(ntp_time).now()); ``` - -## License -[TBD] the original library does not specify the license. This repo is consecutively not licensed yet either. - -## Credits -Thanks to @speckij \ No newline at end of file diff --git a/components/frekvens_panel/display.py b/components/frekvens_panel/display.py index 7afec82..65f686b 100644 --- a/components/frekvens_panel/display.py +++ b/components/frekvens_panel/display.py @@ -49,6 +49,6 @@ async def to_code(config): if CONF_LAMBDA in config: lambda_ = await cg.process_lambda( - config[CONF_LAMBDA], [(display.DisplayBufferRef, "it")], return_type=cg.void + config[CONF_LAMBDA], [(display.DisplayRef, "it")], return_type=cg.void ) cg.add(var.set_writer(lambda_)) diff --git a/components/obegraensad_panel/display.py b/components/obegraensad_panel/display.py index 50593e8..a5cf5be 100644 --- a/components/obegraensad_panel/display.py +++ b/components/obegraensad_panel/display.py @@ -7,6 +7,7 @@ CONF_PAGES, CONF_CONTRAST, ) +from esphome.const import __version__ as ESPHOME_VERSION DEPENDENCIES = [] @@ -38,7 +39,8 @@ async def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) - await cg.register_component(var, config) + if cv.Version.parse(ESPHOME_VERSION) < cv.Version.parse("2023.12.0"): + await cg.register_component(var, config) await display.register_display(var, config) cg.add(var.set_pins( @@ -49,6 +51,6 @@ async def to_code(config): if CONF_LAMBDA in config: lambda_ = await cg.process_lambda( - config[CONF_LAMBDA], [(display.DisplayBufferRef, "it")], return_type=cg.void + config[CONF_LAMBDA], [(display.DisplayRef, "it")], return_type=cg.void ) cg.add(var.set_writer(lambda_)) diff --git a/components/obegraensad_panel/obegraensad-panel.h b/components/obegraensad_panel/obegraensad-panel.h index 741549c..5920517 100644 --- a/components/obegraensad_panel/obegraensad-panel.h +++ b/components/obegraensad_panel/obegraensad-panel.h @@ -1,5 +1,7 @@ #pragma once +#include "esphome/core/defines.h" +#include "esphome/core/version.h" #include "esphome/core/component.h" #include "esphome/components/display/display_buffer.h" @@ -9,8 +11,11 @@ namespace esphome { namespace obegraensadpanel { -class Panel : public PollingComponent, - public display::DisplayBuffer { +#if ESPHOME_VERSION_CODE >= VERSION_CODE(2023, 12, 0) +class Panel : public display::DisplayBuffer { +#else +class Panel : public PollingComponent, public display::DisplayBuffer { +#endif // VERSION_CODE(2023, 12, 0) public: int p_latch; int p_clock; @@ -23,7 +28,7 @@ class Panel : public PollingComponent, } float get_setup_priority() const override { return setup_priority::PROCESSOR; } - + display::DisplayType get_display_type() override { return display::DisplayType::DISPLAY_TYPE_BINARY; } void data(uint8_t value);