Тёмный

How to use scripting in Shelly? 

Csongor Varga
Подписаться 36 тыс.
Просмотров 32 тыс.
50% 1

This is my first try understanding and working on some examples in Shelly scripting. I think I did quite a lot already showing what is possible, but there are a few other scenarios I wanted to do, but could not figure out how it can be done.
You find me examples here:
github.com/nygma2004/km/blob/...
If you like what I do here, you can support me with RU-vid Thanks, or Patreon:
/ csongorvarga
Chapters:
0:00 Intro
1:53 Enabling scripting
3:16 Documentation
4:39 Simple blinking output
6:07 Asymmetric blinker
7:32 Handle button presses
10:55 Call script on another Shelly
12:56 Handle two Shellys at the same time
14:55 Calling public APIs
17:31 Final thoughts

Наука

Опубликовано:

 

24 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 33   
@Chrom35kull
@Chrom35kull 2 года назад
Thank you for the video, looking at your scripts has made it easier in my head to start writing up a script on my Shelly 4PM to control the warehouse lighting. I plan to add a Shelly motion sensor literally for its LUX sensor and have the 4PM only allow the lights to be on when the light level is low.
@chrispaul7890
@chrispaul7890 2 года назад
Wow. Csongor. Your how to video was very well done and very clear. Thank you! BTW: 0.9.1 is the current version (as of 12/9/2021) if you update your Plus1.
@andreibabulevich4454
@andreibabulevich4454 2 месяца назад
Thank you for this great video, Shelly should quote it in their tutorial!
@macthaidhg
@macthaidhg 2 года назад
This is a very nice introduction to scripting in shellys, something that is not widely covered on YT. I just purchased a Shelly 4PM and I'd like to write a simple script whereby one switch down makes another switch up (and vice versa). I'm not a programmer so any pointers would be appreciated! I usually do this kind of stuff in home assistant but for this installation it needs to be on the device.
@jameskelly1557
@jameskelly1557 8 месяцев назад
Thanks csongor, I have no experience with scripting at all but managed to use your video and salvage some of your code to write a simple script for my shelly plus 1, all my script does is to turn off the relay if the button has been pushed 5 times. i spent DAYS trawling the net for some really basic examples that i could use and turned up nothing! i spent 3 hours with your video and with trial and error came up with 10 lines of code that do the job! so Thank you very much for taking the time to make this video. I feel like 10 years ago, people were more enthusiastic about sharing simple tutorials like this, without people like you, the internet would become a money grabbing insta shit show!! well done you!
@csongorvarga
@csongorvarga 8 месяцев назад
This is great. I am thinking about how I would do it, but I have no idea. But you did it :)
@claudiogi5263
@claudiogi5263 Год назад
Thanks for your script movie, but I don't understand much about it. I would like to know if it is possible with a script to enable the cloud only for a few hours of the day, so if it needs to act for example on an active scene. Thank you! Claudio Gi
@iliobenigni1388
@iliobenigni1388 9 месяцев назад
hi, I would simply like to lengthen the time in ms for the long press of the shelly 1 plus. can anyone help me?
@Usefulhacksfreeofcharge
@Usefulhacksfreeofcharge 11 месяцев назад
Hello, I do not know how to continue..... I would like to achieve that when the humidity outside is lower than in the garage, that one shelly plus 1 pm is switched on, so that the fan starts. Apparently this is only possible with two shelly, two addon and scripting. Do you know who can help me? I do not have Home-Assistant and neither Scripting skills.
@nunomcp
@nunomcp Год назад
Great video! Do you know how to put credentials for authentication in the url? I need the authentication enable...
@florintrenca
@florintrenca 8 месяцев назад
Salutare, Oare se poate creea un sistem de comandă și control pentru încălzirea în pardoseală, independent de internet, folosind shellly rgbw2 pentru controlul a 4 zone separate și un releu dry contact de la shelly pentru a porni centrala? Prin protocolul Device to device communication pot face un shelly h&t să trimită o comandă de pornire la un canal din cele 4 existente la rgbw2, dar problema pe care o întâmpin este cum pot comanda in același timp si dry contact pt comandă centrală, in același timp ținând cont si de celelate zone care sunt controlate fiecare in parte de un termostat shelly. Mulțumesc.
@unionse7en
@unionse7en 29 дней назад
Can deep sleep be implemented? (Shelly Uni +)
@joker_g7337
@joker_g7337 3 дня назад
This is the tutorial to Shelly's documentation.
@matic1982
@matic1982 5 месяцев назад
Hey! Great video! I wonder how I could use Event handler script and use it for two separate buttons on a single Shelly device. Event in this video is triggered by both of the inputs the same way. I would like to separate them.
@csongorvarga
@csongorvarga 5 месяцев назад
Uh, it was a long time I did this, but you can tell from the event which button was pressed. But it does trigger the same event.
@markrichards3910
@markrichards3910 Год назад
Is it possible to Script something to read temperature values off Shelly Uni to create a “if sensor 0 is less than sensor 1” turn off relay ?
@csongorvarga
@csongorvarga Год назад
Yes probably. But I have not explored how to read other sensor much. But you could make a HTTP call to the uni and read the temperature from the result.
@iliobenigni1388
@iliobenigni1388 9 месяцев назад
This video is really interesting. I'm trying to modify the ms to start the longpush on the new shelly 1, in the old one it was possible to modify it, do you have any advice?
@Rajo1012
@Rajo1012 Год назад
@Csongor Varga , can you tell me if I can upload code to a shelly device and let it run on the device, as opposed to running code on a PC and sending commands over WIFI? I want open and close a switch to a power supply at certain times throughout the night and do not want to run a WIFI network during the night. The use case is to have a window opening and closing automatically at times whiich I to specify, e.g.: 9:59 pm --> close window; 10:01 pm --> open window (And yes, I want to keep the air fresh and also avoid a predictable noise at the full hour, every hour) I was looking at the "Shelly Plus 2PM" which generally would suite the purpose, but I dont know I the code can be uploaded to the device itself. If not, would anyone know of an alternative?
@csongorvarga
@csongorvarga Год назад
Scripting is a code that runs on the device. So it will definitely stored and runs on the device. But the simple schedules that you set in the settings are also stored in the device memory. So both of those work without the cloud. In these cases cloud is only used to access the device from your phone. One note: these small Shelly devices do not have an internal clock battery. Therefore in case of a power outage the clock resets to 00:00. They sync their clock from the internet. So if your power goes out and the internet is down as well, the clock of the Shelly will not be set correctly.
@Rajo1012
@Rajo1012 Год назад
@@csongorvarga Thank you for this info. Ideally I would like to use a device which is programmed/accessed via cable (eg via USB). I assume the Shelly Plus 2PM is constantly advertising its WIFI access point, therefore there is constantly a 2.4 GHz WIFI signal send. I would like to avoid WIFI pollution in my space. Would you happen to know of an alternative device, which can be accessed for script upload via a cable?
@csongorvarga
@csongorvarga Год назад
@@Rajo1012 Not really. There are a few Shelly Pro devices that have wires eithernet connection as well. That would be my only tip.
@Rajo1012
@Rajo1012 Год назад
@@csongorvarga Thanks
@terryshaw2162
@terryshaw2162 2 года назад
Is it possible to have a script that takes the app button press and makes the relay pulse on and then off. Need this for a particular application that needs a relay pulsed input for on / off operation.
@csongorvarga
@csongorvarga 2 года назад
Yes, but you don't even need a script for that. Just set the auto-off delay on the output.
@terryshaw2162
@terryshaw2162 2 года назад
Thank you!
@terryshaw2162
@terryshaw2162 2 года назад
The application here is an aircon unit and the auto off works to a point. Obviously the downside is that the switch always shows as off, when the unit may be on, and turning the unit off with the app (or with google) doesn't work. I have created a routine in google that "remaps" turn the aircon off" to a switch on operation. But I have no real way of knowing if the unit is on or off. The aircon unit does have an output relay that provides operation status (closed = on, open = off). I tried connecting this to the Shelly Plus 1's switch input and set the switch to detached to see if that would give me any indication of on/off status, but it doesn't seem to. Any advice on how I could integrate this output relay into the Shelly to provide on/off status?
@csongorvarga
@csongorvarga 2 года назад
@@terryshaw2162 That is a good question, but I have no idea either. The only other hint is the unit is on or not, is to monitor the power consumption to tell if it is running or only in standby mode.
@terryshaw2162
@terryshaw2162 2 года назад
@@csongorvarga I am thinking I use a 2nd Shelly with the aircon output relay connected to its switch input, and the switch set to toggle, but nothing connected to the relay of this Shelly. Then call this Shelly "AC Status" or something like that.
@Manish-fm5iv
@Manish-fm5iv 2 года назад
Does it support sockets?
@csongorvarga
@csongorvarga 2 года назад
This is available in the new Plus line of devices. There is no Plus socket...yet.
@Manish-fm5iv
@Manish-fm5iv 2 года назад
@@csongorvarga Thanks for responding. Apologies I should have been clearer, I meant in regards to NodeJS something like this: var net = require('net'); var client = new net.Socket(); I guess this is lower than HTTP. I did look around the docs but could not find anything. Would have been nice to avoid spinning up a little server just to send a packet. Never the less I think what Shelly are doing is really awesome and hope they expand on JS/Node feature support.
@stefanlodders9521
@stefanlodders9521 9 месяцев назад
When starting a script with "url/rps/Script.Start?Id=1", can I pass an argument (like temperature?) and how would I use it in the started script?
Далее
You don't need a frontend framework
15:45
Просмотров 114 тыс.
How ChatGPT Built My App in Minutes 🤯
8:28
Просмотров 2,2 млн
Телеграмм-Колян Карелия #юмор
00:10
Она Может Остановить Дождь 😱
00:20
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
SuperHouse 45: First look at the new Shelly Pro 4PM
15:54
Building my PERFECT Smart Home Control Panel!
13:24
Просмотров 1,2 млн
Shelly Plus was made for DIY automation
14:31
Просмотров 50 тыс.
iPhone socket cleaning #Fixit
0:30
Просмотров 15 млн
Aura 879dsp новинка и хит
0:48
Просмотров 192 тыс.