Hello everybody!
Do some of you know enough about scripting to help me on this?
Situatation:
I have a Z-wave wirelesse remote which only send ON value.
Want to use it to switch LED color afer every push: flow will be like OFF -> 10 -> 20 -> 30 -> OFF
I want that after every ON received, the value of a Dummy selector switch to be incremented.
flow will be like OFF -> 10 -> 20 -> 30 -> OFF
Ideally, one with and one without the OFF values (10 -> 20 -> 30 -> 10)
maybe one that can be edited to add seletor values to the script to have more options: ( 10->20->30->40)
Maybe someone already have something like this:-)
Looking forward for your hints!
Regards, JS
Push on button increments selector Value script
Moderator: leecollings
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Push on button increments selector Value script
Could be something like this in dzVents.antipiot wrote: ↑Friday 18 January 2019 18:17 I have a Z-wave wirelesse remote which only send ON value.
Ideally, one with and one without the OFF values (10 -> 20 -> 30 -> 10)
maybe one that can be edited to add selector values to the script to have more options: ( 10->20->30->40)
Maybe someone already have something like this:-)
When not yet familiar with dzVents please start with reading https://www.domoticz.com/wiki/DzVents:_ ... _Domoticz before implementing.
Special attention please for "In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents disabled' is not checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."
Code: Select all
-- selectLevels.lua
return {
on = { devices = { 1407 }}, -- device IDX of Button
logging = { level = domoticz.LOG_DEBUG,
marker = "selectLevel" },
execute = function(dz)
local mySelector = dz.devices(1408) -- device IDX of selector
local levelTable = mySelector.levelNames -- Create a table with all levelNames with index 1 - number of levels
local maxLevel = (#levelTable - 1) * 10 -- #leveltable is number of entries in leveltable
local currentLevel = mySelector.level / 10
local newLevel = 1
if mySelector.level ~= maxLevel then
newLevel = currentLevel + 1
mySelector.switchSelector(mySelector.level + 10)
end
mySelector.switchSelector(newLevel * 10)
dz.log("Switched to: " .. mySelector.levelNames[newLevel + 1],dz.LOG_DEBUG)
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Who is online
Users browsing this forum: No registered users and 1 guest