├── Code ESPHome.yaml ├── Code Native Automation.yaml ├── Code input_number ├── Node_Red_Flow.json └── README.md /Code ESPHome.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: 6candles 3 | 4 | esp8266: 5 | board: d1_mini 6 | 7 | wifi: 8 | ssid: !secret wifi_ssid 9 | password: !secret wifi_password 10 | fast_connect: true 11 | 12 | # Enable logging 13 | logger: 14 | 15 | substitutions: 16 | alpha: 90% 17 | intensity: 5% 18 | default_transition_length: 0s 19 | frequency: 1000 Hz 20 | 21 | # Enable Home Assistant API 22 | api: 23 | 24 | ota: 25 | platform: esphome 26 | 27 | light: 28 | - platform: monochromatic 29 | name: "Candle 1" 30 | id: candle_1 31 | output: candle_1_pwm 32 | default_transition_length: ${default_transition_length} 33 | effects: 34 | - flicker: 35 | name: Flicker 36 | alpha: ${alpha} 37 | intensity: ${intensity} 38 | - platform: monochromatic 39 | name: "Candle 2" 40 | id: candle_2 41 | output: candle_2_pwm 42 | default_transition_length: ${default_transition_length} 43 | effects: 44 | - flicker: 45 | name: Flicker 46 | alpha: ${alpha} 47 | intensity: ${intensity} 48 | - platform: monochromatic 49 | name: "Candle 3" 50 | id: candle_3 51 | output: candle_3_pwm 52 | default_transition_length: ${default_transition_length} 53 | effects: 54 | - flicker: 55 | name: Flicker 56 | alpha: ${alpha} 57 | intensity: ${intensity} 58 | - platform: monochromatic 59 | name: "Candle 4" 60 | id: candle_4 61 | output: candle_4_pwm 62 | default_transition_length: ${default_transition_length} 63 | effects: 64 | - flicker: 65 | name: Flicker 66 | alpha: ${alpha} 67 | intensity: ${intensity} 68 | - platform: monochromatic 69 | name: "Candle 5" 70 | id: candle_5 71 | output: candle_5_pwm 72 | default_transition_length: ${default_transition_length} 73 | effects: 74 | - flicker: 75 | name: Flicker 76 | alpha: ${alpha} 77 | intensity: ${intensity} 78 | - platform: monochromatic 79 | name: "Candle 6" 80 | id: candle_6 81 | output: candle_6_pwm 82 | default_transition_length: ${default_transition_length} 83 | effects: 84 | - flicker: 85 | name: Flicker 86 | alpha: ${alpha} 87 | intensity: ${intensity} 88 | 89 | output: 90 | - platform: esp8266_pwm 91 | id: candle_1_pwm 92 | pin: D1 93 | frequency: $frequency 94 | - platform: esp8266_pwm 95 | id: candle_2_pwm 96 | pin: D2 97 | frequency: $frequency 98 | - platform: esp8266_pwm 99 | id: candle_3_pwm 100 | pin: D3 101 | frequency: $frequency 102 | - platform: esp8266_pwm 103 | id: candle_4_pwm 104 | pin: D5 105 | frequency: $frequency 106 | - platform: esp8266_pwm 107 | id: candle_5_pwm 108 | pin: D6 109 | frequency: $frequency 110 | - platform: esp8266_pwm 111 | id: candle_6_pwm 112 | pin: D7 113 | frequency: $frequency 114 | -------------------------------------------------------------------------------- /Code Native Automation.yaml: -------------------------------------------------------------------------------- 1 | - alias: candle_tester 2 | trigger: 3 | platform: state 4 | entity_id: input_number.candles 5 | 6 | action: 7 | - service: light.turn_on 8 | data_template: 9 | entity_id: 10 | - light.candle_1 11 | - light.candle_2 12 | # Add your other Candles here 13 | brightness_pct: "{{trigger.to_state.state}}" 14 | transition: 1 15 | effect: flicker 16 | -------------------------------------------------------------------------------- /Code input_number: -------------------------------------------------------------------------------- 1 | candles: 2 | name: Candles 3 | initial: 0 4 | min: 0 5 | max: 100 6 | step: 10 7 | mode: slider 8 | -------------------------------------------------------------------------------- /Node_Red_Flow.json: -------------------------------------------------------------------------------- 1 | [{"id":"1b6a67e1.452c78","type":"tab","label":"For Dale","disabled":false,"info":""},{"id":"5339437c.bbfc4c","type":"server-state-changed","z":"1b6a67e1.452c78","name":"Candle Slider","server":"d9f5cae2.ae6b18","version":1,"entityidfilter":"input_number.candles","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":400,"y":310,"wires":[["d5dc113b.48472"]],"outputLabels":["ON"]},{"id":"d5dc113b.48472","type":"function","z":"1b6a67e1.452c78","name":"B%/E","func":"if (msg.payload > \"0\")\nmsg.payload =\n{\n \"service\": \"turn_on\",\n data:\n {\"brightness_pct\": msg.payload, \"effect\":\"flicker\"}\n};\n\nif (msg.payload < \"1\") msg.payload = {\"service\":\"turn_off\"}\nreturn msg\n","outputs":1,"noerr":0,"x":540,"y":310,"wires":[["152f60bf.512c4f","50725d41.91f294","62c91a4f.c540f4","5381d8c3.218b38","d844edd2.402ae","1fb4ad29.c40723"]]},{"id":"152f60bf.512c4f","type":"delay","z":"1b6a67e1.452c78","name":"Rand","pauseType":"random","timeout":"0.5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"2","randomUnits":"seconds","drop":true,"x":710,"y":190,"wires":[["36e5dde2.f517e2"]]},{"id":"50725d41.91f294","type":"delay","z":"1b6a67e1.452c78","name":"Rand","pauseType":"random","timeout":"0.5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"2","randomUnits":"seconds","drop":true,"x":710,"y":240,"wires":[["bd772728.8f0f58"]]},{"id":"62c91a4f.c540f4","type":"delay","z":"1b6a67e1.452c78","name":"Rand","pauseType":"random","timeout":"0.5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"2","randomUnits":"seconds","drop":true,"x":710,"y":290,"wires":[["33d1ed71.52d2c2"]]},{"id":"5381d8c3.218b38","type":"delay","z":"1b6a67e1.452c78","name":"Rand","pauseType":"random","timeout":"0.5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"2","randomUnits":"seconds","drop":true,"x":710,"y":340,"wires":[["b8bfe06c.7a1af"]]},{"id":"d844edd2.402ae","type":"delay","z":"1b6a67e1.452c78","name":"Rand","pauseType":"random","timeout":"0.5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"2","randomUnits":"seconds","drop":true,"x":710,"y":390,"wires":[["e35eead0.7de5b8"]]},{"id":"1fb4ad29.c40723","type":"delay","z":"1b6a67e1.452c78","name":"Rand","pauseType":"random","timeout":"0.5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"2","randomUnits":"seconds","drop":true,"x":710,"y":440,"wires":[["51556816.174958"]]},{"id":"36e5dde2.f517e2","type":"api-call-service","z":"1b6a67e1.452c78","name":"Candle 1","server":"d9f5cae2.ae6b18","version":1,"service_domain":"light","service":"","entityId":"light.candle_1, light.win_candle_1, light.back_candle_1","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":840,"y":190,"wires":[[]]},{"id":"bd772728.8f0f58","type":"api-call-service","z":"1b6a67e1.452c78","name":"Candle 2","server":"d9f5cae2.ae6b18","version":1,"service_domain":"light","service":"","entityId":"light.candle_2, light.win_candle_2, light.back_candle_2","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":840,"y":240,"wires":[[]]},{"id":"33d1ed71.52d2c2","type":"api-call-service","z":"1b6a67e1.452c78","name":"Candle 3","server":"d9f5cae2.ae6b18","version":1,"service_domain":"light","service":"","entityId":"light.candle_3, light.win_candle_3, light.back_candle_3","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":840,"y":290,"wires":[[]]},{"id":"b8bfe06c.7a1af","type":"api-call-service","z":"1b6a67e1.452c78","name":"Candle 4","server":"d9f5cae2.ae6b18","version":1,"service_domain":"light","service":"","entityId":"light.candle_4, light.win_candle_4, light.back_candle_4","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":840,"y":340,"wires":[[]]},{"id":"e35eead0.7de5b8","type":"api-call-service","z":"1b6a67e1.452c78","name":"Candle 5","server":"d9f5cae2.ae6b18","version":1,"service_domain":"light","service":"","entityId":"light.candle_5, light.win_candle_5, light.back_candle_5","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":840,"y":390,"wires":[[]]},{"id":"51556816.174958","type":"api-call-service","z":"1b6a67e1.452c78","name":"Candle 6","server":"d9f5cae2.ae6b18","version":1,"service_domain":"light","service":"","entityId":"light.candle_6, light.win_candle_6, light.back_candle_6","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":840,"y":440,"wires":[[]]},{"id":"d9f5cae2.ae6b18","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 'Smart' Candles Project 2 | Converting Battery operated LED Candles to run in Home Assistant 3 | 4 | Grab all the 'YAML' files listed above: 5 | 6 | > - Code ESPHome.yaml 7 | > - Code Native Automation.yaml 8 | > - Code input_number 9 | > - Node_Red_Flow.json 10 | 11 | 12 | # Parts List UK: 13 | 14 | - Candles (pack of 6) https://amzn.to/2PS58rl 15 | - Candles (pack of 12) https://amzn.to/2vplBLC 16 | - Red & Black Wire https://amzn.to/2ZkN2Ry 17 | - 2 Pin JST Connectors https://amzn.to/2Zkpqg6 18 | - D1 Mini https://amzn.to/2Q5I9sq 19 | - Mobile Phone charger https://amzn.to/34Rw66k 20 | - USB Cable https://amzn.to/35RR46F 21 | 22 | # Parts List US: 23 | - Candles (pack of 6) https://amzn.to/335m4Q3 24 | - Candles (pack of 12) https://amzn.to/38AOjXS 25 | - Red & Black Wire https://amzn.to/2U8sB8D 26 | - 2 Pin JST Connectors https://amzn.to/2IEa1Qh 27 | - D1 Mini https://amzn.to/38FtxGD 28 | - Mobile Phone charger https://amzn.to/2vNNaz0 29 | - USB Cable https://amzn.to/38HJHiA 30 | > 💡 **Note:** As an Amazon Associate I earn from qualifying purchases. Using these links provides small monetary support for my channel at no extra cost to you. 💖 31 | # Watch the step-by-step build guide here: https://youtu.be/OHwBA27FR9c 32 | 33 | --- 34 | ### 🤝 Found this useful, want to say 'Thanks' and support my efforts. CHEERS🍺 35 | | Buy me a Coffee | PATREON | 36 | |-----------------|---------| 37 | | [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-donate-yellow.svg?style=flat-square&logo=buy-me-a-coffee)](https://www.buymeacoffee.com/3ative) | [![Patreon](https://img.shields.io/badge/Patreon-support-red.svg?style=flat-square&logo=patreon)](https://www.patreon.com/3ative) | 38 | --- 39 | --------------------------------------------------------------------------------