Hi everyone, I'm trying to change the time in ms of the shelly 1 plus. the old shelly had the editable setting while this new one didn't... do you know how to create a script to change it?
change long push time
-
-
Hello ilio1994,
you could set your Shelly to "detached" and then use timestamps to create custom push events.
I saw a script for this somewhere on the forum but can't remember where. Nevertheless, it's not difficult to do, so you can just create your own version.
-
Code
Thanks for the reply. I found this online but it doesn't work but I don't know too much about scripts either. do you think it could work? Maybe there's just some syntax error.
Code: long
Alles anzeigenlet CONFIG = { // longpush duration in ms LongpushDuration: 200, // timer interval in ms LongpushTimerInterval: 10 }; let STRINGS = { shellyEventBtnDown: 'btn_down', shellyEventBtnUp: 'btn_up' }; let TIMER = { "1": null, "2": null, "3": null, "4": null }; let TIMER_DURATION = { "1": 0, "2": 0, "3": 0, "4": 0 }; function startBtnTimer(channel) { TIMER_DURATION[channel] = 0 TIMER[channel] = Timer.set( CONFIG.LongpushTimerInterval, true, function (channel) { TIMER_DURATION[channel] = TIMER_DURATION[channel] + CONFIG.LongpushTimerInterval; if (TIMER_DURATION[channel] > CONFIG.LongpushDuration) { Shelly.emitEvent("custom_long_push", {"channel":channel}); stopBtnTimer(channel); } }, channel ); }; function stopBtnTimer(channel) { Timer.clear(TIMER[channel]); }; Shelly.addEventHandler( function (event, userData) { print(JSON.stringify(event)); if (event.info.event === STRINGS.shellyEventBtnDown) { startBtnTimer(event.info.id); } else if (event.info.event === STRINGS.shellyEventBtnUp) { stopBtnTimer(event.info.id); } } );
-
This looks like some Chat gpt bullshit, there is no way this could work with a timer, just use timestamps.
I will try to create a new script for this over the weekend, but it would be better if you could at least give it a try yourself.
-
thanks, I'm studying to succeed, I'm not very familiar with scripts but I want to learn, thanks again for the support
-
Dieses Thema enthält 14 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind, bitte registrieren Sie sich oder melden Sie sich an um diese lesen zu können.