Problem with script
Posted: Wednesday 15 October 2025 19:49
Hello,
Something making abounding this platform soon.
There are always something that's not working between this zigbee2mqtt/zwave-js-ui/MQTT5 and Domoticz and I can't see any way to troubleshoot in where the problem are.
Is the update sent from zigbee2mqtt or zwave-js-ui to MQTT5?
Have Domoticz read the update ?
Feels like it's a black hole you can't see the whole picture with MQTT Explorer
I need to jump around in 4 different logs to even understand what's going on. It was so much better if everything could be in one log.
But over to my issue now.
This script has worked just fine for months but right it just stopped working and I don't understand why
Yes it's built using Gemini
The error I get is
I understand the error but this my timers are this and Blinder was at 90% so I don't see why it should say "Conditions not met"

Something making abounding this platform soon.
There are always something that's not working between this zigbee2mqtt/zwave-js-ui/MQTT5 and Domoticz and I can't see any way to troubleshoot in where the problem are.
Is the update sent from zigbee2mqtt or zwave-js-ui to MQTT5?
Have Domoticz read the update ?
Feels like it's a black hole you can't see the whole picture with MQTT Explorer
I need to jump around in 4 different logs to even understand what's going on. It was so much better if everything could be in one log.
But over to my issue now.
This script has worked just fine for months but right it just stopped working and I don't understand why
Yes it's built using Gemini
Code: Select all
--[[
Improved script for bedroom and hall lighting based on motion and a roller blind.
Features:
1. Turns on lights on motion only if it is night AND the roller blind is down.
2. Ignores motion during the daytime, even if the roller blind is down.
3. If motion stops, schedules the lights to turn off.
4. If motion is detected again, the scheduled turn-off is cancelled.
5. This also works if the light was turned on manually.
6. Execution is BLOCKED between 22:00 and 06:00.
--]]
return {
on = {
devices = {
'IKEA - Sensor sovrum' -- Change name if your sensor is named differently
}
},
logging = {
level = domoticz.LOG_INFO, -- Change to domoticz.LOG_FORCE for detailed debugging
marker = "BedroomLogic"
},
execute = function(dz, motionSensor)
-- Check if current time is within the blocked period. If so, stop the script.
if dz.time.matchesRule('at nighttime between 23:00 and 06:00') then
dz.log('Execution blocked between 23:00 and 06:00. Aborting.', dz.LOG_INFO)
return -- Exit the script immediately
end
-- --- Settings ---
local RULLGARDIN_SOVRUM = 304
local LAMPA_SOVRUM = 287
local LAMPA_HALL = 292
local BLIND_LEVEL_CLOSED = 90 -- % level for the blind to be considered closed
local BRIGHTNESS_LEVEL = 60 -- Brightness level when turning on (in %)
local OFF_DELAY_SECONDS = 300 -- Time in seconds before turning off the lights (300s = 5 min)
-- Get the device objects
local blind = dz.devices(RULLGARDIN_SOVRUM)
local lampBedroom = dz.devices(LAMPA_SOVRUM)
local lampHall = dz.devices(LAMPA_HALL)
if motionSensor.state == 'On' then
-- MOTION HAS STARTED
-- Always cancel any scheduled turn-off commands
lampBedroom.cancelQueuedCommands()
lampHall.cancelQueuedCommands()
dz.log('Motion detected. Cancelling any scheduled turn-off.', dz.LOG_INFO)
-- Check if the conditions to turn on the lights are met
if dz.time.isNightTime and blind.level >= BLIND_LEVEL_CLOSED then
dz.log('Conditions met (Night & Blind Down). Turning lights ON.', dz.LOG_FORCE)
lampBedroom.dimTo(BRIGHTNESS_LEVEL)
lampHall.dimTo(BRIGHTNESS_LEVEL)
else
dz.log('Conditions not met to turn on (Daytime or blind is open). Ignoring.', dz.LOG_INFO)
end
else -- motionSensor.state == 'Off'
-- MOTION HAS STOPPED
-- If any of the lights are on, schedule them to turn off.
if lampBedroom.state ~= 'Off' or lampHall.state ~= 'Off' then
dz.log('No more motion. Scheduling lights to turn OFF in ' .. OFF_DELAY_SECONDS .. ' seconds.', dz.LOG_FORCE)
lampBedroom.dimTo(0).afterSec(OFF_DELAY_SECONDS)
lampHall.dimTo(0).afterSec(OFF_DELAY_SECONDS)
end
end
end
}
Code: Select all
2025-10-15 19:35:52.586 dzVents: BedroomLogic: Motion detected. Cancelling any scheduled turn-off.
2025-10-15 19:35:52.586 dzVents: BedroomLogic: Conditions not met to turn on (Daytime or blind is open). Ignoring.


