diff --git a/README.md b/README.md index fbc0a9b..f5bfee8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # EspHoMaTriX version 2 (EHMTXv2) -## This is a prerelease beta version! +## **This is a prerelease beta version** ## Important information @@ -28,7 +28,7 @@ But it had to be extensible, e.g. for the use as pool thermometer or as media pl ### Features -Based on a 8x32 RGB matrix, it displays a clock, the date and up to 24 other 'screens' provided by Home Assistant. Each screen (value/text) can be associated with a 8x8 bit RGB icon or GIF animation (see [installation](#installation)). The values/text can be updated or deleted from the display queue. Each screen has a lifetime, if not refreshed in its lifetime, it will disappear. Even 8x32 GIF animations are possible. You can control nearly everything of the component. +Based on a 8x32 RGB matrix, it displays a clock, the date and up to 24 other 'screens' provided by Home Assistant. Each screen (value/text) can be associated with a 8x8 bit RGB icon or GIF animation (see [installation](#installation-of-esphomatrixv2-custom-component). The values/text can be updated or deleted from the display queue. Each screen has a lifetime, if not refreshed in its lifetime, it will disappear. Even 8x32 GIF animations are possible. You can control nearly everything of the component. ### State @@ -596,7 +596,6 @@ sensor: id(rgb8x32)->icon_screen("sun", text); // uses default values for color etc. ``` - ##### Force screen Force the selected [icon_screen](#icon-screen) ```icon_name``` to be displayed next. Afterward the loop continues from this screen. e.g. helpful for alarms. Or after an update of the value/text. @@ -808,7 +807,6 @@ To control your display, it has to be integrated in Home Assistant. Then it prov All communication with Home Assistant use the homeasistant-api. The services can be provided by default or also defined additionally in the YAML. To define the additional services you need the id of the ehmtx-component e.g. ```id(rgb8x32)```. - ### Use in Home Assistant automations The easiest way to use ehmtx as a status display is to use the icon names as trigger id. In my example I have an icon named "wind" when the sensor.wind_speed has a new state, this automation sends the new data to the screen with the icon named "wind" and so on. @@ -977,7 +975,7 @@ sensor: ## Breaking changes -**nothing yet, since it is new** +### **nothing yet, since it is new** ## EspHoMaTriX in the media @@ -1013,6 +1011,7 @@ THE SOFTWARE IS PROVIDED "AS IS", use at your own risk! - **[darkpoet78](https://github.com/darkpoet78/MatrixClockFonts)** for his work on optimized fonts - **[pplucky](https://user-images.githubusercontent.com/16407309/224850723-634c9b2d-55d9-44f2-9f93-765c0485b090.GIF)** for his 8x32 GIF animation - **[dennisse](https://github.com/dennisse)** Auto brightness for the Ulanzi -- ** everbody that found bugs/issues and reported them! +- **[geekofweek](https://github.com/geekofweek)** fixed sample YAML +- **everbody** that found bugs/issues and reported them! ## Special thanks to all sponsors diff --git a/components/ehmtxv2/EHMTX.cpp b/components/ehmtxv2/EHMTX.cpp index 8ae8e08..45d77f6 100644 --- a/components/ehmtxv2/EHMTX.cpp +++ b/components/ehmtxv2/EHMTX.cpp @@ -554,6 +554,7 @@ namespace esphome } EHMTX_queue *screen = this->find_icon_queue_element(icon); screen->icon_name = iconname; + screen->icon = icon; screen->text = text; screen->endtime = this->clock->now().timestamp + lifetime * 60; screen->screen_time = screen_time; diff --git a/components/ehmtxv2/__init__.py b/components/ehmtxv2/__init__.py index 6d5bbe9..c97fb2b 100644 --- a/components/ehmtxv2/__init__.py +++ b/components/ehmtxv2/__init__.py @@ -179,51 +179,6 @@ EHMTX_SCHEMA = cv.Schema({ CONFIG_SCHEMA = cv.All(font.validate_pillow_installed, EHMTX_SCHEMA) -SET_COLOR_ACTION_SCHEMA = cv.Schema( - { - cv.GenerateID(): cv.use_id(EHMTX_), - cv.Optional(CONF_RED,default="80"): cv.templatable(cv.uint8_t), - cv.Optional(CONF_BLUE,default="80"): cv.templatable(cv.uint8_t), - cv.Optional(CONF_GREEN,default="80"): cv.templatable(cv.uint8_t), - } -) - -SetTodayColorAction = ehmtx_ns.class_("SetTodayColor", automation.Action) - -@automation.register_action( - "ehmtx.today.color", SetTodayColorAction, SET_COLOR_ACTION_SCHEMA -) -async def ehmtx_set_today_color_action_to_code(config, action_id, template_arg, args): - paren = await cg.get_variable(config[CONF_ID]) - - var = cg.new_Pvariable(action_id, template_arg, paren) - template_ = await cg.templatable(config[CONF_RED], args, cg.int_) - cg.add(var.set_red(template_)) - template_ = await cg.templatable(config[CONF_GREEN], args, cg.int_) - cg.add(var.set_green(template_)) - template_ = await cg.templatable(config[CONF_BLUE], args, cg.int_) - cg.add(var.set_blue(template_)) - return var - -SetWeekdayColorAction = ehmtx_ns.class_("SetWeekdayColor", automation.Action) - -@automation.register_action( - "ehmtx.weekday.color", SetWeekdayColorAction, SET_COLOR_ACTION_SCHEMA -) - -async def ehmtx_set_week_color_action_to_code(config, action_id, template_arg, args): - paren = await cg.get_variable(config[CONF_ID]) - - var = cg.new_Pvariable(action_id, template_arg, paren) - template_ = await cg.templatable(config[CONF_RED], args, cg.int_) - cg.add(var.set_red(template_)) - template_ = await cg.templatable(config[CONF_GREEN], args, cg.int_) - cg.add(var.set_green(template_)) - template_ = await cg.templatable(config[CONF_BLUE], args, cg.int_) - cg.add(var.set_blue(template_)) - - return var - CODEOWNERS = ["@lubeda"] async def to_code(config): diff --git a/copy2esphome/ulanzi-easy.yaml b/copy2esphome/ulanzi-easy.yaml index d8ebdc0..c0a0f7e 100644 --- a/copy2esphome/ulanzi-easy.yaml +++ b/copy2esphome/ulanzi-easy.yaml @@ -1,5 +1,5 @@ substitutions: - devicename: + devicename: ulanzi ledpin: GPIO32 buzzerpin: GPIO15 friendly_name: LED Matrix @@ -15,7 +15,8 @@ substitutions: scl_pin: GPIO22 sda_pin: GPIO21 -- platform: template +switch: + - platform: template name: "Auto-Adjust Brightness" id: switch_autobrightness icon: mdi:brightness-auto @@ -53,7 +54,7 @@ external_components: - source: type: git url: https://github.com/lubeda/EspHoMaTriXv2 - ref: release + ref: main refresh: 60s components: [ ehmtxv2 ] @@ -98,6 +99,7 @@ logger: level: WARN api: + services: - service: tune variables: tune: string @@ -249,7 +251,7 @@ ehmtxv2: url: https://user-images.githubusercontent.com/16407309/224850723-634c9b2d-55d9-44f2-9f93-765c0485b090.gif on_next_screen: - homeassistant.event: - event: ehmtxv2.new_screen + event: esphome.new_screen data_template: iconname: !lambda "return x.c_str();" text: !lambda "return y.c_str();" diff --git a/wiki/type1.jnx b/wiki/type1.jnx new file mode 100644 index 0000000..7ffcf6a Binary files /dev/null and b/wiki/type1.jnx differ diff --git a/wiki/type1.yaml b/wiki/type1.yaml new file mode 100644 index 0000000..b6e87ab --- /dev/null +++ b/wiki/type1.yaml @@ -0,0 +1,118 @@ +substitutions: + devicename: ehmtx8266 + ledpin: GPIO02 + +external_components: + - source: + type: local + path: ./EspHoMaTriXv2/components + refresh: 60s + +esphome: + name: $devicename + comment: 8x32 RGB Display in bedroom + +binary_sensor: + - platform: status + name: "$devicename Status" + +esp8266: + board: d1_mini + +font: + - file: EHMTXv2.ttf + id: default_font + size: 16 + glyphs: | + !"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz€@üöäÜÖÄß + +logger: + level: WARN + +# Enable Home Assistant API +api: + +ota: + password: !secret ota_password + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + +light: + - platform: neopixelbus + id: ehmtx_light + type: GRB + variant: WS2812 + pin: $ledpin + num_leds: 256 + color_correct: [30%, 30%, 30%] + name: "$devicename Light" + restore_mode: ALWAYS_OFF + effects: + - e131: + universe: 1 + channels: RGB + on_turn_on: + lambda: |- + id(ehmtx_display)->set_enabled(false); + on_turn_off: + lambda: |- + id(ehmtx_display)->set_enabled(true); + +e131: + method: multicast # default: register E1.31 to Multicast group + +time: + - platform: homeassistant + id: ehmtx_time + on_time: !include ehmtx_on_time.yaml + +display: + - platform: addressable_light + id: ehmtx_display + addressable_light_id: ehmtx_light + width: 32 + height: 8 + pixel_mapper: |- + if (x % 2 == 0) { + return (x * 8) + y; + } + return (x * 8) + (7 - y); + rotation: 0° + update_interval: 16ms + auto_clear_enabled: true + lambda: |- + id(rgb8x32)->tick(); + id(rgb8x32)->draw(); + +ehmtxv2: + id: rgb8x32 + show_seconds: true + rainbow_interval: 32 + matrix_component: ehmtx_display + time_component: ehmtx_time + icons2html: true + default_font_id: default_font + special_font_id: default_font + special_font_yoffset: 6 + default_font_yoffset: 6 + icons: + - id: xani + lameid: 6075 + - id: xsta + lameid: 11236 + - url: https://developer.lametric.com/content/apps/icon_thumbs/48720.gif + pingpong: true + id: pipo + frame_duration: 300 + - lameid: 5965 + frame_duration: 180 + id: d180 + - lameid: 5965 + frame_duration: 80 + id: d080 + - id: fullscreen + file: sample8x32.gif + - id: samplegif + file: sample8x8.gif diff --git a/wiki/ulanzi.jnx b/wiki/ulanzi.jnx new file mode 100644 index 0000000..143e7fb Binary files /dev/null and b/wiki/ulanzi.jnx differ