Hi i have installed a WLED strip over the garage door. Now i will make visualize the Battery stand from my two e cars. The Strip have 300 LED´s an i want make the left 150 LED for the left car and the right 150 LED for the battery stand from the right car. Now i want make a script. I have a lot home automation tools installed. (Home Assitant, Openhab, IO Broker), but i don´t understand how i can send the battery level to the strip. Also i must put together the 2 Level in the syntax before i send it to to WLED controller. I think also the best way is that i change the colors from the segments in red if the battery level from the car is > 20 % and in green if the battery stand is < 20 %. Can everybody give me a idea for relize this. Thank a lot !
We were testing in HA for something like that , might give you hints , look at posts starting here ( and few below it ) Discord
Why at all did you use WLED @Maddin2024 this is a simple Ardino projekt
you can get data from your car via BT WLAN or cable as well as from the Wallmount Power Station
direct into the controller and make your display LED you want Node by Node
Hi thank you for the answer. Sure i can use a arduino for this but i also want use the other Features from WLED with the installed Strip. It is possible with a Script and i send the right code over mqtt to the Wled Controller ? Have anybody a good example for me for this ? Thank all for help
Right code with mqtt ?!! have you looked at the link on discord?
{“seg”:[{“id”:0,“fx”:98,“ix”:1}]} for 1 percent
{“seg”:[{“id”:0,“fx”:98,“ix”:100}]} for 100 percent
thanks and what is the right code if i want from my first 20 LED from my 150 LED in red then 30 in orange and the last 100 in green. The best as a transiton from the one color to the other color. thanks for help !
You can do that in multiple ways but the easiest might be to create a segment for each and then use the segment id so “id”:0 , “id”:1 …etc
ok thanks, i will try it. Now i have this Syntax and it works
{seg:{i:[0,3,“FF0342”,3,8,“FFC524”,8,16,“00FF33”]}} but how can i this combine with the precent. I have try some syntax but it don´t work
{seg:{i:[0,3,“FF0342”,4,8,“FFC524”,8,16,“00FF33”],fx:98,ix:10}} don´t work
The progress bar example was meant to be just an example if you wanted the number of leds to reflect the battery status . Since you only want to change the color then no need to include fx:98,ix:10
. Just use three segments and change the color based on your battery status
Thanks for the fast answer. But if i want to use the progress bar how i can selcted the right colors (green,orange,red) In the web interface i can change this with the color platte 1& 2 with but how i can send it with MQTT Syntax.
This how to change the color with “col” from mqtt
Im sorry to hijack other topic, but im making a similar project
i got two battery bank enclosures that are the same voltage, and want to display
- battery percentage depending on battery SOC %
- charge or discharge animation (done by lighting 3 steps down, and reverse again or 3 steps up and reverse again)
- colour of the LED depending on SOC %
well i kinda achieved it by making a like 30 presets with Progress bar
making a template sensor in HA
making a 1 second automation and it works.
here’s a package code.
wled:
sensor:
- platform: template
sensors:
wled_preset_based_on_charge:
friendly_name: "WLED Preset Based on Charge"
value_template: >
{% set charge = states('sensor.deye_sunsynk_sol_ark_x_3_battery_state_of_charge') | int %}
{% if charge <= 2 %}
0per
{% elif charge <= 4 %}
2per
{% elif charge <= 6 %}
4per
{% elif charge <= 8 %}
6per
{% elif charge <= 10 %}
8per
{% elif charge <= 13 %}
10per
{% elif charge <= 15 %}
13per
{% elif charge <= 18 %}
15per
{% elif charge <= 20 %}
18per
{% elif charge <= 25 %}
20per
{% elif charge <= 28 %}
25per
{% elif charge <= 30 %}
28per
{% elif charge <= 33 %}
30per
{% elif charge <= 37 %}
33per
{% elif charge <= 40 %}
37per
{% elif charge <= 43 %}
40per
{% elif charge <= 45 %}
43per
{% elif charge <= 48 %}
45per
{% elif charge <= 50 %}
48per
{% elif charge <= 53 %}
50per
{% elif charge <= 56 %}
53per
{% elif charge <= 60 %}
56per
{% elif charge <= 63 %}
60per
{% elif charge <= 66 %}
63per
{% elif charge <= 70 %}
66per
{% elif charge <= 73 %}
70per
{% elif charge <= 77 %}
73per
{% elif charge <= 80 %}
77per
{% elif charge <= 85 %}
80per
{% elif charge <= 87 %}
85per
{% elif charge <= 90 %}
87per
{% elif charge <= 93 %}
90per
{% elif charge <= 95 %}
93per
{% elif charge <= 97 %}
95per
{% else %}
100per
{% endif %}
bms_total_error:
friendly_name: "BMS Total Error"
value_template: >
{% set errors = [
states('sensor.bms0_errors'),
states('sensor.bms1_errors'),
states('sensor.bms2_errors'),
states('sensor.bms3_errors'),
states('sensor.bms4_errors'),
states('sensor.bms5_errors'),
states('sensor.bms6_errors'),
states('sensor.bms7_errors')
] %}
{% set filtered_errors = errors | select('!=', '0') | select('!=', 'unknown') | select('!=', 'unavailable') | select('!=', '') | list %}
{{ filtered_errors | length > 0 }}
automation:
- alias: "Cycle WLED Preset Based on Battery Charging/Discharging with Error Handling and Toggle"
trigger:
- platform: time_pattern
seconds: "/1"
action:
- choose:
- conditions:
- condition: state
entity_id: sensor.bms_total_error
state: "True"
sequence:
- service: select.select_option
target:
entity_id: select.wled_preset
data:
option: "error"
default:
- service: select.select_option
target:
entity_id: select.wled_preset
data:
option: >
{% set charge = states('sensor.deye_sunsynk_sol_ark_x_3_battery_state_of_charge') | int %}
{% set power = states('sensor.deye_sunsynk_sol_ark_x_3_battery_power') | float %}
{% set presets = ['0per', '2per', '4per', '6per', '8per', '10per', '13per', '15per', '18per', '20per', '25per', '28per', '30per', '33per', '37per', '40per', '43per', '45per', '48per', '50per', '53per', '56per', '60per', '63per', '66per', '70per', '73per', '77per', '80per', '85per', '87per', '90per', '93per', '95per', '97per', '100per'] %}
{% set index = (presets | map('regex_replace', 'per', '') | map('int') | select('le', charge) | list | length) - 1 %}
{% set lower_preset = presets[index if index >= 0 else 0] %}
{% set middle_preset = presets[(index + 1) if (index + 1) < presets | length else index] %}
{% set upper_preset = presets[(index + 2) if (index + 2) < presets | length else index + 1 if index + 1 < presets | length else index] %}
{% set current_preset = states('select.wled_preset') %}
{% if power > 0 %}
{% if current_preset == lower_preset %}
{{ middle_preset }}
{% elif current_preset == middle_preset %}
{{ upper_preset }}
{% else %}
{{ lower_preset }}
{% endif %}
{% else %}
{% if current_preset == upper_preset %}
{{ middle_preset }}
{% elif current_preset == middle_preset %}
{{ lower_preset }}
{% else %}
{{ upper_preset }}
{% endif %}
{% endif %}
- alias: "Turn Off WLED Automation When Battery WLED Is Off"
trigger:
- platform: state
entity_id: input_boolean.battery_wled
to: "off"
action:
- service: select.select_option
target:
entity_id: select.wled_preset
data:
option: "off"
- service: homeassistant.turn_off
target:
entity_id: automation.cycle_wled_preset_based_on_battery_charging_discharging_with_error_handling_and_toggle
- alias: "Turn On WLED Automation When Battery WLED Is On"
trigger:
- platform: state
entity_id: input_boolean.battery_wled
to: "on"
action:
- service: homeassistant.turn_on
target:
entity_id: automation.cycle_wled_preset_based_on_battery_charging_discharging_with_error_handling_and_toggle
But i have a feeling that there should be an easier way.
I know i can do arduino, but i never did so that is not an option now