Giter Site home page Giter Site logo

markusressel / esphome-analog-clock Goto Github PK

View Code? Open in Web Editor NEW
29.0 4.0 5.0 52 KB

ESPHome configuration example to create an animated clock using the Neopixel 60 LED ring

License: Creative Commons Zero v1.0 Universal

C++ 100.00%
clock esphome led-ring led-ring-clock neopixel-ring

esphome-analog-clock's Introduction

ESPHome-Analog-Clock

ESPHome configuration example to create an animated clock using the Neopixel 60 LED ring.

Demo VIdeo

Features

  • "Loading" animation while initializing
  • Works with (almost) any LED strip length
  • Fading animations for all hands when switching
  • Slowly fading tail behind the second hand
  • Overlapping (additive) hand colors
  • Settings
    • Disable second hand
    • Show hour indicators

How to use

  • Create a new ESPHome configuration YAML file
  • Customize the basic device cnfiguration (Board, WiFi, etc.) to your liking
  • Add the contents of esphome_neopixel_clock_effect.yaml to the file
  • Customize the fields in the substitutions part at the top
  • Deploy and enjoy!

Watchface

The provided Watchface.svg perfectly fits on the 60 LED NeoPixel ring. You can print this, cut it out and simply glue/tape it to the ring to create the look visible in the video above.

Contributing

GitHub is for social coding: if you want to write code, I encourage contributions through pull requests from forks of this repository. Create GitHub tickets for bugs and new features and comment on the ones that you are interested in.

License

CC0 see LICENSE

esphome-analog-clock's People

Contributors

dependabot[bot] avatar markusressel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

esphome-analog-clock's Issues

Minute and second hands fixed on 12

Hi, I just installed your configuration on my clock, with and ESP32, a 24 led ring and a 4digit 7 segment tm1637. It was previously running with an Arduino sketch. But there were often problems on ntp update. So I added to your configuration only the display tm1637. I changed the board and the led numbers.
Now it works, but the minute led and second led are fixed on first led.
Can you help me please?
Tanks in advance
Andrea

Parameter to adjust starting LED

FEATURE REQUEST:

Firstly, thanks for the project. I've been using Tasmota then WLED and now ESPHome for this use case. I really like leveraging the extensibility of ESPHome to have temp/humidity and bluetooth proxy on the same board...

One thing I haven't figured out yet is how to adjust the starting LED for the clock - essentially shifting the 12 o'clock around the clock so it can adjust to my specific mounting position. I have my 12 o'clock in the middle of the strip (LED 30) as I wanted the 30 minute location to be where my power cable comes out so it comes out the bottom without impacting the LED strip.

I'm having a play around with the code myself but thought I'd raise it as a useful feature to have under the "globals" section. Will let you know if I figure this out or need some guidance. I'm thinking of some sort of time adjustment based on the pin which is entered...see how it goes...

ESPColor is deprecated

When compiling this example, I get al lot of warnings of ESPColor being deprecated, like:
warning: 'using ESPColor = struct esphome::Color' is deprecated: esphome::light::ESPColor is deprecated, use esphome::Color instead.
Have no idea how to edit the code to repair this. Anyone any clue how to do this? Appreciated!

INFO Reading configuration /config/esphome/wemos_7219_8x7_led_01.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing 7219-8x7-led (board: d1_mini; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|-- <ESPAsyncWebServer-esphome> 2.1.0
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <DNSServer> 1.1.1
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|-- <AsyncMqttClient-esphome> 0.8.6
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|-- <SPI> 1.0
|-- <ArduinoJson> 6.18.5
|-- <NeoPixelBus> 2.6.9
|   |-- <SPI> 1.0
Compiling /data/7219-8x7-led/.pioenvs/7219-8x7-led/src/main.cpp.o
/config/esphome/wemos_7219_8x7_led_01.yaml: In lambda function:
/config/esphome/wemos_7219_8x7_led_01.yaml:149:44: warning: 'using ESPColor = struct esphome::Color' is deprecated: esphome::light::ESPColor is deprecated, use esphome::Color instead. [-Wdeprecated-declarations]
  149 |             static ESPColor clock_ring_colors [60];
      |                                            ^
In file included from src/esphome.h:27,
                 from src/main.cpp:3:
src/esphome/components/light/addressable_light.h:20:7: note: declared here
   20 | using ESPColor ESPDEPRECATED("esphome::light::ESPColor is deprecated, use esphome::Color instead.", "v1.21") = Color;
      |       ^~~~~~~~
/config/esphome/wemos_7219_8x7_led_01.yaml:151:61: warning: 'using ESPColor = struct esphome::Color' is deprecated: esphome::light::ESPColor is deprecated, use esphome::Color instead. [-Wdeprecated-declarations]
  151 |               std::fill_n(clock_ring_colors, it.size(), ESPColor::BLACK);
      |                                                             ^~~~~
In file included from src/esphome.h:27,
                 from src/main.cpp:3:
src/esphome/components/light/addressable_light.h:20:7: note: declared here
   20 | using ESPColor ESPDEPRECATED("esphome::light::ESPColor is deprecated, use esphome::Color instead.", "v1.21") = Color;
      |       ^~~~~~~~
/config/esphome/wemos_7219_8x7_led_01.yaml:168:18: warning: 'using ESPColor = struct esphome::Color' is deprecated: esphome::light::ESPColor is deprecated, use esphome::Color instead. [-Wdeprecated-declarations]
  168 |               ESPColor old_color = clock_ring_colors[i];
      |                  ^~~~~~~~~
In file included from src/esphome.h:27,
                 from src/main.cpp:3:
src/esphome/components/light/addressable_light.h:20:7: note: declared here
   20 | using ESPColor ESPDEPRECATED("esphome::light::ESPColor is deprecated, use esphome::Color instead.", "v1.21") = Color;
      |       ^~~~~~~~
/config/esphome/wemos_7219_8x7_led_01.yaml:180:18: warning: 'using ESPColor = struct esphome::Color' is deprecated: esphome::light::ESPColor is deprecated, use esphome::Color instead. [-Wdeprecated-declarations]
  180 |               ESPColor new_color = ESPColor(red, green, blue, 0);
      |                  ^~~~~~~~~
In file included from src/esphome.h:27,
                 from src/main.cpp:3:
src/esphome/components/light/addressable_light.h:20:7: note: declared here
   20 | using ESPColor ESPDEPRECATED("esphome::light::ESPColor is deprecated, use esphome::Color instead.", "v1.21") = Color;
      |       ^~~~~~~~
/config/esphome/wemos_7219_8x7_led_01.yaml:186:16: warning: 'using ESPColor = struct esphome::Color' is deprecated: esphome::light::ESPColor is deprecated, use esphome::Color instead. [-Wdeprecated-declarations]
  186 |             ESPColor indicator_color = ESPColor(indicator_brightness, indicator_brightness, indicator_brightness);
      |                ^~~~~~~~~~~~~~~
In file included from src/esphome.h:27,
                 from src/main.cpp:3:
src/esphome/components/light/addressable_light.h:20:7: note: declared here
   20 | using ESPColor ESPDEPRECATED("esphome::light::ESPColor is deprecated, use esphome::Color instead.", "v1.21") = Color;
      |       ^~~~~~~~
/config/esphome/wemos_7219_8x7_led_01.yaml:189:16: warning: 'using ESPColor = struct esphome::Color' is deprecated: esphome::light::ESPColor is deprecated, use esphome::Color instead. [-Wdeprecated-declarations]
  189 |             ESPColor second_color = ESPColor(0, 0, id(clock_brightness));
      |                ^~~~~~~~~~~~
In file included from src/esphome.h:27,
                 from src/main.cpp:3:
src/esphome/components/light/addressable_light.h:20:7: note: declared here
   20 | using ESPColor ESPDEPRECATED("esphome::light::ESPColor is deprecated, use esphome::Color instead.", "v1.21") = Color;
      |       ^~~~~~~~
/config/esphome/wemos_7219_8x7_led_01.yaml:191:16: warning: 'using ESPColor = struct esphome::Color' is deprecated: esphome::light::ESPColor is deprecated, use esphome::Color instead. [-Wdeprecated-declarations]
  191 |             ESPColor minute_color = ESPColor(0, id(clock_brightness), 0);
      |                ^~~~~~~~~~~~
In file included from src/esphome.h:27,
                 from src/main.cpp:3:
src/esphome/components/light/addressable_light.h:20:7: note: declared here
   20 | using ESPColor ESPDEPRECATED("esphome::light::ESPColor is deprecated, use esphome::Color instead.", "v1.21") = Color;
      |       ^~~~~~~~
/config/esphome/wemos_7219_8x7_led_01.yaml:196:16: warning: 'using ESPColor = struct esphome::Color' is deprecated: esphome::light::ESPColor is deprecated, use esphome::Color instead. [-Wdeprecated-declarations]
  196 |             ESPColor hour_color = ESPColor(id(clock_brightness), 0, 0);
      |                ^~~~~~~~~~
In file included from src/esphome.h:27,
                 from src/main.cpp:3:
src/esphome/components/light/addressable_light.h:20:7: note: declared here
   20 | using ESPColor ESPDEPRECATED("esphome::light::ESPColor is deprecated, use esphome::Color instead.", "v1.21") = Color;
      |       ^~~~~~~~
Linking /data/7219-8x7-led/.pioenvs/7219-8x7-led/firmware.elf
RAM:   [====      ]  43.6% (used 35708 bytes from 81920 bytes)
Flash: [=====     ]  49.3% (used 514489 bytes from 1044464 bytes)
Building /data/7219-8x7-led/.pioenvs/7219-8x7-led/firmware.bin
esp8266_copy_factory_bin(["/data/7219-8x7-led/.pioenvs/7219-8x7-led/firmware.bin"], ["/data/7219-8x7-led/.pioenvs/7219-8x7-led/firmware.elf"])
========================= [SUCCESS] Took 12.73 seconds =========================
INFO Successfully compiled program.

Reported by @jpduhen

Adapt this code for rectangular shape

Hi Mark,

I have in the livingroom (rectangular shape) along the ceiling a WS2812 LED-Strip running with an NodeMCU ESP8266 and ESPHome.
Using your code in generel works. But oviously in my case not as perfect.

Do you have an idea how I could rewrite the code that it would fit my usecase ?

Example Layout:

  • 100 leds at the front
  • 50 leds on the right side
  • 100 leds on the back
  • 50 leds on the left

300 leds in total.

Additionally I have the starting point in a corner. Any chance I can offset it by x led counts ?

Looking forward to hear from you :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.