Comments (15)
Based on the first example I made this berry script to display relay state on two leds and energy level on the other two
var power = int(tasmota.get_power()[0])
#Index myLeds1 & 2 via Gpio 25,26, Berry index is 0 and 1
myLeds1 = Leds(2,gpio.pin(gpio.WS2812, 0))
myLeds2 = Leds(2,gpio.pin(gpio.WS2812, 1))
def leds_onoff(value, trigger)
power = value
if value == 1
myLeds1.set_pixel_color(0,0x00CC00)
myLeds1.set_pixel_color(1,0x00CC00)
end
if value == 0
myLeds1.set_pixel_color(0,0xCC0000)
myLeds1.set_pixel_color(1,0xCC0000)
myLeds2.set_pixel_color(0,0x000000)
myLeds2.set_pixel_color(1,0x000000)
myLeds2.show()
end
myLeds1.show()
end
tasmota.add_rule("Power1#state", leds_onoff)
tasmota.add_rule("Power1#boot", leds_onoff)
def leds_energy(value, trigger)
var ledcol = 0
if power == 1
var maxpower = 2500.0
var currentw = maxpower
if value < maxpower
currentw = value
end
var red = int(currentw * 255.0 / maxpower)
var green = int(255 - red)
ledcol = (red << 16) + (green << 8)
end
myLeds2.set_pixel_color(0,ledcol)
myLeds2.set_pixel_color(1,ledcol)
myLeds2.show()
end
tasmota.add_rule("Energy#Power", leds_energy)
As above saved as autoexec.be
from templates.
what the hell is a berry script or autoexec.be?
from templates.
https://tasmota.github.io/docs/Berry/
https://tasmota.github.io/docs/UFS/#autoexecbe
from templates.
The second script from MASHtm is great.
But when you turn it off, only one side of the LED ring lights up.
When switched on, the entire ring lights up green Super ^^
Can you adjust the config so that the red LEDs also completely illuminate the ring?
Problem:
"The problem is the red LEDs, they don't illuminate the entire ring of Shelly."
The green LED ring lights up completely with a delay!
Why is that?
Do you have an idea ?
Thank you ^^
from templates.
One half of "the ring"... basically two of the four LEDs show the power consumption. 0W is green ..orange .. 2500W is red. This is also the reason for the delay because the color is only updated when the event handler is called.
Since only the other two LEDs show the "power relay state" only those turn red if power is off.
And it works as designed so far;-)
from templates.
Hi guys, I have a question since I'm not familiar at all with Tasmota and even less with berry scripts: I wanted to actually flash ESPHome on my Shelly plug plus s because I'm familiar with that but realized there is now a safeboot mode or something like that that will prevent me from running ESPHome after a reboot (?)... or risk to soft-brick the device which probably means having to open it up and flash it with serial anyway.
So I guess I'll just have to stick to Tasmota for now: is there any way to expose the LEDs directly to Home Assistant through berry scripting? What do I want to achieve with this? I want to use the LEDs to show in which tariff I am currently in (low or normal) but following the ton of rules I have already set up for all my other lights in the house (for example by setting brightness depending on either lux values from other sensors or time of day / season of the year, that kind of stuff).
So: is exposing the LEDs as a controllable LED to HA possible?
For other newcomers: this is the documentation on how to control the LEDs: https://tasmota.github.io/docs/Berry_Addressable-LED/#led-strips-matrix-and-sub-strips and you can control the brightness of the LEDs by passing on a third parameter to set_pixel_color
which goes from 0 to 100.
There is also a MQTT integration which might be useful: https://tasmota.github.io/docs/Berry/#mqtt-module . I think I might be capable of exposing the entities through there but I really really don't want to learn about all that and having to maintain it when inevitably in a few years time the spec changes.
from templates.
Hi! Thanks for sharing, but unfortunately I can't work with the two templates. Simply copy/paste does not work, I get the following error message:
"BRY: Exception> 'value_error' - invalid GPIO number stack traceback:
<unknown source>: in function `assign_rmt`
<unknown source>: in function `ctor`
<unknown source>: in function `init`
<unknown source>: in function `main`"
Sorry I'm not an expert, but I was just hoping to get the LEDs on my Shelly Plus Plug S to light up without having to spend days learning the programming and syntax...
What am I doing wrong? I suspect that in the lines
"#Index myLeds1 & 2 via Gpio 25,26, Berry index is 0 and 1
myLeds1 = Leds(2,gpio.pin(gpio.WS2812, 0))
myLeds2 = Leds(2,gpio.pin(gpio.WS2812, 1))"
I must enter something else. What? An example would be helpful. Only "25" and "26" hasn't worked so far or I've made another syntax error in the process.
And one more question:
Does the line "{"NAME": "Shelly Plus Plug S", "GPIO":[0,0,0,0,224,0,32,2720,0,0,0,0,0,0,0,2624,0,0,2656,0,544,1376,1377,0,0,0,0,0,0,0,4736,0,0,0,0,0,0], "FLAG":0, "BASE":1}" belong to the template? Do I have to execute it first? Adapted to the name of my device in the network? Do I have to integrate it later in the autoexec.be?
And once it works in the console... As I understand it, I then have to make an "autoexec.be" out of it and place it under "Manage File System" so that it is in the autostart. Right?
from templates.
Shot in the dark: Looks like the template (see first post) is not configured (Settings -> Other Settings -> Template)
from templates.
Thx, that was it! One have to do this first: https://templates.blakadder.com/howto.html
from templates.
Based on the first example I made this berry script to display relay state on two leds and energy level on the other two
var power = int(tasmota.get_power()[0]) #Index myLeds1 & 2 via Gpio 25,26, Berry index is 0 and 1 myLeds1 = Leds(2,gpio.pin(gpio.WS2812, 0)) myLeds2 = Leds(2,gpio.pin(gpio.WS2812, 1)) def leds_onoff(value, trigger) power = value if value == 1 myLeds1.set_pixel_color(0,0x00CC00) myLeds1.set_pixel_color(1,0x00CC00) end if value == 0 myLeds1.set_pixel_color(0,0xCC0000) myLeds1.set_pixel_color(1,0xCC0000) myLeds2.set_pixel_color(0,0x000000) myLeds2.set_pixel_color(1,0x000000) myLeds2.show() end myLeds1.show() end tasmota.add_rule("Power1#state", leds_onoff) tasmota.add_rule("Power1#boot", leds_onoff) def leds_energy(value, trigger) var ledcol = 0 if power == 1 var maxpower = 2500.0 var currentw = maxpower if value < maxpower currentw = value end var red = int(currentw * 255.0 / maxpower) var green = int(255 - red) ledcol = (red << 16) + (green << 8) end myLeds2.set_pixel_color(0,ledcol) myLeds2.set_pixel_color(1,ledcol) myLeds2.show() end tasmota.add_rule("Energy#Power", leds_energy)
As above saved as autoexec.be
how can I change this script to implement overall brightness control ?
from templates.
You can try to append the brightness (as percentage) after the color.
myLeds1.set_pixel_color(1,0xCC0000,50)
from templates.
I'm trying to install some sensors in the Shelly Plus plug S. Do you guys know where I can get the real pinout in relation to the template and the pins function? Like a picture pointing to which Gpio is which.
from templates.
I have to switch the "1" and the "2" next to "WS2812" at GPIO 24 and 25 in order for it to work (to control all 4 LEDs within the Web UI, otherwise only 2 LEDs are controlled). Then the button switches only the light and not the relay, so I have to change the button to Switch and use "SwitchMode 4" with an easy "Rule1 ON Switch1#Action=TOGGLE DO Power1 TOGGLE ENDON".
All this only works as long as the plug is connected to power. When it is unplugged and replugged. Is there anything you have done differently @gru-github?
from templates.
I hope someone answers... even if no one seems to be interested.
On the official page for this device there are two different configurations, on this one there is a third. Which is the correct one? The script reported above does not work or works partially. Can I know if anyone has solved this problem in some way? The idea of showing the status on half of the LEDs and the power consumption on the other half of the LEDs is great! But I repeat, the script does not work!
Has anyone fixed it? It also seems to me that the GPIO configuration is incorrect in some way. Any ideas?
from templates.
Usually it's the missing template or a wrong one.
from templates.
Related Issues (20)
- Instructions missing commands for DIYMORESOILDHT11 HOT 1
- [Site issue]POWSAV 5+5AC 4USB Power Strip Hardware Changed HOT 2
- [Site issue] Template (requires valid JSON template) ==> Not a valid template! HOT 1
- Solution for Error: Unknown board ID 'esp32_16M'
- [Site issue] Template for Refoss P11 Power Monitoring Plug (P11) HOT 4
- Option no longer exists - should it be Interlock? HOT 2
- [Site issue] Qualitel ALS08L no longer using ESP chip
- [Site issue] elegant_choice Amazon link 404s
- [Site issue] Tutorial link for Ledvance Swiss plug
- Shelly Plus Plug S "V2" - Temperature configuration (copy & paste from Shelly Plus 1) HOT 2
- Earu RDCBC-1P 63A nov2023 eWeLink version HOT 1
- [Template not working] SS-LS01
- OV5640_V1_2 template is noct working with Tasmota32Webcam HOT 1
- Nous Smart Plug A1: new latest chipset is Beken
- sunton_ESP32-2432S028 display.ini swapped values HOT 1
- Customization of the template (AOFO 4AC+4USB Tuya Power Strip C733)
- Issue with _templates/rainpoint_TTP106W
- New hardware version of BQ05 HOT 1
- [Site issue] Martin Jerry MJ S01 is now shipping Tuya CB3S chipset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from templates.