Dimmer level

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
mcmikev
Posts: 146
Joined: Tuesday 26 May 2015 8:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: right here
Contact:

Dimmer level

Post by mcmikev »

Hi,

I am trying to use ideAlarm (that is working) and turn my lights on when door opens and alarm is armed.

I have tried

Code: Select all

domoticz.devices('DIM-Keuken').level(99)
and

Code: Select all

domoticz.devices('DIM-Keuken').dimTo(99)
But the light goes on but on the previous level and not 100%.
The dimmer that is controlling the light is a Fibaro Dimmer 2.

Can someone point me to the right direction on how to turn on the ligth at full level ?? :?:

Thank you
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Dimmer level

Post by dannybloe »

dimTo(100) should work.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mcmikev
Posts: 146
Joined: Tuesday 26 May 2015 8:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: right here
Contact:

Re: Dimmer level

Post by mcmikev »

Hmmm in test script is does work but in ideAlarm it does not.

Code: Select all

 2017-12-08 15:07:21.262 dzVents: Info: Handling events for: "Achterdeur Status", value: "Timed out"
2017-12-08 15:07:21.262 dzVents: Info: ideAlarm V2.1.1: ------ Start external script: ideAlarm.lua: Device: "Achterdeur Status (Dummy)", Index: 736
2017-12-08 15:07:21.263 dzVents: Info: ideAlarm V2.1.1: triggerType status
2017-12-08 15:07:21.264 dzVents: Info: ideAlarm V2.1.1: Achterdeur new status: Alert immediately
2017-12-08 15:07:21.267 dzVents: Info: ideAlarm V2.1.1: ------ Finished ideAlarm.lua
2017-12-08 15:07:21.401 dzVents: Info: Handling events for: "Achterdeur Status", value: "Alert"
2017-12-08 15:07:21.402 dzVents: Info: ideAlarm V2.1.1: ------ Start external script: ideAlarm.lua: Device: "Achterdeur Status (Dummy)", Index: 736
2017-12-08 15:07:21.402 dzVents: Info: ideAlarm V2.1.1: triggerType status
2017-12-08 15:07:21.405 dzVents: !Info: ideAlarm V2.1.1: Turning on noise for zone Achterdeur
2017-12-08 15:07:21.408 dzVents: Info: ideAlarm V2.1.1: ------ Finished ideAlarm.lua
2017-12-08 15:07:21.416 Notification sent (email) => Success
2017-12-08 15:07:21.418 OpenZWave: Domoticz has send a Switch command!, Level: 255, NodeID: 14 (0x0e)
2017-12-08 15:07:21.430 (Z-wave) Light/Switch (DIM-PlafondWK)
2017-12-08 15:07:21.432 OpenZWave: Domoticz has send a Switch command!, Level: 255, NodeID: 50 (0x32)
2017-12-08 15:07:21.445 (Z-wave) Light/Switch (DIM-Keuken)
2017-12-08 15:07:21.486 (Z-wave) Light/Switch (DIM-PlafondWK)
2017-12-08 15:07:21.574 (Z-wave) Light/Switch (DIM-Keuken)
2017-12-08 15:07:21.718 (Z-wave) Usage (P-DIM-PlafondWK)
2017-12-08 15:07:21.724 (Z-wave) General/kWh (P-DIM-PlafondWK-kWh)
2017-12-08 15:07:21.908 Notification sent (pushover) => Success
2017-12-08 15:07:22.231 (Z-wave) Usage (P-DIM-Keuken)
2017-12-08 15:07:22.236 (Z-wave) General/kWh (P-DIM-Keuken-kWh)
2017-12-08 15:07:24.752 (RFXCOM) Temp + Humidity (TH-Slaapkamer4)
2017-12-08 15:07:25.968 (Z-wave) Light/Switch (Achterdeur Alarm Type)
2017-12-08 15:07:25.973 (Z-wave) Light/Switch (Achterdeur Alarm Level)
2017-12-08 15:07:25.976 (Z-wave) General/Alarm (Achterdeur Alarm Type: Access Control 6 (0x06))
2017-12-08 15:07:25.986 (Z-wave) Light/Switch (Achterdeur motion)
2017-12-08 15:07:26.131 dzVents: Info: Handling events for: "Achterdeur motion", value: "Closed"
2017-12-08 15:07:26.133 dzVents: Info: ideAlarm V2.1.1: ------ Start external script: ideAlarm.lua: Device: "Achterdeur motion (Z-wave)", Index: 724
2017-12-08 15:07:26.134 dzVents: Info: ideAlarm V2.1.1: triggerType sensor
2017-12-08 15:07:26.137 dzVents: Info: ideAlarm V2.1.1: ------ Finished ideAlarm.lua 
In the idealamhelpers.lua there is

Code: Select all

if alarmZone.name == 'Thuis' then
			-- Let's do something here
			domoticz.devices('DIM-Keuken').dimTo(100)
			domoticz.devices('DIM-PlafondWK').dimTo(100)
		end
But the command being send is 255.

Any pointers??
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Dimmer level

Post by BakSeeDaa »

Please create a dummy switch. Call it "mySwitch".
Then try this script:

Code: Select all

return {
	on = {
		devices = {
			'mySwitch'
		}
	},
	execute = function(domoticz, device)
		domoticz.devices('DIM-Keuken').dimTo(100)
	end
}
If you then press the mySwitch, does it work differently from ideAlarm script?

Never mind what the Z-Wave internal Z-Wave level is. What is the resulting dimming level on the device DIM-Keuken?
mcmikev
Posts: 146
Joined: Tuesday 26 May 2015 8:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: right here
Contact:

Dimmer level

Post by mcmikev »

Hi BakseeDaa

That is what I tested. With test it sends the right level. In idealarm it turn on the light but in previous level. Not max op 100%

So sending from test works same command from idealarm does not.
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Dimmer level

Post by BakSeeDaa »

mcmikev wrote: Friday 08 December 2017 16:19 Hi BakseeDaa

That is what I tested. With test it sends the right level. In idealarm it turn on the light but in previous level. Not max op 100%

So sending from test works same command from idealarm does not.
1) Please let us see the complete script that is failing.

2) Also please let us see the log output from the test script

3) Finally put ideAlarm into debug mode and let us see the log output while the dimmer is dimmed.

Cheers!
mcmikev
Posts: 146
Joined: Tuesday 26 May 2015 8:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: right here
Contact:

Re: Dimmer level

Post by mcmikev »

The script (is just a small edit on the original idealarmhelpers just the devices are remarked or changed)

Code: Select all

--[[
Edit this file suit your needs 
Place this file in the dzVents scripts folder using the name ideAlarmConfig.lua

See https://github.com/allan-gam/ideAlarm/wiki/configuration
After editing, always verify that it's valid LUA at http://codepad.org/ (Mark your paste as "Private"!!!)
--]]

local _C = {}

-- ideAlarm Custom helper functions. These functions will be called if they exist.
_C.helpers = {

	alarmZoneNormal = function(domoticz, alarmZone)
		-- Normal is good isn't it? We don't have to do anything here.. We could but..
	end,

	alarmZoneArming = function(domoticz, alarmZone)
		-- You can define something to happen here.
		-- This function will be called when arming and waiting for the exit delay.
		-- If the exit delay is 0 seconds, this function will not be called.
	end,

	alarmZoneTripped = function(domoticz, alarmZone)
		-- A sensor has been tripped but there is still no alert
		-- We should inform whoever tripped the sensor so he/she can disarm the alarm
		-- before a timeout occurs and we get an alert
		-- In this example we turn on the kitchen lights if the zones name
		-- is 'My Home' but we could also let Domoticz speak a message or something.

		--local trippedSensors = alarmZone.trippedSensors(domoticz, 1) -- Can be used if we need to. 

		if alarmZone.name == 'Thuis' then
			-- Let's do something here
			domoticz.devices('DIM-Keuken').dimTo(100)
			domoticz.devices('DIM-PlafondWK').dimTo(100)
		end
	end,

	alarmZoneError = function(domoticz, alarmZone)
		-- An error occurred for an alarm zone. Maybe a door was open when we tried to
		-- arm the zone. Anyway we should do something about it.
		domoticz.notify('Alarm Zone Error!',
			'There was an error for the alarm zone ' .. alarmZone.name,
			domoticz.PRIORITY_HIGH)
	end,

	alarmZoneArmingWithTrippedSensors = function(domoticz, alarmZone, armingMode)
		-- Tripped sensors have been detected when arming. If canArmWithTrippedSensors has been set
		-- to true in the configuration file for the zone, arming will proceed,
		-- if not, then the alarmZoneError function will be called subsequently and arming will not occur.
		local msg = ''
		local isArming = true
		local trippedSensors = alarmZone.trippedSensors(domoticz, 0, armingMode, isArming)
		for _, sensor in ipairs(trippedSensors) do
			if msg ~= '' then msg = msg..' and ' end
			msg = msg..sensor.name
		end
		if msg ~= '' then
			msg = 'Open sections in '..alarmZone.name..'. '..msg
			domoticz.notify('Open sections when arming',
				msg .. alarmZone.name,
				domoticz.PRIORITY_HIGH)
		end
	end,

	alarmZoneAlert = function(domoticz, alarmZone, testMode)
		local msg = 'Intrusion detected in zone '..alarmZone.name..'. '
		local oneMinute = 1
		for _, sensor in ipairs(alarmZone.trippedSensors(domoticz, oneMinute)) do
			msg = msg..sensor.name..' tripped @ '..sensor.lastUpdate.raw..'. '
		end

		if not testMode then
			domoticz.notify('Alarm Zone Alert!',
				msg, domoticz.PRIORITY_HIGH)
		else
			domoticz.log('(TESTMODE IS ACTIVE) '..msg, domoticz.LOG_INFO)
		end
	end,

	alarmArmingModeChanged = function(domoticz, alarmZone)
		-- The arming mode for a zone has changed. We might want to be informed about that.
		local zoneName = alarmZone.name
		local armingMode = alarmZone.armingMode(domoticz)
		domoticz.notify('Arming mode change',
			'The new arming mode for ' .. zoneName .. ' is ' .. armingMode,
			domoticz.PRIORITY_LOW)
		-- Buy a Fibaro Wall Plug 2 and configure it to display red when off, green when on
		-- You can then use it as in alarm arming mode indicator!
		if armingMode == domoticz.SECURITY_DISARMED then 
		--	domoticz.devices('Alarm Status Indicator').switchOff() -- Green light on
		--else
		--	domoticz.devices('Alarm Status Indicator').switchOn() -- Red light on
		end
	end,

	alarmNagOpenSensors = function(domoticz, alarmZone, nagSensors, lastValue)
		if alarmZone.name == 'Thuis' then
			if #nagSensors == 0 and lastValue > 0 then
				domoticz.log('The previously reported sections are now closed! Good work!', domoticz.LOG_INFO)
			elseif #nagSensors > 0 then
				local msg = ''
				for _, sensor in ipairs(nagSensors) do
					if msg ~= '' then msg = msg..' and ' end
					msg = msg..sensor.name
				end
				msg = 'Open sections in zone: '..alarmZone.name..'. '..msg
				domoticz.log(msg, domoticz.LOG_INFO)
			end
		end
	end,

	alarmOpenSensorsAllZones = function(domoticz, alarmZones)
		-- Toggle the big red lamp if there are any open sensors in 'My House'
		for _, alarmZone in ipairs(alarmZones) do
			if alarmZone.name == 'Thuis' then
				--if (alarmZone.openSensorCount > 0) then
				--	domoticz.devices('Big Red Lamp').switchOn()
				--elseif (alarmZone.openSensorCount == 0) then
				--	domoticz.devices('Big Red Lamp').switchOff()
				--end
			end
		end
	end,

}

return _C
test script and output

Code: Select all

return {
    active = true,
    on = {
        devices = {
            '0-Test'
        }
    },
    execute = function(domoticz, device)
        if (device.name == '0-Test' and device.state == 'On') then
	    domoticz.devices('DIM-Keuken').dimTo(100) end
end
}

Code: Select all

 2017-12-09 09:00:17.675 User: xxxxxxx initiated a switch command (741/0-Test/On)
2017-12-09 09:00:17.684 (Dummy) Light/Switch (0-Test)
2017-12-09 09:00:17.792 dzVents: Info: Handling events for: "0-Test", value: "On"
2017-12-09 09:00:17.792 dzVents: Info: ------ Start internal script: 0-Test: Device: "0-Test (Dummy)", Index: 741
2017-12-09 09:00:17.793 dzVents: Info: ------ Finished 0-Test
2017-12-09 09:00:17.824 OpenZWave: Domoticz has send a Switch command!, Level: 99, NodeID: 50 (0x32)
2017-12-09 09:00:17.830 (Z-wave) Light/Switch (DIM-Keuken) 
idealarmdebug

Code: Select all

 2017-12-09 09:03:25.005 dzVents: Info: Handling events for: "Achterdeur motion", value: "Closed"
2017-12-09 09:03:25.005 dzVents: Info: ideAlarm V2.1.1: ------ Start external script: ideAlarm.lua: Device: "Achterdeur motion (Z-wave)", Index: 724
2017-12-09 09:03:25.006 dzVents: Debug: ideAlarm V2.1.1: Triggered by device: Achterdeur motion, device state is: Closed
2017-12-09 09:03:25.006 dzVents: Info: ideAlarm V2.1.1: triggerType sensor
2017-12-09 09:03:25.007 dzVents: Debug: ideAlarm V2.1.1: Device-adapter found for Voordeur motion: Switch device adapter
2017-12-09 09:03:25.007 dzVents: Debug: ideAlarm V2.1.1: Processing device-adapter for Voordeur motion: Switch device adapter
2017-12-09 09:03:25.008 dzVents: Debug: ideAlarm V2.1.1: Device-adapter found for Voordeur Arming Mode: Text device
2017-12-09 09:03:25.008 dzVents: Debug: ideAlarm V2.1.1: Processing device-adapter for Voordeur Arming Mode: Text device
2017-12-09 09:03:25.009 dzVents: Debug: ideAlarm V2.1.1: Device-adapter found for Achterdeur Arming Mode: Text device
2017-12-09 09:03:25.010 dzVents: Debug: ideAlarm V2.1.1: Processing device-adapter for Achterdeur Arming Mode: Text device
2017-12-09 09:03:25.010 dzVents: Info: ideAlarm V2.1.1: ------ Finished ideAlarm.lua
2017-12-09 09:03:25.357 (Dummy) General/Text (Achterdeur Status)
2017-12-09 09:03:25.574 dzVents: Info: Handling events for: "Achterdeur Status", value: "Timed out"
2017-12-09 09:03:25.575 dzVents: Info: ideAlarm V2.1.1: ------ Start external script: ideAlarm.lua: Device: "Achterdeur Status (Dummy)", Index: 736
2017-12-09 09:03:25.575 dzVents: Debug: ideAlarm V2.1.1: Triggered by device: Achterdeur Status, device state is: Timed out
2017-12-09 09:03:25.575 dzVents: Info: ideAlarm V2.1.1: triggerType status
2017-12-09 09:03:25.575 dzVents: Debug: ideAlarm V2.1.1: Deal with alarm status changes for zone Achterdeur
2017-12-09 09:03:25.577 dzVents: Debug: ideAlarm V2.1.1: Device-adapter found for Achterdeur Arming Mode: Text device
2017-12-09 09:03:25.577 dzVents: Debug: ideAlarm V2.1.1: Processing device-adapter for Achterdeur Arming Mode: Text device
2017-12-09 09:03:25.577 dzVents: Debug: ideAlarm V2.1.1: Constructed timed-command: 736|0|Alert TRIGGER
2017-12-09 09:03:25.577 dzVents: Info: ideAlarm V2.1.1: Achterdeur new status: Alert immediately
2017-12-09 09:03:25.578 dzVents: Debug: ideAlarm V2.1.1: Device-adapter found for DIM-PlafondWK: Switch device adapter
2017-12-09 09:03:25.578 dzVents: Debug: ideAlarm V2.1.1: Processing device-adapter for DIM-PlafondWK: Switch device adapter
2017-12-09 09:03:25.579 dzVents: Debug: ideAlarm V2.1.1: Device-adapter found for DIM-Keuken: Switch device adapter
2017-12-09 09:03:25.580 dzVents: Debug: ideAlarm V2.1.1: Processing device-adapter for DIM-Keuken: Switch device adapter
2017-12-09 09:03:25.580 dzVents: Info: ideAlarm V2.1.1: ------ Finished ideAlarm.lua
2017-12-09 09:03:25.715 dzVents: Info: Handling events for: "Achterdeur Status", value: "Alert"
2017-12-09 09:03:25.716 dzVents: Info: ideAlarm V2.1.1: ------ Start external script: ideAlarm.lua: Device: "Achterdeur Status (Dummy)", Index: 736
2017-12-09 09:03:25.716 dzVents: Debug: ideAlarm V2.1.1: Triggered by device: Achterdeur Status, device state is: Alert
2017-12-09 09:03:25.716 dzVents: Info: ideAlarm V2.1.1: triggerType status
2017-12-09 09:03:25.717 dzVents: Debug: ideAlarm V2.1.1: Deal with alarm status changes for zone Achterdeur
2017-12-09 09:03:25.718 dzVents: Debug: ideAlarm V2.1.1: Device-adapter found for Achterdeur Arming Mode: Text device
2017-12-09 09:03:25.718 dzVents: Debug: ideAlarm V2.1.1: Processing device-adapter for Achterdeur Arming Mode: Text device
2017-12-09 09:03:25.719 dzVents: Debug: ideAlarm V2.1.1: Device-adapter found for Achterdeur motion: Switch device adapter
2017-12-09 09:03:25.719 dzVents: Debug: ideAlarm V2.1.1: Processing device-adapter for Achterdeur motion: Switch device adapter
2017-12-09 09:03:25.719 dzVents: !Info: ideAlarm V2.1.1: Turning on noise for zone Achterdeur
2017-12-09 09:03:25.720 dzVents: Debug: ideAlarm V2.1.1: Device-adapter found for DIM-PlafondWK: Switch device adapter
2017-12-09 09:03:25.720 dzVents: Debug: ideAlarm V2.1.1: Processing device-adapter for DIM-PlafondWK: Switch device adapter
2017-12-09 09:03:25.720 dzVents: Debug: ideAlarm V2.1.1: Constructed timed-command: On
2017-12-09 09:03:25.721 dzVents: Debug: ideAlarm V2.1.1: Constructed timed-command: On NOTRIGGER
2017-12-09 09:03:25.721 dzVents: Debug: ideAlarm V2.1.1: Constructed timed-command: Off
2017-12-09 09:03:25.721 dzVents: Debug: ideAlarm V2.1.1: Constructed timed-command: Off AFTER 300 SECONDS
2017-12-09 09:03:25.721 dzVents: Debug: ideAlarm V2.1.1: Constructed timed-command: Off AFTER 300 SECONDS NOTRIGGER
2017-12-09 09:03:25.722 dzVents: Debug: ideAlarm V2.1.1: Device-adapter found for DIM-Keuken: Switch device adapter
2017-12-09 09:03:25.722 dzVents: Debug: ideAlarm V2.1.1: Processing device-adapter for DIM-Keuken: Switch device adapter
2017-12-09 09:03:25.722 dzVents: Debug: ideAlarm V2.1.1: Constructed timed-command: On
2017-12-09 09:03:25.722 dzVents: Debug: ideAlarm V2.1.1: Constructed timed-command: On NOTRIGGER
2017-12-09 09:03:25.722 dzVents: Debug: ideAlarm V2.1.1: Constructed timed-command: Off
2017-12-09 09:03:25.723 dzVents: Debug: ideAlarm V2.1.1: Constructed timed-command: Off AFTER 300 SECONDS
2017-12-09 09:03:25.723 dzVents: Debug: ideAlarm V2.1.1: Constructed timed-command: Off AFTER 300 SECONDS NOTRIGGER
2017-12-09 09:03:25.725 dzVents: Info: ideAlarm V2.1.1: ------ Finished ideAlarm.lua 
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Dimmer level

Post by BakSeeDaa »

You have several alarm zones.

You have scripted to dim the device "DIM-kuken" when the alarm zone with name "Thuis" is tripped.

However the log output is for another alarm zone with name "Achterdeur" after that a device with name "Achterdeur motion" has caused an alert to be created.

Your custom script ideAlarmHelpers will not do anything with the device "DIM-kuken" for any alarm events belonging to the alarm zone with name "Achterdeur".

Please make a new log output for when the alarm zone "Thuis" is tripped (A sensor becomes active) and please do not filter out Z-wave and OpenZWave events from the log output.

I suspect that there is some other script that turns on the device "DIM-kuken" or maybe you have defined the device "DIM-kuken" as an alert device for the alarm zone with with name "Achterdeur".
Wiki wrote:alertDevices: (Elements are Optional) A Lua table containing the named Domoticz devices that shall be automatically switched on during an alert situation. Typically you put your siren devices names here but it can actually be any kind of Domoticz devices that can be switched "On" and "Off". If you have no alert devices or you'd like to control them using custom logic you should supply an empty table {}
So, I need a relevant log output to help you further, ;)
Thanks
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest