Hello
Can ESPeasy show a battery gauge on a Neopixel ring ?
Can this be done by a Rule ?
I want to read a 0-100 (%) Value using MQTT_Import and visualize the Value with a Neopixel Ring on e.g. 40 LEDs with coloring from red (low battery) over yellow (medium charge) to green (nearly full / full charge)
Is this possible with espEasy ?
Greetings Chris
Neopixel Battery Gauge ?
Moderators: grovkillen, Stuntteam, TD-er
Re: Neopixel Battery Gauge ?
We do support some battery gauge chips, like these: https://espeasy.readthedocs.io/en/lates ... 5-typename
So using rules, you should be able to turn it into a NeoPixel command to update the number of LEDs on your ring and also set the color if you like.
So using rules, you should be able to turn it into a NeoPixel command to update the number of LEDs on your ring and also set the color if you like.
Re: Neopixel Battery Gauge ?
Ah, i saw this feature,
But I want to monitor my PV Battery. Its a 9,6 KWh Battery system. The Inverter reports a value 0 - 100 via Modbus to my MQTT Broker.
I think, its not as easy zu visualize / scale this value on a Neopixel Ring.
But I want to monitor my PV Battery. Its a 9,6 KWh Battery system. The Inverter reports a value 0 - 100 via Modbus to my MQTT Broker.
I think, its not as easy zu visualize / scale this value on a Neopixel Ring.
Re: Neopixel Battery Gauge ?
You can configure the MQTT Import plugin (name: MQTTImport) to receive that value, and name that value BatteryPercentage, enable that task and add this to the rules:
This assumes you have the NeoPixel (Basic) plugin configured and enabled, so these commands can work.
You can determine the max. brightness using the plugin settings. This may alter the actual color unexpectedly if the brightness is (very) low, as it uses integer division to calculate a new value per color.
NB: Air code
Code: Select all
on MQTTImport#BatteryPercentage do
let,1,40 // Number of LEDs
let,2,%eventvalue1%/(100/%v1%) // Number of LEDs to light up
if %eventvalue1%<15
NeoPixelLine,1,[int#2],255,0,0 // Red
elseif %eventvalue1%<85
NeoPixelLine,1,[int#2],255,127,80 // Orange (coral)
else
NeoPixelLine,1,[int#2],0,255,0 // Green
endif
endon
You can determine the max. brightness using the plugin settings. This may alter the actual color unexpectedly if the brightness is (very) low, as it uses integer division to calculate a new value per color.
NB: Air code
/Ton (PayPal.me)
Re: Neopixel Battery Gauge ?
Thanks
I had to add some lines, to clear the LEDs.
Otherwise the "consumed LEDs" keep on.
on MQTT_W#PV_CAP_BAT do
let,1,24 // Number of LEDs
let,2,%eventvalue1%/(100/%v1%) // Number of LEDs to light up
if %eventvalue1%<25
NeoPixelLine,[int#2]+1,25,0,0,0 // clear/poweroff consumed LEDs
NeoPixelLine,1,[int#2],100,0,0
elseif %eventvalue1%<85
NeoPixelLine,[int#2]+1,25,0,0,0 // clear/poweroff consumed LEDs
NeoPixelLine,1,[int#2],58,74,0
else
NeoPixelLine,[int#2]+1,25,0,0,0 // clear/poweroff consumed LEDs
NeoPixelLine,1,[int#2],0,100,0
endif
endon
I had to add some lines, to clear the LEDs.
Otherwise the "consumed LEDs" keep on.
on MQTT_W#PV_CAP_BAT do
let,1,24 // Number of LEDs
let,2,%eventvalue1%/(100/%v1%) // Number of LEDs to light up
if %eventvalue1%<25
NeoPixelLine,[int#2]+1,25,0,0,0 // clear/poweroff consumed LEDs
NeoPixelLine,1,[int#2],100,0,0
elseif %eventvalue1%<85
NeoPixelLine,[int#2]+1,25,0,0,0 // clear/poweroff consumed LEDs
NeoPixelLine,1,[int#2],58,74,0
else
NeoPixelLine,[int#2]+1,25,0,0,0 // clear/poweroff consumed LEDs
NeoPixelLine,1,[int#2],0,100,0
endif
endon
Re: Neopixel Battery Gauge ?
Ah, yes, didn't think of that
A few minor corrections:
Code: Select all
on MQTT_W#PV_CAP_BAT do
let,1,24 // Number of LEDs
let,2,%eventvalue1%/(100/%v1%) // Number of LEDs to light up
if %eventvalue1%<25
NeoPixelLine,[int#2]+1,[int#1],0,0,0 // clear/poweroff consumed LEDs
NeoPixelLine,1,[int#2],100,0,0
elseif %eventvalue1%<85
NeoPixelLine,[int#2]+1,[int#1],0,0,0 // clear/poweroff consumed LEDs
NeoPixelLine,1,[int#2],58,74,0
else
NeoPixelLine,[int#2]+1,[int#1],0,0,0 // clear/poweroff consumed LEDs
NeoPixelLine,1,[int#2],0,100,0
endif
endon
/Ton (PayPal.me)
Who is online
Users browsing this forum: No registered users and 2 guests