diff --git a/plugins/deConz/DeConzPlatform.js b/plugins/deConz/DeConzPlatform.js
index 180c3fa..7ec17b3 100644
--- a/plugins/deConz/DeConzPlatform.js
+++ b/plugins/deConz/DeConzPlatform.js
@@ -1,130 +1,189 @@
+/*
+ * File: DeConzPlatform.js
+ * Project: homematic-virtual-deConz
+ * File Created: Saturday, 26th September 2020 3:49:50 pm
+ * Author: Thomas Kluge (th.kluge@me.com)
+ * -----
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Thomas Kluge
(https://github.com/thkl)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ * ==========================================================================
+ */
+
'use strict'
const path = require('path')
const fs = require('fs')
+const url = require('url')
+
var appRoot = path.dirname(require.main.filename)
if (appRoot.endsWith('bin')) { appRoot = appRoot + '/../lib' }
-if (appRoot.endsWith('node_modules/daemonize2/lib')) {
- appRoot = path.join(appRoot,'..','..','..','lib')
-
- if (!fs.existsSync(path.join(appRoot,'HomematicVirtualPlatform.js'))) {
- appRoot = path.join(path.dirname(require.main.filename),'..','..','..','node_modules','homematic-virtual-interface','lib')
- }
+if (appRoot.endsWith('node_modules/daemonize2/lib')) {
+ appRoot = path.join(appRoot, '..', '..', '..', 'lib')
+
+ if (!fs.existsSync(path.join(appRoot, 'HomematicVirtualPlatform.js'))) {
+ appRoot = path.join(path.dirname(require.main.filename), '..', '..', '..', 'node_modules', 'homematic-virtual-interface', 'lib')
+ }
}
-appRoot = path.normalize(appRoot);
+appRoot = path.normalize(appRoot)
const HomematicVirtualPlatform = require(appRoot + '/HomematicVirtualPlatform.js')
-const Gateway = require(path.join(__dirname , 'lib', 'Gateway.js'))
-
-const util = require('util')
-const url = require('url')
-var HomematicDevice
-
+const Gateway = require(path.join(__dirname, 'lib', 'Gateway.js'))
class DeConzPlatform extends HomematicVirtualPlatform {
-
- constructor(plugin, name, server, log, instance) {
- super(plugin, name, server, log, instance)
- HomematicDevice = server.homematicDevice
- }
-
-
- init () {
-
+ init () {
this.configuration = this.server.configuration
this.connect()
this.plugin.initialized = true
this.log.info('initialization completed %s', this.plugin.initialized)
-}
-
-async connect() {
- if (this.gateway) {
- this.gateway.shutdown()
}
- let self = this
- let host = this.configuration.getValueForPlugin(this.name, 'host', undefined)
+ async connect () {
+ let self = this
+ if (this.gateway) {
+ this.gateway.shutdown()
+ }
+
+ let host = this.configuration.getValueForPlugin(this.name, 'host', undefined)
let key = this.configuration.getValueForPlugin(this.name, 'key', undefined)
- if ((host !== undefined) && (key !== undefined)) {
- this.hmDevices = []
+ if (host !== undefined) {
this.gateway = new Gateway(host, 80, this.log)
+ } else {
+ return
+ }
+
+ if (key !== undefined) {
+ this.hmDevices = []
this.gateway.setApikey(key)
- await this.gateway.connect()
-
- this.gateway.getSensors().map((sensor) => {
-
- switch (sensor.type) {
- case 'ZHASwitch':
- self.log.debug('New ZHASwitch with serial %s',sensor.uniqueid)
- const ZHASwitch = require(path.join(__dirname , 'ZHASwitch.js'))
- let d = new ZHASwitch(self,sensor)
- self.hmDevices.push(d.hmDevice)
- break
-
- case 'ZHAPresence':
- self.log.debug('New ZHAPresence with serial %s',sensor.uniqueid)
- const ZHAPresence = require(path.join(__dirname , 'ZHAPresence.js'))
- let s = new ZHAPresence(self,sensor)
- self.hmDevices.push(s.hmDevice)
- break
+ await this.gateway.connect()
+ this.mapSensors()
+ this.mapActors()
+ this.hmDevices.map(device => {
+ self.log.debug('Device %s', device.serialNumber)
+ })
+ } else {
+ // message to setup gateway into pairing Mode
+ this.gateway.registerApplication('hvlDeConz').then((result, error) => {
+ if (!error) {
+ if ((result.success) && (result.success.username)) {
+ // save the username
+ self.configuration.setValueForPlugin(self.name, 'key', result.success.username)
+ // connect to the gw in 5 ...
+ }
}
+ self.setTimeout(() => { self.connect() }, 5000)
})
}
-}
+ }
+ mapActors () {
+ let self = this
+ var l
+ this.gateway.getLights().map((light) => {
+ switch (light.type) {
+ case 'Extended color light':
+ self.log.debug('New Extended color light %s', light.uniqueid)
+ const ExtendedColorLight = require(path.join(__dirname, 'devices', 'ExtendedColorLight.js'))
+ l = new ExtendedColorLight(self, light)
+ self.hmDevices.push(l.hmDevice)
+ break
+ case 'Color temperature light':
+ self.log.debug('Color temperature light %s', light.uniqueid)
+ const ColorTemperatureLight = require(path.join(__dirname, 'devices', 'ColorTemperatureLight.js'))
+ l = new ColorTemperatureLight(self, light)
+ self.hmDevices.push(l.hmDevice)
-showSettings (dispatched_request) {
- let host = this.configuration.getValueForPlugin(this.name, 'host', '')
- let key = this.configuration.getValueForPlugin(this.name, 'key', '')
+ break
+ }
+ })
+ }
- var result = []
- result.push({ 'control': 'text', 'name': 'host', 'label': 'Phoscon Gateway Host', 'value': host })
- result.push({ 'control': 'text', 'name': 'key', 'label': 'Phoscon API Key', 'value': key })
- return result
-}
+ mapSensors () {
+ let self = this
+ this.gateway.getSensors().map((sensor) => {
+ switch (sensor.type) {
+ case 'ZHASwitch':
+ self.log.debug('New ZHASwitch with serial %s', sensor.uniqueid)
+ const ZHASwitch = require(path.join(__dirname, 'devices', 'ZHASwitch.js'))
+ let d = new ZHASwitch(self, sensor)
+ self.hmDevices.push(d.hmDevice)
+ break
-saveSettings (settings) {
- let host = settings.host
- let key = settings.key
- if ((host) && (key)) {
- this.configuration.setValueForPlugin(this.name, 'host', host)
- this.configuration.setValueForPlugin(this.name, 'key', key)
- this.connect()
+ case 'ZHAPresence':
+ self.log.debug('New ZHAPresence with serial %s', sensor.uniqueid)
+ const ZHAPresence = require(path.join(__dirname, 'devices', 'ZHAPresence.js'))
+ let s = new ZHAPresence(self, sensor)
+ self.hmDevices.push(s.hmDevice)
+ break
+ }
+ })
}
-}
-handleConfigurationRequest (dispatchedRequest) {
- var template = 'index.html'
- var requesturl = dispatchedRequest.request.url
- var queryObject = url.parse(requesturl, true).query
- var deviceList = ''
+ showSettings (dispatched_request) {
+ let host = this.configuration.getValueForPlugin(this.name, 'host', '')
+ let key = this.configuration.getValueForPlugin(this.name, 'key', '')
- if (queryObject['do'] !== undefined) {
- switch (queryObject['do']) {
-
- case 'app.js':
- {
- template = 'app.js'
- }
- break
+ var result = []
+ result.push({ 'control': 'text', 'name': 'host', 'label': 'Phoscon Gateway Host', 'value': host })
+ result.push({ 'control': 'text', 'name': 'key', 'label': 'Phoscon API Key', 'value': key })
+ return result
+ }
+ saveSettings (settings) {
+ let host = settings.host
+ let key = settings.key
+ if ((host) && (key)) {
+ this.configuration.setValueForPlugin(this.name, 'host', host)
+ this.configuration.setValueForPlugin(this.name, 'key', key)
+ this.connect()
}
- } else {
- var devtemplate = dispatchedRequest.getTemplate(this.plugin.pluginPath , "list_device_tmp.html",null);
- this.hmDevices.map(hmdevice=>{
- deviceList = deviceList + dispatchedRequest.fillTemplate(devtemplate,{"device_id":hmdevice.serialNumber});
- })
}
- dispatchedRequest.dispatchFile(this.plugin.pluginPath, template, {'listDevices': deviceList})
-}
+ handleConfigurationRequest (dispatchedRequest) {
+ var template = 'index.html'
+ var requesturl = dispatchedRequest.request.url
+ var queryObject = url.parse(requesturl, true).query
+ var deviceList = ''
+
+ if (queryObject['do'] !== undefined) {
+ switch (queryObject['do']) {
+ case 'app.js':
+ template = 'app.js'
+ break
+ }
+ } else {
+ var devtemplate = dispatchedRequest.getTemplate(this.plugin.pluginPath, 'list_device_tmp.html', null)
+ this.hmDevices.map(hmdevice => {
+ deviceList = deviceList + dispatchedRequest.fillTemplate(devtemplate, {'device_id': hmdevice.serialNumber})
+ })
+ }
+ dispatchedRequest.dispatchFile(this.plugin.pluginPath, template, {'listDevices': deviceList})
+ }
-shutdown () {
- this.log.info("Shutdown")
- this.gateway.shutdown()
-}
+ shutdown () {
+ this.log.info('Shutdown')
+ this.gateway.shutdown()
+ }
}
module.exports = DeConzPlatform
diff --git a/plugins/deConz/ZHAPresence.js b/plugins/deConz/ZHAPresence.js
deleted file mode 100644
index ba5ddf4..0000000
--- a/plugins/deConz/ZHAPresence.js
+++ /dev/null
@@ -1,20 +0,0 @@
-
-const path = require('path')
-
-class ZHAPresence {
-
- constructor(plugin,sensor) {
- let self = this
- var devfile = path.join(__dirname,'HM-Sec-MDIR.json');
- plugin.server.publishHMDevice(plugin.getName(),'HM-Sec-MDIR',devfile,1);
-
- let dSer = 'DEC' + sensor.uniqueid.substring(13,22).replace(/[.:#_()-]/g,'')
- this.hmDevice = plugin.bridge.initDevice(plugin.getName(),dSer,"HM-Sec-MDIR",dSer)
- sensor.on('change', () => {
- let channel = self.hmDevice.getChannelWithTypeAndIndex("MOTION_DETECTOR", 1)
- channel.updateValue('MOTION',sensor.presence,true,true)
- })
- }
-}
-
-module.exports = ZHAPresence
\ No newline at end of file
diff --git a/plugins/deConz/ZHASwitch.js b/plugins/deConz/ZHASwitch.js
deleted file mode 100644
index c99447b..0000000
--- a/plugins/deConz/ZHASwitch.js
+++ /dev/null
@@ -1,106 +0,0 @@
-
-const path = require('path')
-
-class ZHASwitch {
-
-
- constructor(plugin,sensor) {
- let self = this
- var devfile = path.join(__dirname,'HM-RC-8.json');
- plugin.server.publishHMDevice(plugin.getName(),'HM-RC-8',devfile,1);
-
- let dSer = 'DEC' + sensor.uniqueid.substring(13,22).replace(/[.:#_()-]/g,'')
- this.hmDevice = plugin.bridge.initDevice(plugin.getName(),dSer,"HM-RC-8",dSer)
- sensor.on('change', () => {
- var channel
- switch (sensor.buttonevent) {
- case 1001:
- self.contPress(1)
- break
- case 1002:
- self.keyPress(1,'PRESS_SHORT',true)
- break
- case 1003:
- {
- self.keyPress(1,'PRESS_LONG',true)
- self.keyPress(1,'PRESS_LONG_RELEASE',true)
- }
- break
-
- case 2001:
- self.contPress(2)
- break
- case 2002:
- self.keyPress(2,'PRESS_SHORT',true)
- break
- case 2003:
- {
- self.keyPress(2,'PRESS_LONG',true)
- self.keyPress(2,'PRESS_LONG_RELEASE',true)
- }
- break
-
- case 3001:
- self.contPress(3)
- break
- case 3002:
- self.keyPress(3,'PRESS_SHORT',true)
- break
- case 3003:
- {
- self.keyPress(3,'PRESS_LONG',true)
- self.keyPress(3,'PRESS_LONG_RELEASE',true)
- }
- break
-
- case 4001:
- self.contPress(4)
- break
- case 4002:
- self.keyPress(4,'PRESS_SHORT',true)
- break
- case 4003:
- {
- self.keyPress(4,'PRESS_LONG',true)
- self.keyPress(4,'PRESS_LONG_RELEASE',true)
- }
- break
-
- case 5001:
- self.contPress(5)
- break
- case 5002:
- self.keyPress(5,'PRESS_SHORT',true)
- break
- case 5003:
- {
- self.keyPress(5,'PRESS_LONG',true)
- self.keyPress(5,'PRESS_LONG_RELEASE',true)
- }
- break
- }
- })
- }
-
- contPress(channelId) {
- clearInterval(this.tmr)
- let channel = this.hmDevice.getChannelWithTypeAndIndex("KEY", channelId)
- this.tmr = setInterval(()=>{
- channel.updateValue('PRESS_CONT',1,true,true)
- },500)
- }
-
- keyPress(channelId,keyEvent,autoRelease) {
- clearInterval(this.tmr)
- let channel = this.hmDevice.getChannelWithTypeAndIndex("KEY", channelId)
- channel.updateValue(keyEvent,1,true,true)
- if (autoRelease) {
- setTimeout(function(){
- channel.updateValue(keyEvent,0,true)
- }, 500)
- }
- }
-}
-
-
-module.exports = ZHASwitch
\ No newline at end of file
diff --git a/plugins/deConz/devices/BasicLight.js b/plugins/deConz/devices/BasicLight.js
new file mode 100644
index 0000000..a811ae5
--- /dev/null
+++ b/plugins/deConz/devices/BasicLight.js
@@ -0,0 +1,155 @@
+const { timingSafeEqual } = require('crypto')
+/*
+ * File: ExtendedColorLight.js
+ * Project: homematic-virtual-deConz
+ * File Created: Sunday, 27th September 2020 1:44:28 pm
+ * Author: Thomas Kluge (th.kluge@me.com)
+ * -----
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Thomas Kluge (https://github.com/thkl)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ * ==========================================================================
+ */
+
+const path = require('path')
+const DeConzDevice = require(path.join(__dirname, 'DeConzDevice.js'))
+
+class BasicLight extends DeConzDevice {
+ constructor (plugin, light, hmType = 'HM-LC-Dim1T-Pl') {
+ super(plugin, light, hmType)
+ let self = this
+ this.defaultTransitiontime = 0.5
+ this.transitiontime = 0.5
+
+ light.on('change', () => {
+ self.handleLightChangeEvent(light)
+ })
+
+ self.hmDevice.on('device_channel_value_change', async (parameter) => {
+ if (await self.handleCCUEvent(parameter)) {
+ self.gwDevice.lightState = self.currentState
+ }
+ })
+ // set the new Values at init
+ light.emit('change')
+ }
+
+ async handleCCUEvent (parameter) {
+ let self = this
+ var newValue = parameter.newValue
+ var channel = this.hmDevice.getChannel(parameter.channel)
+ this.log.debug('CCU Event on %s - %s with %s', this.hmDevice.serialNumber, parameter.name, newValue)
+ this.log.debug('Get Current state')
+ await this.gateway.updateLightState(this.gwDevice)
+ this.currentState = this.gwDevice.lightState
+ this.log.debug('Get Current state done ')
+ var changed = false
+
+ if (parameter.name === 'INSTALL_TEST') {
+ let max = this.currentState.max('bri')
+ let min = this.currentState.min('bri')
+ this.currentState.on()
+ this.currentState.bri(max)
+ changed = true
+
+ setTimeout(function () {
+ this.currentState.bri(min)
+ this.currentState.off()
+ self.gwDevice.lightState = this.currentState
+ }, 1000)
+ }
+
+ if (parameter.name === 'LEVEL') {
+ this.setLevel(channel, newValue)
+ changed = true
+ }
+
+ if ((parameter.name === 'RAMP_TIME') && (channel.index === '1')) {
+ this.transitiontime = newValue * 10
+ channel.updateValue('RAMP_TIME', newValue, true, true)
+ }
+
+ if (parameter.name === 'OLD_LEVEL') {
+ if (newValue === true) {
+ this.log.debug('Recovering old level')
+ if (this.oldLevel === undefined) {
+ this.oldLevel = 1
+ this.log.debug('No old level found set to 1')
+ }
+ channel.updateValue('OLD_LEVEL', true)
+ this.setLevel(channel, this.oldLevel)
+ }
+ changed = true
+ }
+ return changed
+ }
+
+ setLevel (channel, newLevel) {
+ this.log.debug('Set new Level %s', newLevel)
+ let max = this.currentState.max('bri')
+ let min = this.currentState.min('bri')
+ let value = (newLevel * max)
+ if (value < min) {
+ value = min
+ }
+ this.log.debug('Set Brightness %s', value)
+ this.currentState.bri(value)
+
+ if (value > min) {
+ this.currentState.on()
+ // We have to Send hue and sat cause they may have changed in off state
+ if (this.currentSat) {
+ this.currentState.sat(this.currentSat)
+ }
+ if (this.currentHue) {
+ this.currentState.hue(this.currentHue)
+ }
+ } else {
+ this.currentState.off()
+ }
+ this.currentState.transitiontime(this.transitiontime * 10)
+ this.log.debug('Update Channel %s With Level %s', channel.address, newLevel)
+ channel.updateValue('LEVEL', newLevel, true, true)
+ if (newLevel > 0) {
+ this.oldLevel = newLevel
+ }
+ }
+
+ handleLightChangeEvent (light, dimmerChannel = 'DIMMER') {
+ let self = this
+ this.log.debug('Gateway Event %s', JSON.stringify(light.lightState))
+ // Check what was changed
+ let state = light.lightState
+ // fest set the brightness
+ let bChannel = self.hmDevice.getChannelWithTypeAndIndex(dimmerChannel, 1)
+ bChannel.startUpdating('LEVEL')
+ if (state.isOn()) {
+ let bri = state.bri()
+ let max = state.max('bri')
+ bChannel.updateValue('LEVEL', Number((bri / max).toFixed(2)), true, true)
+ } else {
+ bChannel.updateValue('LEVEL', 0, true, true)
+ }
+ bChannel.endUpdating('LEVEL')
+ }
+}
+
+module.exports = BasicLight
diff --git a/plugins/deConz/devices/ColorTemperatureLight.js b/plugins/deConz/devices/ColorTemperatureLight.js
new file mode 100644
index 0000000..fc32474
--- /dev/null
+++ b/plugins/deConz/devices/ColorTemperatureLight.js
@@ -0,0 +1,41 @@
+const path = require('path')
+const BasicLight = require(path.join(__dirname, 'BasicLight.js'))
+
+class ColorTemperatureLight extends BasicLight {
+ constructor (plugin, light) {
+ super(plugin, light, 'VIR-LG-WHITE-DIM')
+ }
+
+ async handleCCUEvent (parameter) {
+ let changed = await super.handleCCUEvent(parameter)
+
+ var newValue = parameter.newValue
+ var channel = this.hmDevice.getChannel(parameter.channel)
+
+ if (parameter.name === 'WHITE') {
+ let colorTemp = Number(parseInt(newValue) / 10).toFixed(0)
+ this.currentState.ct(colorTemp)
+ channel.updateValue('WHITE', newValue, true, true)
+ changed = true
+ }
+ return changed
+ }
+
+ handleLightChangeEvent (light) {
+ let self = this
+ super.handleLightChangeEvent(light, 'VIR-LG_WHITE-DIM-CH')
+
+ let state = light.lightState
+ let cChannel = self.hmDevice.getChannelWithTypeAndIndex('VIR-LG_WHITE-DIM-CH', 1)
+ if (cChannel) {
+ cChannel.startUpdating('WHITE')
+ let colorTemp = state.ct()
+ cChannel.updateValue('WHITE', (colorTemp * 10), true)
+ cChannel.endUpdating('WHITE')
+ } else {
+ this.log.warn('Channel %s %s not found', 1, 'VIR-LG_WHITE-DIM-CH')
+ }
+ }
+}
+
+module.exports = ColorTemperatureLight
diff --git a/plugins/deConz/devices/DeConzDevice.js b/plugins/deConz/devices/DeConzDevice.js
new file mode 100644
index 0000000..3bd21c1
--- /dev/null
+++ b/plugins/deConz/devices/DeConzDevice.js
@@ -0,0 +1,47 @@
+/*
+ * File: DeConzDevice.js
+ * Project: homematic-virtual-deConz
+ * File Created: Sunday, 27th September 2020 1:48:28 pm
+ * Author: Thomas Kluge (th.kluge@me.com)
+ * -----
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Thomas Kluge (https://github.com/thkl)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ * ==========================================================================
+ */
+
+const path = require('path')
+
+class DeConzDevice {
+ constructor (plugin, device, hmType) {
+ var devfile = path.join(__dirname, 'definitions', hmType + '.json')
+ plugin.server.publishHMDevice(plugin.getName(), hmType, devfile, 1)
+ let dSer = 'DEC' + device.uniqueid.substring(13, 22).replace(/[.:#_()-]/g, '')
+ this.hmDevice = plugin.bridge.initDevice(plugin.getName(), dSer, hmType, dSer)
+ this.gwDevice = device
+ this.log = plugin.log
+ this.plugin = plugin
+ this.gateway = plugin.gateway
+ this.log.debug('adding %s of type %s', dSer, hmType)
+ }
+}
+
+module.exports = DeConzDevice
diff --git a/plugins/deConz/devices/ExtendedColorLight.js b/plugins/deConz/devices/ExtendedColorLight.js
new file mode 100644
index 0000000..4da811b
--- /dev/null
+++ b/plugins/deConz/devices/ExtendedColorLight.js
@@ -0,0 +1,73 @@
+/*
+ * File: ExtendedColorLight.js
+ * Project: homematic-virtual-deConz
+ * File Created: Sunday, 27th September 2020 1:44:28 pm
+ * Author: Thomas Kluge (th.kluge@me.com)
+ * -----
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Thomas Kluge (https://github.com/thkl)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ * ==========================================================================
+ */
+
+const path = require('path')
+const BasicLight = require(path.join(__dirname, 'BasicLight.js'))
+
+class ExtendedColorLight extends BasicLight {
+ constructor (plugin, light) {
+ super(plugin, light, 'HM-LC-RGBW-WM')
+ }
+
+ async handleCCUEvent (parameter) {
+ let changed = await super.handleCCUEvent(parameter)
+
+ var newValue = parameter.newValue
+ var channel = this.hmDevice.getChannel(parameter.channel)
+
+ if (parameter.name === 'COLOR') {
+ if (newValue === 200) {
+ this.currentHue = 39609
+ this.currentSat = 128
+ } else {
+ this.currentHue = (newValue / 199) * 65535
+ this.currentSat = 254
+ }
+ this.currentState.hue(this.currentHue)
+ this.currentState.sat(this.currentSat)
+ channel.updateValue('COLOR', newValue)
+ changed = true
+ }
+ return changed
+ }
+
+ handleLightChangeEvent (light) {
+ let self = this
+ super.handleLightChangeEvent(light)
+
+ let state = light.lightState
+ let cChannel = self.hmDevice.getChannelWithTypeAndIndex('RGBW_COLOR', 2)
+ cChannel.startUpdating('COLOR')
+ cChannel.updateValue('COLOR', Math.round((state.hue() / 65535) * 199))
+ cChannel.endUpdating('COLOR')
+ }
+}
+
+module.exports = ExtendedColorLight
diff --git a/plugins/deConz/devices/ZHAPresence.js b/plugins/deConz/devices/ZHAPresence.js
new file mode 100644
index 0000000..4019965
--- /dev/null
+++ b/plugins/deConz/devices/ZHAPresence.js
@@ -0,0 +1,45 @@
+/*
+ * File: ZHAPresence.js
+ * Project: homematic-virtual-deConz
+ * File Created: Saturday, 26th September 2020 8:15:36 pm
+ * Author: Thomas Kluge (th.kluge@me.com)
+ * -----
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Thomas Kluge (https://github.com/thkl)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ * ==========================================================================
+ */
+
+const path = require('path')
+const DeConzDevice = require(path.join(__dirname, 'DeConzDevice.js'))
+
+class ZHAPresence extends DeConzDevice {
+ constructor (plugin, sensor) {
+ super(plugin, sensor, 'HM-Sec-MDIR')
+ let self = this
+ sensor.on('change', () => {
+ let channel = self.hmDevice.getChannelWithTypeAndIndex('MOTION_DETECTOR', 1)
+ channel.updateValue('MOTION', sensor.presence, true, true)
+ })
+ }
+}
+
+module.exports = ZHAPresence
diff --git a/plugins/deConz/devices/ZHASwitch.js b/plugins/deConz/devices/ZHASwitch.js
new file mode 100644
index 0000000..1a390f1
--- /dev/null
+++ b/plugins/deConz/devices/ZHASwitch.js
@@ -0,0 +1,116 @@
+/*
+ * File: ZHASwitch.js
+ * Project: homematic-virtual-deConz
+ * File Created: Saturday, 26th September 2020 4:35:25 pm
+ * Author: Thomas Kluge (th.kluge@me.com)
+ * -----
+ * The MIT License (MIT)
+ *
+ * Copyright (c) Thomas Kluge (https://github.com/thkl)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ * ==========================================================================
+ */
+
+const path = require('path')
+const DeConzDevice = require(path.join(__dirname, 'DeConzDevice.js'))
+
+class ZHASwitch extends DeConzDevice {
+ constructor (plugin, sensor) {
+ super(plugin, sensor, 'HM-RC-8')
+ let self = this
+ sensor.on('change', () => {
+ switch (sensor.buttonevent) {
+ case 1001:
+ self.contPress(1)
+ break
+ case 1002:
+ self.keyPress(1, 'PRESS_SHORT', true)
+ break
+ case 1003:
+ self.keyPress(1, 'PRESS_LONG', true)
+ self.keyPress(1, 'PRESS_LONG_RELEASE', true)
+ break
+
+ case 2001:
+ self.contPress(2)
+ break
+ case 2002:
+ self.keyPress(2, 'PRESS_SHORT', true)
+ break
+ case 2003:
+ self.keyPress(2, 'PRESS_LONG', true)
+ self.keyPress(2, 'PRESS_LONG_RELEASE', true)
+ break
+
+ case 3001:
+ self.contPress(3)
+ break
+ case 3002:
+ self.keyPress(3, 'PRESS_SHORT', true)
+ break
+ case 3003:
+ self.keyPress(3, 'PRESS_LONG', true)
+ self.keyPress(3, 'PRESS_LONG_RELEASE', true)
+ break
+ case 4001:
+ self.contPress(4)
+ break
+ case 4002:
+ break
+ case 4003:
+ self.keyPress(4, 'PRESS_LONG', true)
+ self.keyPress(4, 'PRESS_LONG_RELEASE', true)
+ break
+
+ case 5001:
+ self.contPress(5)
+ break
+ case 5002:
+ self.keyPress(5, 'PRESS_SHORT', true)
+ break
+ case 5003:
+ self.keyPress(5, 'PRESS_LONG', true)
+ self.keyPress(5, 'PRESS_LONG_RELEASE', true)
+ break
+ }
+ })
+ }
+
+ contPress (channelId) {
+ clearInterval(this.tmr)
+ let channel = this.hmDevice.getChannelWithTypeAndIndex('KEY', channelId)
+ this.tmr = setInterval(() => {
+ channel.updateValue('PRESS_CONT', 1, true, true)
+ }, 500)
+ }
+
+ keyPress (channelId, keyEvent, autoRelease) {
+ clearInterval(this.tmr)
+ let channel = this.hmDevice.getChannelWithTypeAndIndex('KEY', channelId)
+ channel.updateValue(keyEvent, 1, true, true)
+ if (autoRelease) {
+ setTimeout(function () {
+ channel.updateValue(keyEvent, 0, true)
+ }, 500)
+ }
+ }
+}
+
+module.exports = ZHASwitch
diff --git a/plugins/deConz/devices/definitions/HM-LC-Dim1T-Pl.json b/plugins/deConz/devices/definitions/HM-LC-Dim1T-Pl.json
new file mode 100644
index 0000000..f21ba99
--- /dev/null
+++ b/plugins/deConz/devices/definitions/HM-LC-Dim1T-Pl.json
@@ -0,0 +1,820 @@
+{
+ "paramsets": [{
+ "name": "MASTER",
+ "id": "dimmer_dev_master",
+ "parameter": [{
+ "flags": 3,
+ "tab_order": 0,
+ "name": "INTERNAL_KEYS_VISIBLE",
+ "type": "BOOL",
+ "vdefault": 0
+ }, {
+ "unit": "minutes",
+ "vdefault": 5,
+ "min": 1,
+ "tab_order": 1,
+ "flags": 1,
+ "max": 254,
+ "name": "CONF_BUTTON_TIME",
+ "type": "INTEGER"
+ }]
+ }],
+ "channels": [{
+ "flags": 3,
+ "paramsets": [{
+ "name": "MASTER",
+ "id": "maint_ch_master",
+ "parameter": []
+ }, {
+ "name": "VALUES",
+ "id": "maint_ch_values",
+ "parameter": [{
+ "flags": 9,
+ "operations": 5,
+ "name": "UNREACH",
+ "type": "BOOL",
+ "tab_order": 0
+ }, {
+ "flags": 24,
+ "operations": 7,
+ "name": "STICKY_UNREACH",
+ "type": "BOOL",
+ "tab_order": 1
+ }, {
+ "flags": 9,
+ "operations": 5,
+ "name": "CONFIG_PENDING",
+ "type": "BOOL",
+ "tab_order": 2
+ }, {
+ "flags": 9,
+ "operations": 5,
+ "name": "DUTYCYCLE",
+ "type": "BOOL",
+ "tab_order": 3
+ }, {
+ "flags": 1,
+ "operations": 5,
+ "name": "RSSI_DEVICE",
+ "type": "INTEGER",
+ "tab_order": 4
+ }, {
+ "flags": 1,
+ "operations": 5,
+ "name": "RSSI_PEER",
+ "type": "INTEGER",
+ "tab_order": 5
+ }]
+ }],
+ "type": "MAINTENANCE",
+ "adress": "0",
+ "direction": 2
+ }, {
+ "flags": 1,
+ "paramsets": [{
+ "name": "MASTER",
+ "id": "dimmer_ch_master",
+ "parameter": [{
+ "type": "INTEGER",
+ "vdefault": 6,
+ "min": 0,
+ "tab_order": 0,
+ "flags": 1,
+ "max": 10,
+ "name": "TRANSMIT_TRY_MAX",
+ "operations": 3
+ }, {
+ "type": "INTEGER",
+ "vdefault": 75,
+ "min": 30,
+ "unit": "�C",
+ "tab_order": 1,
+ "flags": 1,
+ "max": 100,
+ "name": "REDUCE_TEMP_LEVEL",
+ "operations": 3
+ }, {
+ "type": "FLOAT",
+ "vdefault": 0,
+ "min": 0,
+ "unit": "100%",
+ "tab_order": 2,
+ "flags": 1,
+ "max": 1,
+ "name": "REDUCE_LEVEL",
+ "operations": 3
+ }, {
+ "type": "INTEGER",
+ "vdefault": 80,
+ "min": 30,
+ "unit": "�C",
+ "tab_order": 3,
+ "flags": 1,
+ "max": 100,
+ "name": "OVERTEMP_LEVEL",
+ "operations": 3
+ }, {
+ "type": "FLOAT",
+ "vdefault": 1,
+ "min": 0,
+ "unit": "s",
+ "tab_order": 4,
+ "flags": 1,
+ "max": 2,
+ "name": "FUSE_DELAY",
+ "operations": 3
+ }, {
+ "flags": 1,
+ "tab_order": 5,
+ "operations": 3,
+ "name": "POWERUP_ACTION",
+ "type": "ENUM",
+ "valuelist": ["POWERUP_OFF", "POWERUP_ON"]
+ }, {
+ "type": "FLOAT",
+ "vdefault": 2,
+ "min": 0,
+ "unit": "s",
+ "tab_order": 6,
+ "flags": 1,
+ "max": 15,
+ "name": "STATUSINFO_MINDELAY",
+ "operations": 3
+ }, {
+ "type": "FLOAT",
+ "vdefault": 1,
+ "min": 0,
+ "unit": "s",
+ "tab_order": 7,
+ "flags": 1,
+ "max": 7,
+ "name": "STATUSINFO_RANDOM",
+ "operations": 3
+ }]
+ }, {
+ "name": "VALUES",
+ "id": "dimmer_ch_values",
+ "parameter": [
+ {
+ "operations": 7,
+ "vdefault": 0,
+ "min": 0,
+ "max": 1,
+ "unit": "100%",
+ "tab_order": 0,
+ "flags": 1,
+ "type": "FLOAT",
+ "name": "LEVEL",
+ "control": "DIMMER.LEVEL"
+ }, {
+ "name": "OLD_LEVEL",
+ "operations": 2,
+ "tab_order": 1,
+ "max": "",
+ "control": "NONE",
+ "min": "",
+ "type": "ACTION",
+ "flags": 1,
+ "vdefault": ""
+ },
+ {
+ "operations": 2,
+ "vdefault": 0,
+ "min": 0,
+ "max": 85825945,
+ "unit": "s",
+ "tab_order": 2,
+ "flags": 1,
+ "type": "FLOAT",
+ "name": "RAMP_TIME",
+ "control": "NONE"
+ }, {
+ "operations": 2,
+ "vdefault": 0,
+ "min": 0,
+ "max": 85825945,
+ "unit": "s",
+ "tab_order": 3,
+ "flags": 1,
+ "type": "FLOAT",
+ "name": "ON_TIME",
+ "control": "NONE"
+ }, {
+ "flags": 1,
+ "control": "NONE",
+ "operations": 2,
+ "name": "RAMP_STOP",
+ "type": "",
+ "tab_order": 4
+ }, {
+ "flags": 1,
+ "control": "NONE",
+ "operations": 7,
+ "name": "INHIBIT",
+ "type": "BOOL",
+ "tab_order": 5
+ }, {
+ "flags": 3,
+ "tab_order": 6,
+ "operations": 5,
+ "name": "WORKING",
+ "type": "BOOL",
+ "vdefault": 0
+ }, {
+ "flags": 3,
+ "tab_order": 7,
+ "operations": 5,
+ "name": "DIRECTION",
+ "type": "ENUM",
+ "valuelist": ["NONE", "UP", "DOWN", "UNDEFINED"]
+ }, {
+ "operations": 5,
+ "type": "BOOL",
+ "vdefault": 0,
+ "flags": 9,
+ "tab_order": 8,
+ "name": "ERROR_REDUCED",
+ "control": "NONE"
+ }, {
+ "operations": 5,
+ "type": "BOOL",
+ "vdefault": 0,
+ "flags": 9,
+ "tab_order": 9,
+ "name": "ERROR_OVERLOAD",
+ "control": "NONE"
+ }, {
+ "operations": 5,
+ "type": "BOOL",
+ "vdefault": 0,
+ "flags": 9,
+ "tab_order": 10,
+ "name": "ERROR_OVERHEAT",
+ "control": "NONE"
+ }, {
+ "flags": 3,
+ "operations": 2,
+ "name": "INSTALL_TEST",
+ "type": "",
+ "tab_order": 11
+ }]
+ }, {
+ "name": "LINK",
+ "id": "dimmer_ch_link",
+ "parameter": [{
+ "flags": 1,
+ "tab_order": 0,
+ "name": "UI_HINT",
+ "type": "STRING",
+ "vdefault": 0
+ }, {
+ "flags": 1,
+ "tab_order": 1,
+ "name": "SHORT_CT_RAMPOFF",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "flags": 1,
+ "tab_order": 2,
+ "name": "SHORT_CT_RAMPON",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "flags": 1,
+ "tab_order": 3,
+ "name": "SHORT_CT_OFFDELAY",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "flags": 1,
+ "tab_order": 4,
+ "name": "SHORT_CT_ONDELAY",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "flags": 1,
+ "tab_order": 5,
+ "name": "SHORT_CT_OFF",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "flags": 1,
+ "tab_order": 6,
+ "name": "SHORT_CT_ON",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "type": "INTEGER",
+ "vdefault": 50,
+ "min": 0,
+ "flags": 1,
+ "max": 255,
+ "tab_order": 7,
+ "name": "SHORT_COND_VALUE_LO"
+ }, {
+ "type": "INTEGER",
+ "vdefault": 100,
+ "min": 0,
+ "flags": 1,
+ "max": 255,
+ "tab_order": 8,
+ "name": "SHORT_COND_VALUE_HI"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 9,
+ "flags": 1,
+ "max": 111600,
+ "name": "SHORT_ONDELAY_TIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 111600,
+ "min": 0,
+ "tab_order": 10,
+ "flags": 1,
+ "max": 108000,
+ "name": "SHORT_ON_TIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 11,
+ "flags": 1,
+ "max": 111600,
+ "name": "SHORT_OFFDELAY_TIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 111600,
+ "min": 0,
+ "tab_order": 12,
+ "flags": 1,
+ "max": 108000,
+ "name": "SHORT_OFF_TIME",
+ "type": "FLOAT"
+ }, {
+ "flags": 1,
+ "tab_order": 13,
+ "name": "SHORT_ON_TIME_MODE",
+ "type": "ENUM",
+ "valuelist": ["ABSOLUTE", "MINIMAL"]
+ }, {
+ "flags": 1,
+ "tab_order": 14,
+ "name": "SHORT_OFF_TIME_MODE",
+ "type": "ENUM",
+ "valuelist": ["ABSOLUTE", "MINIMAL"]
+ }, {
+ "flags": 1,
+ "tab_order": 15,
+ "name": "SHORT_ACTION_TYPE",
+ "type": "ENUM",
+ "valuelist": ["INACTIVE", "JUMP_TO_TARGET", "TOGGLE_TO_COUNTER", "TOGGLE_INVERS_TO_COUNTER", "UPDIM", "DOWNDIM", "TOGGLEDIM", "TOGGLEDIM_TO_COUNTER", "TOGGLEDIM_INVERS_TO_COUNTER"]
+ }, {
+ "flags": 1,
+ "tab_order": 16,
+ "name": "SHORT_JT_OFF",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 17,
+ "name": "SHORT_JT_ON",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 18,
+ "name": "SHORT_JT_OFFDELAY",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 19,
+ "name": "SHORT_JT_ONDELAY",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 20,
+ "name": "SHORT_JT_RAMPOFF",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 21,
+ "name": "SHORT_JT_RAMPON",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 22,
+ "name": "SHORT_ONDELAY_MODE",
+ "type": "ENUM",
+ "valuelist": ["SET_TO_OFF", "NO_CHANGE"]
+ }, {
+ "flags": 1,
+ "tab_order": 23,
+ "name": "SHORT_ON_LEVEL_PRIO",
+ "type": "ENUM",
+ "valuelist": ["HIGH", "LOW"]
+ }, {
+ "flags": 1,
+ "tab_order": 24,
+ "name": "SHORT_OFFDELAY_BLINK",
+ "type": "ENUM",
+ "valuelist": ["OFF", "ON"]
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 25,
+ "flags": 1,
+ "max": 1,
+ "name": "SHORT_OFF_LEVEL",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 26,
+ "flags": 1,
+ "max": 1,
+ "name": "SHORT_ON_MIN_LEVEL",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 1,
+ "min": 0,
+ "tab_order": 27,
+ "flags": 1,
+ "max": 1,
+ "name": "SHORT_ON_LEVEL",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 28,
+ "flags": 1,
+ "max": 1,
+ "name": "SHORT_RAMP_START_STEP",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 29,
+ "flags": 1,
+ "max": 111600,
+ "name": "SHORT_RAMPON_TIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 30,
+ "flags": 1,
+ "max": 111600,
+ "name": "SHORT_RAMPOFF_TIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 31,
+ "flags": 1,
+ "max": 1,
+ "name": "SHORT_DIM_MIN_LEVEL",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 1,
+ "min": 0,
+ "tab_order": 32,
+ "flags": 1,
+ "max": 1,
+ "name": "SHORT_DIM_MAX_LEVEL",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 33,
+ "flags": 1,
+ "max": 1,
+ "name": "SHORT_DIM_STEP",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 34,
+ "flags": 1,
+ "max": 1,
+ "name": "SHORT_OFFDELAY_STEP",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 35,
+ "flags": 1,
+ "max": 25,
+ "name": "SHORT_OFFDELAY_NEWTIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 36,
+ "flags": 1,
+ "max": 25,
+ "name": "SHORT_OFFDELAY_OLDTIME",
+ "type": "FLOAT"
+ }, {
+ "flags": 1,
+ "tab_order": 37,
+ "name": "LONG_CT_RAMPOFF",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "flags": 1,
+ "tab_order": 38,
+ "name": "LONG_CT_RAMPON",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "flags": 1,
+ "tab_order": 39,
+ "name": "LONG_CT_OFFDELAY",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "flags": 1,
+ "tab_order": 40,
+ "name": "LONG_CT_ONDELAY",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "flags": 1,
+ "tab_order": 41,
+ "name": "LONG_CT_OFF",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "flags": 1,
+ "tab_order": 42,
+ "name": "LONG_CT_ON",
+ "type": "ENUM",
+ "valuelist": ["X GE COND_VALUE_LO", "X GE COND_VALUE_HI", "X LT COND_VALUE_LO", "X LT COND_VALUE_HI", "COND_VALUE_LO LE X LT COND_VALUE_HI", "X LT COND_VALUE_LO OR X GE COND_VALUE_HI"]
+ }, {
+ "type": "INTEGER",
+ "vdefault": 50,
+ "min": 0,
+ "flags": 1,
+ "max": 255,
+ "tab_order": 43,
+ "name": "LONG_COND_VALUE_LO"
+ }, {
+ "type": "INTEGER",
+ "vdefault": 100,
+ "min": 0,
+ "flags": 1,
+ "max": 255,
+ "tab_order": 44,
+ "name": "LONG_COND_VALUE_HI"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 45,
+ "flags": 1,
+ "max": 111600,
+ "name": "LONG_ONDELAY_TIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 111600,
+ "min": 0,
+ "tab_order": 46,
+ "flags": 1,
+ "max": 108000,
+ "name": "LONG_ON_TIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 47,
+ "flags": 1,
+ "max": 111600,
+ "name": "LONG_OFFDELAY_TIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 111600,
+ "min": 0,
+ "tab_order": 48,
+ "flags": 1,
+ "max": 108000,
+ "name": "LONG_OFF_TIME",
+ "type": "FLOAT"
+ }, {
+ "flags": 1,
+ "tab_order": 49,
+ "name": "LONG_ON_TIME_MODE",
+ "type": "ENUM",
+ "valuelist": ["ABSOLUTE", "MINIMAL"]
+ }, {
+ "flags": 1,
+ "tab_order": 50,
+ "name": "LONG_OFF_TIME_MODE",
+ "type": "ENUM",
+ "valuelist": ["ABSOLUTE", "MINIMAL"]
+ }, {
+ "flags": 1,
+ "tab_order": 51,
+ "name": "LONG_MULTIEXECUTE",
+ "type": "ENUM",
+ "valuelist": ["OFF", "ON"]
+ }, {
+ "flags": 1,
+ "tab_order": 52,
+ "name": "LONG_ACTION_TYPE",
+ "type": "ENUM",
+ "valuelist": ["INACTIVE", "JUMP_TO_TARGET", "TOGGLE_TO_COUNTER", "TOGGLE_INVERS_TO_COUNTER", "UPDIM", "DOWNDIM", "TOGGLEDIM", "TOGGLEDIM_TO_COUNTER", "TOGGLEDIM_INVERS_TO_COUNTER"]
+ }, {
+ "flags": 1,
+ "tab_order": 53,
+ "name": "LONG_JT_OFF",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 54,
+ "name": "LONG_JT_ON",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 55,
+ "name": "LONG_JT_OFFDELAY",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 56,
+ "name": "LONG_JT_ONDELAY",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 57,
+ "name": "LONG_JT_RAMPOFF",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 58,
+ "name": "LONG_JT_RAMPON",
+ "type": "ENUM",
+ "valuelist": ["NO_JUMP_IGNORE_COMMAND", "ONDELAY", "RAMPON", "ON", "OFFDELAY", "RAMPOFF", "OFF"]
+ }, {
+ "flags": 1,
+ "tab_order": 59,
+ "name": "LONG_ONDELAY_MODE",
+ "type": "ENUM",
+ "valuelist": ["SET_TO_OFF", "NO_CHANGE"]
+ }, {
+ "flags": 1,
+ "tab_order": 60,
+ "name": "LONG_ON_LEVEL_PRIO",
+ "type": "ENUM",
+ "valuelist": ["HIGH", "LOW"]
+ }, {
+ "flags": 1,
+ "tab_order": 61,
+ "name": "LONG_OFFDELAY_BLINK",
+ "type": "ENUM",
+ "valuelist": ["OFF", "ON"]
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 62,
+ "flags": 1,
+ "max": 1,
+ "name": "LONG_OFF_LEVEL",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 63,
+ "flags": 1,
+ "max": 1,
+ "name": "LONG_ON_MIN_LEVEL",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 1,
+ "min": 0,
+ "tab_order": 64,
+ "flags": 1,
+ "max": 1,
+ "name": "LONG_ON_LEVEL",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 65,
+ "flags": 1,
+ "max": 1,
+ "name": "LONG_RAMP_START_STEP",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 66,
+ "flags": 1,
+ "max": 111600,
+ "name": "LONG_RAMPON_TIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 67,
+ "flags": 1,
+ "max": 111600,
+ "name": "LONG_RAMPOFF_TIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 68,
+ "flags": 1,
+ "max": 1,
+ "name": "LONG_DIM_MIN_LEVEL",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 1,
+ "min": 0,
+ "tab_order": 69,
+ "flags": 1,
+ "max": 1,
+ "name": "LONG_DIM_MAX_LEVEL",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 70,
+ "flags": 1,
+ "max": 1,
+ "name": "LONG_DIM_STEP",
+ "type": "FLOAT"
+ }, {
+ "unit": "100%",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 71,
+ "flags": 1,
+ "max": 1,
+ "name": "LONG_OFFDELAY_STEP",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 72,
+ "flags": 1,
+ "max": 25,
+ "name": "LONG_OFFDELAY_NEWTIME",
+ "type": "FLOAT"
+ }, {
+ "unit": "s",
+ "vdefault": 0,
+ "min": 0,
+ "tab_order": 73,
+ "flags": 1,
+ "max": 25,
+ "name": "LONG_OFFDELAY_OLDTIME",
+ "type": "FLOAT"
+ }]
+ }],
+ "type": "DIMMER",
+ "adress": "1",
+ "direction": 2
+ }],
+ "type": "HM-LC-Dim1T-Pl",
+ "version": 41
+}
\ No newline at end of file
diff --git a/plugins/deConz/devices/definitions/HM-LC-RGBW-WM.json b/plugins/deConz/devices/definitions/HM-LC-RGBW-WM.json
new file mode 100644
index 0000000..2037d17
--- /dev/null
+++ b/plugins/deConz/devices/definitions/HM-LC-RGBW-WM.json
@@ -0,0 +1,126 @@
+{
+ "channels": [
+ {
+ "adress": "0",
+ "type": "MAINTENANCE",
+ "flags": 3,
+ "direction" : 0,
+ "paramsets": [
+ {
+ "name" : "MASTER",
+ "id" : "maint_ch_master",
+ "parameter" : []
+ },
+
+ {
+ "name" : "VALUES",
+ "id" : "maint_ch_values",
+ "parameter" : [
+ {"name": "AES_KEY","vdefault": 0,"flags": 0,"max": 127,"min": 0,"operations": 1,"tab_order": 9,"type": "INTEGER"},
+ {"name": "CONFIG_PENDING","vdefault": 0,"flags": 9,"max": 1,"min": 0,"operations": 5,"tab_order": 2,"type": "BOOL"},
+ {"name": "DEVICE_IN_BOOTLOADER","vdefault": 0,"flags": 9,"max": 1,"min": 0,"operations": 5,"tab_order": 7,"type": "BOOL"},
+ {"name": "DUTYCYCLE","vdefault": 0,"flags": 9,"max": 1,"min": 0,"operations": 5,"tab_order": 4,"type": "BOOL"},
+ {"name": "RSSI_DEVICE","vdefault": 0,"flags": 1,"max": 2147483647,"min": 2147483648,"operations": 5,"tab_order": 5,"type": "INTEGER"},
+ {"name": "RSSI_PEER","vdefault": 0,"flags": 1,"max": 2147483647,"min": 2147483648,"operations": 5,"tab_order": 6,"type": "INTEGER"},
+ {"name": "STICKY_UNREACH","vdefault": 0,"flags": 25, "max": 1,"min": 0,"operations": 7,"tab_order": 1,"type": "BOOL"},
+ {"name": "UNREACH","vdefault": 0,"flags": 9,"max": 1,"min": 0,"operations": 5,"tab_order": 0,"type": "BOOL"},
+ {"name": "UPDATE_PENDING","vdefault": 0,"flags": 9,"max": 1,"min": 0,"operations": 5,"tab_order": 8,"type": "BOOL"}]
+ }],
+ "version": 41
+ },
+
+ {
+ "adress": "1",
+ "type": "DIMMER",
+ "flags": 1,
+ "direction" : 2,
+ "paramsets": [
+ {
+ "name" : "MASTER",
+ "id" : "dimmer_ch_master",
+ "parameter" : [{"name":"AES_ACTIVE","operations":3,"tab_order":0,"max":"","min":"","type":"BOOL","flags":3}]
+
+ },
+ {
+ "name" : "LINKS",
+ "id" : "rgbw_color_ch_link",
+ "parameter" :
+
+ [{"name":"LONG_ACTION_TYPE","operations":3,"tab_order":52,"max":8,"min":0,"valuelist":["INACTIVE","JUMP_TO_TARGET","TOGGLE_TO_COUNTER","TOGGLE_INVERS_TO_COUNTER","UPDIM","DOWNDIM","TOGGLEDIM","TOGGLEDIM_TO_COUNTER","TOGGLEDIM_INVERS_TO_COUNTER"],"vdefault":0,"flags":1},{"name":"LONG_COND_VALUE_HI","operations":3,"tab_order":44,"max":255,"min":0,"vdefault":100,"flags":1},{"name":"LONG_COND_VALUE_LO","operations":3,"tab_order":43,"max":255,"min":0,"vdefault":50,"flags":1},{"name":"LONG_CT_OFF","operations":3,"tab_order":41,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"LONG_CT_OFFDELAY","operations":3,"tab_order":39,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"LONG_CT_ON","operations":3,"tab_order":42,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"LONG_CT_ONDELAY","operations":3,"tab_order":40,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"LONG_CT_RAMPOFF","operations":3,"tab_order":37,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"LONG_CT_RAMPON","operations":3,"tab_order":38,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"LONG_DIM_MAX_LEVEL","operations":3,"tab_order":69,"max":1,"min":0,"vdefault":1,"flags":1},{"name":"LONG_DIM_MIN_LEVEL","operations":3,"tab_order":68,"max":1,"min":0,"vdefault":0,"flags":1},{"name":"LONG_DIM_STEP","operations":3,"tab_order":70,"max":1,"min":0,"vdefault":0,"flags":1},{"name":"LONG_JT_OFF","operations":3,"tab_order":53,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"LONG_JT_OFFDELAY","operations":3,"tab_order":55,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"LONG_JT_ON","operations":3,"tab_order":54,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"LONG_JT_ONDELAY","operations":3,"tab_order":56,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"LONG_JT_RAMPOFF","operations":3,"tab_order":57,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"LONG_JT_RAMPON","operations":3,"tab_order":58,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"LONG_MULTIEXECUTE","operations":3,"tab_order":51,"max":1,"min":0,"valuelist":["OFF","ON"],"vdefault":0,"flags":1},{"name":"LONG_OFFDELAY_BLINK","operations":3,"tab_order":61,"max":1,"min":0,"valuelist":["OFF","ON"],"vdefault":1,"flags":1},{"name":"LONG_OFFDELAY_NEWTIME","operations":3,"tab_order":72,"max":25.6,"min":0.1,"vdefault":0.5,"flags":1},{"name":"LONG_OFFDELAY_OLDTIME","operations":3,"tab_order":73,"max":25.6,"min":0.1,"vdefault":0.5,"flags":1},{"name":"LONG_OFFDELAY_STEP","operations":3,"tab_order":71,"max":1,"min":0,"vdefault":0.05,"flags":1},{"name":"LONG_OFFDELAY_TIME","operations":3,"tab_order":47,"max":111600,"min":0,"vdefault":0,"flags":1},{"name":"LONG_OFF_LEVEL","operations":3,"tab_order":62,"max":1,"min":0,"vdefault":0,"flags":1},{"name":"LONG_OFF_TIME","operations":3,"tab_order":48,"max":108000,"min":0,"vdefault":111600,"flags":1},{"name":"LONG_OFF_TIME_MODE","operations":3,"tab_order":50,"max":1,"min":0,"valuelist":["ABSOLUTE","MINIMAL"],"vdefault":0,"flags":1},{"name":"LONG_ONDELAY_MODE","operations":3,"tab_order":59,"max":1,"min":0,"valuelist":["SET_TO_OFF","NO_CHANGE"],"vdefault":0,"flags":1},{"name":"LONG_ONDELAY_TIME","operations":3,"tab_order":45,"max":111600,"min":0,"vdefault":0,"flags":1},{"name":"LONG_ON_LEVEL","operations":3,"tab_order":64,"max":1,"min":0,"vdefault":1,"flags":1},{"name":"LONG_ON_LEVEL_PRIO","operations":3,"tab_order":60,"max":1,"min":0,"valuelist":["HIGH","LOW"],"vdefault":0,"flags":1},{"name":"LONG_ON_MIN_LEVEL","operations":3,"tab_order":63,"max":1,"min":0,"vdefault":0.1,"flags":1},{"name":"LONG_ON_TIME","operations":3,"tab_order":46,"max":108000,"min":0,"vdefault":111600,"flags":1},{"name":"LONG_ON_TIME_MODE","operations":3,"tab_order":49,"max":1,"min":0,"valuelist":["ABSOLUTE","MINIMAL"],"vdefault":0,"flags":1},{"name":"LONG_RAMPOFF_TIME","operations":3,"tab_order":67,"max":111600,"min":0,"vdefault":0,"flags":1},{"name":"LONG_RAMPON_TIME","operations":3,"tab_order":66,"max":111600,"min":0,"vdefault":0,"flags":1},{"name":"LONG_RAMP_START_STEP","operations":3,"tab_order":65,"max":1,"min":0,"vdefault":0.05,"flags":1},{"name":"SHORT_ACTION_TYPE","operations":3,"tab_order":15,"max":8,"min":0,"valuelist":["INACTIVE","JUMP_TO_TARGET","TOGGLE_TO_COUNTER","TOGGLE_INVERS_TO_COUNTER","UPDIM","DOWNDIM","TOGGLEDIM","TOGGLEDIM_TO_COUNTER","TOGGLEDIM_INVERS_TO_COUNTER"],"vdefault":0,"flags":1},{"name":"SHORT_COND_VALUE_HI","operations":3,"tab_order":8,"max":255,"min":0,"vdefault":100,"flags":1},{"name":"SHORT_COND_VALUE_LO","operations":3,"tab_order":7,"max":255,"min":0,"vdefault":50,"flags":1},{"name":"SHORT_CT_OFF","operations":3,"tab_order":5,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"SHORT_CT_OFFDELAY","operations":3,"tab_order":3,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"SHORT_CT_ON","operations":3,"tab_order":6,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"SHORT_CT_ONDELAY","operations":3,"tab_order":4,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"SHORT_CT_RAMPOFF","operations":3,"tab_order":1,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"SHORT_CT_RAMPON","operations":3,"tab_order":2,"max":5,"min":0,"valuelist":["X GE COND_VALUE_LO","X GE COND_VALUE_HI","X LT COND_VALUE_LO","X LT COND_VALUE_HI","COND_VALUE_LO LE X LT COND_VALUE_HI","X LT COND_VALUE_LO OR X GE COND_VALUE_HI"],"vdefault":0,"flags":1},{"name":"SHORT_DIM_MAX_LEVEL","operations":3,"tab_order":32,"max":1,"min":0,"vdefault":1,"flags":1},{"name":"SHORT_DIM_MIN_LEVEL","operations":3,"tab_order":31,"max":1,"min":0,"vdefault":0,"flags":1},{"name":"SHORT_DIM_STEP","operations":3,"tab_order":33,"max":1,"min":0,"vdefault":0,"flags":1},{"name":"SHORT_JT_OFF","operations":3,"tab_order":16,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"SHORT_JT_OFFDELAY","operations":3,"tab_order":18,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"SHORT_JT_ON","operations":3,"tab_order":17,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"SHORT_JT_ONDELAY","operations":3,"tab_order":19,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"SHORT_JT_RAMPOFF","operations":3,"tab_order":20,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"SHORT_JT_RAMPON","operations":3,"tab_order":21,"max":6,"min":0,"valuelist":["NO_JUMP_IGNORE_COMMAND","ONDELAY","RAMPON","ON","OFFDELAY","RAMPOFF","OFF"],"vdefault":1,"flags":1},{"name":"SHORT_OFFDELAY_BLINK","operations":3,"tab_order":24,"max":1,"min":0,"valuelist":["OFF","ON"],"vdefault":1,"flags":1},{"name":"SHORT_OFFDELAY_NEWTIME","operations":3,"tab_order":35,"max":25.6,"min":0.1,"vdefault":0.5,"flags":1},{"name":"SHORT_OFFDELAY_OLDTIME","operations":3,"tab_order":36,"max":25.6,"min":0.1,"vdefault":0.5,"flags":1},{"name":"SHORT_OFFDELAY_STEP","operations":3,"tab_order":34,"max":1,"min":0,"vdefault":0.05,"flags":1},{"name":"SHORT_OFFDELAY_TIME","operations":3,"tab_order":11,"max":111600,"min":0,"vdefault":0,"flags":1},{"name":"SHORT_OFF_LEVEL","operations":3,"tab_order":25,"max":1,"min":0,"vdefault":0,"flags":1},{"name":"SHORT_OFF_TIME","operations":3,"tab_order":12,"max":108000,"min":0,"vdefault":111600,"flags":1},{"name":"SHORT_OFF_TIME_MODE","operations":3,"tab_order":14,"max":1,"min":0,"valuelist":["ABSOLUTE","MINIMAL"],"vdefault":0,"flags":1},{"name":"SHORT_ONDELAY_MODE","operations":3,"tab_order":22,"max":1,"min":0,"valuelist":["SET_TO_OFF","NO_CHANGE"],"vdefault":0,"flags":1},{"name":"SHORT_ONDELAY_TIME","operations":3,"tab_order":9,"max":111600,"min":0,"vdefault":0,"flags":1},{"name":"SHORT_ON_LEVEL","operations":3,"tab_order":27,"max":1,"min":0,"vdefault":1,"flags":1},{"name":"SHORT_ON_LEVEL_PRIO","operations":3,"tab_order":23,"max":1,"min":0,"valuelist":["HIGH","LOW"],"vdefault":0,"flags":1},{"name":"SHORT_ON_MIN_LEVEL","operations":3,"tab_order":26,"max":1,"min":0,"vdefault":0.1,"flags":1},{"name":"SHORT_ON_TIME","operations":3,"tab_order":10,"max":108000,"min":0,"vdefault":111600,"flags":1},{"name":"SHORT_ON_TIME_MODE","operations":3,"tab_order":13,"max":1,"min":0,"valuelist":["ABSOLUTE","MINIMAL"],"vdefault":0,"flags":1},{"name":"SHORT_RAMPOFF_TIME","operations":3,"tab_order":30,"max":111600,"min":0,"vdefault":0,"flags":1},{"name":"SHORT_RAMPON_TIME","operations":3,"tab_order":29,"max":111600,"min":0,"vdefault":0,"flags":1},{"name":"SHORT_RAMP_START_STEP","operations":3,"tab_order":28,"max":1,"min":0,"vdefault":0.05,"flags":1},{"name":"UI_HINT","operations":3,"tab_order":0,"flags":1}]
+
+
+ },
+
+ {
+ "name" : "VALUES",
+ "id" : "dimmer_ch_values",
+ "parameter" : [{"name":"DIRECTION","operations":5,"tab_order":6,"max":3,"min":0,"valuelist":["NONE","UP","DOWN","UNDEFINED"],"type":"ENUM","vdefault":0,"flags":3},{"name":"INHIBIT","operations":7,"tab_order":5,"max":"","control":"NONE","min":"","type":"BOOL","flags":1,"vdefault":""},{"name":"INSTALL_TEST","operations":2,"tab_order":7,"max":"","min":"","type":"ACTION","vdefault":"","flags":3},{"name":"LEVEL","operations":7,"tab_order":0,"unit":"100%","max":1,"control":"DIMMER.LEVEL","min":0,"type":"FLOAT","flags":1,"vdefault":0},{"name":"OLD_LEVEL","operations":2,"tab_order":1,"max":"","control":"DIMMER.OLD_LEVEL","min":"","type":"ACTION","flags":1,"vdefault":""},{"name":"ON_TIME","operations":2,"tab_order":3,"unit":"s","max":85825945.59999999,"control":"NONE","min":0,"type":"FLOAT","flags":1,"vdefault":0},{"name":"RAMP_STOP","operations":2,"tab_order":4,"max":"","control":"NONE","min":"","type":"ACTION","flags":1,"vdefault":""},{"name":"RAMP_TIME","operations":2,"tab_order":2,"unit":"s","max":85825945.59999999,"control":"NONE","min":0,"type":"FLOAT","flags":1,"vdefault":0.5},{"name":"WORKING","operations":5,"tab_order":8,"max":"","min":"","type":"BOOL","vdefault":"","flags":3}]
+
+ }],
+ "version": 41
+ },
+
+ {
+ "adress": "2",
+ "type": "RGBW_COLOR",
+ "flags": 1,
+ "direction" : 2,
+ "paramsets": [
+ {
+ "name" : "MASTER",
+ "id" : "rgbw_color_ch_master",
+ "parameter" : [
+ {"name": "AES_KEY","vdefault": 0,"flags": 0,"max": 127,"min": 0,"operations": 1,"tab_order": 0,"type": "INTEGER"},
+ {"name": "WHITE_ADJUSTMENT_VALUE_BLUE","vdefault": 100,"flags": 1,"max": 100,"min": 0,"operations": 3,"tab_order": 2,"type": "INTEGER","UNIT":"%"},
+ {"name": "WHITE_ADJUSTMENT_VALUE_GREEN","vdefault": 100,"flags": 1,"max": 100,"min": 0,"operations": 3,"tab_order": 1,"type": "INTEGER","UNIT":"%"},
+ {"name": "WHITE_ADJUSTMENT_VALUE_RED","vdefault": 100,"flags": 1,"max": 100,"min": 0,"operations": 3,"tab_order": 3,"type": "INTEGER","UNIT":"%"},
+ {"name": "DEFAULT_SATURATION","vdefault": 128,"flags": 1,"max": 255,"min": 0,"operations": 3,"tab_order": 4,"type": "INTEGER"},
+ {"name": "WHITE_HUE_VALUE","vdefault": 39609,"flags": 1,"max": 65585,"min": 0,"operations": 3,"tab_order": 5,"type": "INTEGER"}
+ ]
+ },
+
+ {
+ "name" : "VALUES",
+ "id" : "rgbw_color_ch_values",
+ "parameter" : [{"name":"ACT_BRIGHTNESS","operations":2,"tab_order":4,"max":255,"control":"NONE","min":0,"type":"INTEGER","flags":3,"vdefault":0},{"name":"ACT_BRIGHTNESS_STORE","operations":2,"tab_order":5,"max":255,"control":"NONE","min":0,"type":"INTEGER","flags":3,"vdefault":0},{"name":"ACT_HSV_COLOR_VALUE","operations":2,"tab_order":6,"max":255,"control":"NONE","min":0,"type":"INTEGER","flags":3,"vdefault":0},{"name":"ACT_HSV_COLOR_VALUE_STORE","operations":2,"tab_order":7,"max":255,"control":"NONE","min":0,"type":"INTEGER","flags":3,"vdefault":0},{"name":"COLOR","operations":7,"tab_order":0,"max":255,"control":"RGBW_COLOR.COLOR","min":0,"type":"INTEGER","flags":1,"vdefault":0},{"name":"INHIBIT","operations":7,"tab_order":3,"max":"","control":"NONE","min":"","type":"BOOL","flags":1},{"name":"ON_TIME","operations":2,"tab_order":1,"unit":"s","max":85825945.59999999,"control":"NONE","min":0,"type":"FLOAT","flags":1,"vdefault":0},{"name":"ON_TIME_STORE","operations":2,"tab_order":8,"unit":"s","max":85825945.59999999,"control":"NONE","min":0,"type":"FLOAT","flags":3,"vdefault":0},{"name":"RAMP_TIME","operations":2,"tab_order":2,"unit":"s","max":85825945.59999999,"control":"NONE","min":0,"type":"FLOAT","flags":1,"vdefault":0.5},{"name":"RAMP_TIME_STORE","operations":2,"tab_order":9,"unit":"s","max":85825945.59999999,"control":"NONE","min":0,"type":"FLOAT","flags":3,"vdefault":0.5},{"name":"USER_COLOR","operations":2,"tab_order":0,"max":"","control":"NONE","min":"","type":"STRING","flags":1}]
+
+ }],
+ "version": 41
+ },
+
+ {
+ "adress": "3",
+ "type": "RGBW_AUTOMATIC",
+ "flags": 1,
+ "direction" : 2,
+ "paramsets": [
+ {
+ "name" : "MASTER",
+ "id" : "rgbw_automatic_ch_master",
+ "parameter" : [
+ {"name": "AES_KEY","vdefault": 0,"flags": 0,"max": 127,"min": 0,"operations": 1,"tab_order": 0,"type": "INTEGER"},
+ {"name": "COLOR_CHANGE_SPEED","vdefault": 10,"flags": 1,"max": 255,"min": 0,"operations": 3,"tab_order": 0,"type": "INTEGER","UNIT":"s/U"}
+ ]
+ },
+ {
+ "name" : "VALUES",
+ "id" : "rgbw_automatic_ch_values",
+ "parameter" : [{"name":"ACT_BRIGHTNESS","operations":3,"tab_order":4,"max":255,"control":"RGBW_AUTOMATIC.BRIGHTNESS","min":0,"type":"INTEGER","flags":3,"vdefault":0},{"name":"ACT_BRIGHTNESS_STORE","operations":2,"tab_order":5,"max":255,"control":"NONE","min":0,"type":"INTEGER","flags":3,"vdefault":0},{"name":"ACT_COLOR_PROGRAM_STORE","operations":2,"tab_order":6,"max":255,"control":"NONE","min":0,"type":"INTEGER","flags":3,"vdefault":0},{"name":"ACT_MAX_BOARDER","operations":3,"tab_order":7,"max":255,"control":"RGBW_AUTOMATIC.MAX_BOARDER","min":0,"type":"INTEGER","flags":3,"vdefault":0},{"name":"ACT_MAX_BORDER_STORE","operations":2,"tab_order":8,"max":255,"control":"NONE","min":0,"type":"INTEGER","flags":3,"vdefault":0},{"name":"ACT_MIN_BOARDER","operations":3,"tab_order":9,"max":255,"control":"RGBW_AUTOMATIC.MIN_BOARDER","min":0,"type":"INTEGER","flags":3,"vdefault":0},{"name":"ACT_MIN_BORDER_STORE","operations":2,"tab_order":10,"max":255,"control":"NONE","min":0,"type":"INTEGER","flags":3,"vdefault":0},{"name":"INHIBIT","operations":7,"tab_order":3,"max":"","control":"NONE","min":"","type":"BOOL","flags":1},{"name":"ON_TIME","operations":3,"tab_order":1,"unit":"s","max":85825945.59999999,"control":"RGBW_AUTOMATIC.ON_TIME","min":0,"type":"FLOAT","flags":1,"vdefault":0},{"name":"ON_TIME_STORE","operations":2,"tab_order":11,"unit":"s","max":85825945.59999999,"control":"NONE","min":0,"type":"FLOAT","flags":3,"vdefault":0},{"name":"PROGRAM","operations":7,"tab_order":0,"max":255,"control":"RGBW_AUTOMATIC.PROGRAM","min":0,"type":"INTEGER","flags":1,"vdefault":0},{"name":"RAMP_TIME","operations":3,"tab_order":2,"unit":"s","max":85825945.59999999,"control":"RGBW_AUTOMATIC.RAMP_TIME","min":0,"type":"FLOAT","flags":1,"vdefault":0.5},{"name":"RAMP_TIME_STORE","operations":2,"tab_order":12,"unit":"s","max":85825945.59999999,"control":"NONE","min":0,"type":"FLOAT","flags":3,"vdefault":0.5},{"name":"USER_PROGRAM","operations":2,"tab_order":0,"max":"","control":"NONE","min":"","type":"STRING","flags":1}]
+
+ }],
+ "version": 41
+ }
+
+
+ ],
+
+ "type": "HM-LC-RGBW-WM",
+ "version": 41,
+ "paramsets": [
+ {
+ "name" : "MASTER",
+ "id" : "switch_dev_master",
+ "parameter" :
+ [{"name":"INTERNAL_KEYS_VISIBLE","operations":3,"tab_order":1,"max":"","min":"","type":"BOOL","flags":3},{"name":"LOCAL_RESET_DISABLE","operations":3,"tab_order":0,"max":"","min":"","type":"BOOL","flags":1}]
+ }]
+ }
\ No newline at end of file
diff --git a/plugins/deConz/HM-RC-8.json b/plugins/deConz/devices/definitions/HM-RC-8.json
similarity index 100%
rename from plugins/deConz/HM-RC-8.json
rename to plugins/deConz/devices/definitions/HM-RC-8.json
diff --git a/plugins/deConz/HM-Sec-MDIR.json b/plugins/deConz/devices/definitions/HM-Sec-MDIR.json
similarity index 100%
rename from plugins/deConz/HM-Sec-MDIR.json
rename to plugins/deConz/devices/definitions/HM-Sec-MDIR.json
diff --git a/plugins/deConz/devices/definitions/VIR-LG-WHITE-DIM.json b/plugins/deConz/devices/definitions/VIR-LG-WHITE-DIM.json
new file mode 100644
index 0000000..1aa3745
--- /dev/null
+++ b/plugins/deConz/devices/definitions/VIR-LG-WHITE-DIM.json
@@ -0,0 +1,375 @@
+{
+ "channels":[
+ {
+ "adress":"0",
+ "type":"MAINTENANCE",
+ "flags":3,
+ "direction":0,
+ "paramsets":[
+ {
+ "name":"MASTER",
+ "id":"maint_ch_master",
+ "parameter":[
+
+ ]
+ },
+ {
+ "name":"VALUES",
+ "id":"maint_ch_values",
+ "parameter":[
+ {
+ "name":"AES_KEY",
+ "vdefault":0,
+ "flags":0,
+ "max":127,
+ "min":0,
+ "operations":1,
+ "tab_order":9,
+ "type":"INTEGER"
+ },
+ {
+ "name":"CONFIG_PENDING",
+ "vdefault":0,
+ "flags":9,
+ "max":1,
+ "min":0,
+ "operations":5,
+ "tab_order":2,
+ "type":"BOOL"
+ },
+ {
+ "name":"DEVICE_IN_BOOTLOADER",
+ "vdefault":0,
+ "flags":9,
+ "max":1,
+ "min":0,
+ "operations":5,
+ "tab_order":7,
+ "type":"BOOL"
+ },
+ {
+ "name":"DUTYCYCLE",
+ "vdefault":0,
+ "flags":9,
+ "max":1,
+ "min":0,
+ "operations":5,
+ "tab_order":4,
+ "type":"BOOL"
+ },
+ {
+ "name":"LOWBAT",
+ "vdefault":0,
+ "flags":9,
+ "max":1,
+ "min":0,
+ "operations":5,
+ "tab_order":3,
+ "type":"BOOL"
+ },
+ {
+ "name":"RSSI_DEVICE",
+ "vdefault":0,
+ "flags":1,
+ "max":2147483647,
+ "min":2147483648,
+ "operations":5,
+ "tab_order":5,
+ "type":"INTEGER"
+ },
+ {
+ "name":"RSSI_PEER",
+ "vdefault":0,
+ "flags":1,
+ "max":2147483647,
+ "min":2147483648,
+ "operations":5,
+ "tab_order":6,
+ "type":"INTEGER"
+ },
+ {
+ "name":"STICKY_UNREACH",
+ "vdefault":0,
+ "flags":25,
+ "max":1,
+ "min":0,
+ "operations":7,
+ "tab_order":1,
+ "type":"BOOL"
+ },
+ {
+ "name":"UNREACH",
+ "vdefault":0,
+ "flags":9,
+ "max":1,
+ "min":0,
+ "operations":5,
+ "tab_order":0,
+ "type":"BOOL"
+ },
+ {
+ "name":"UPDATE_PENDING",
+ "vdefault":0,
+ "flags":9,
+ "max":1,
+ "min":0,
+ "operations":5,
+ "tab_order":8,
+ "type":"BOOL"
+ }
+ ]
+ }
+ ],
+ "version":41
+ },
+ {
+ "adress":"1",
+ "type":"VIR-LG_WHITE-DIM-CH",
+ "flags":1,
+ "direction":2,
+ "paramsets":[
+ {
+ "name":"MASTER",
+ "id":"dimmer_ch_master",
+ "parameter":[
+ {
+ "name":"AES_ACTIVE",
+ "operations":3,
+ "tab_order":0,
+ "max":"",
+ "min":"",
+ "type":"BOOL",
+ "flags":1
+ }
+ ]
+ },
+ {
+ "name":"LINKS",
+ "id":"rgbw_color_ch_link",
+ "parameter":[
+
+ ]
+ },
+ {
+ "name":"VALUES",
+ "id":"dimmer_ch_values",
+ "parameter":[
+ {
+ "name":"DIRECTION",
+ "operations":5,
+ "tab_order":6,
+ "max":3,
+ "min":0,
+ "valuelist":[
+ "NONE",
+ "UP",
+ "DOWN",
+ "UNDEFINED"
+ ],
+ "type":"ENUM",
+ "vdefault":0,
+ "flags":3
+ },
+ {
+ "name":"INHIBIT",
+ "operations":7,
+ "tab_order":5,
+ "max":"",
+ "control":"NONE",
+ "min":"",
+ "type":"BOOL",
+ "flags":1,
+ "vdefault":""
+ },
+ {
+ "name":"INSTALL_TEST",
+ "operations":2,
+ "tab_order":7,
+ "max":"",
+ "min":"",
+ "type":"ACTION",
+ "vdefault":"",
+ "flags":3
+ },
+ {
+ "name":"LEVEL",
+ "operations":7,
+ "tab_order":0,
+ "unit":"100%",
+ "max":1,
+ "control":"DIMMER.LEVEL",
+ "min":0,
+ "type":"FLOAT",
+ "flags":1,
+ "vdefault":0
+ },
+ {
+ "name":"OLD_LEVEL",
+ "operations":2,
+ "tab_order":1,
+ "max":"",
+ "control":"NONE",
+ "min":"",
+ "type":"ACTION",
+ "flags":1,
+ "vdefault":""
+ },
+ {
+ "name":"ON_TIME",
+ "operations":2,
+ "tab_order":3,
+ "unit":"s",
+ "max":85825945.59999999,
+ "control":"NONE",
+ "min":0,
+ "type":"FLOAT",
+ "flags":1,
+ "vdefault":0
+ },
+ {
+ "name":"RAMP_STOP",
+ "operations":2,
+ "tab_order":4,
+ "max":"",
+ "control":"NONE",
+ "min":"",
+ "type":"ACTION",
+ "flags":1,
+ "vdefault":""
+ },
+ {
+ "name":"RAMP_TIME",
+ "operations":2,
+ "tab_order":2,
+ "unit":"s",
+ "max":85825945.59999999,
+ "control":"NONE",
+ "min":0,
+ "type":"FLOAT",
+ "flags":1,
+ "vdefault":0.5
+ },
+ {
+ "name":"WORKING",
+ "operations":5,
+ "tab_order":8,
+ "max":"",
+ "min":"",
+ "type":"BOOL",
+ "vdefault":"",
+ "flags":3
+ },
+ {
+ "name":"INHIBIT",
+ "operations":7,
+ "tab_order":3,
+ "max":"",
+ "control":"NONE",
+ "min":"",
+ "type":"BOOL",
+ "flags":1
+ },
+ {
+ "name":"ON_TIME",
+ "operations":2,
+ "tab_order":1,
+ "unit":"s",
+ "max":85825945.59999999,
+ "control":"NONE",
+ "min":0,
+ "type":"FLOAT",
+ "flags":1,
+ "vdefault":0
+ },
+ {
+ "name":"ON_TIME_STORE",
+ "operations":2,
+ "tab_order":8,
+ "unit":"s",
+ "max":85825945.59999999,
+ "control":"NONE",
+ "min":0,
+ "type":"FLOAT",
+ "flags":3,
+ "vdefault":0
+ },
+ {
+ "name":"RAMP_TIME",
+ "operations":2,
+ "tab_order":2,
+ "unit":"s",
+ "max":85825945.59999999,
+ "control":"NONE",
+ "min":0,
+ "type":"FLOAT",
+ "flags":1,
+ "vdefault":0.5
+ },
+ {
+ "name":"RAMP_TIME_STORE",
+ "operations":2,
+ "tab_order":9,
+ "unit":"s",
+ "max":85825945.59999999,
+ "control":"NONE",
+ "min":0,
+ "type":"FLOAT",
+ "flags":3,
+ "vdefault":0.5
+ },
+ {
+ "name":"USER_COLOR",
+ "operations":2,
+ "tab_order":0,
+ "max":"",
+ "control":"NONE",
+ "min":"",
+ "type":"STRING",
+ "flags":1
+ },
+ {
+ "name":"WHITE",
+ "operations":2,
+ "tab_order":0,
+ "max":"4000",
+ "control":"COLORTEMP.WHITE",
+ "min":"2200",
+ "type":"INTEGER",
+ "flags":1,
+ "vdefault":2700
+ }
+ ]
+ }
+ ],
+ "version":41
+ }
+ ],
+ "type":"VIR-LG-WHITE-DIM",
+ "version":41,
+ "paramsets":[
+ {
+ "name":"MASTER",
+ "id":"switch_dev_master",
+ "parameter":[
+ {
+ "name":"INTERNAL_KEYS_VISIBLE",
+ "operations":3,
+ "tab_order":1,
+ "max":"",
+ "min":"",
+ "type":"BOOL",
+ "flags":3
+ },
+ {
+ "name":"LOCAL_RESET_DISABLE",
+ "operations":3,
+ "tab_order":0,
+ "max":"",
+ "min":"",
+ "type":"BOOL",
+ "flags":1
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/plugins/deConz/lib/Gateway.js b/plugins/deConz/lib/Gateway.js
index d3de064..f2ad946 100644
--- a/plugins/deConz/lib/Gateway.js
+++ b/plugins/deConz/lib/Gateway.js
@@ -4,7 +4,7 @@ const path = require('path')
const fs = require('fs')
module.exports = class Gateway {
- constructor (host, port,log) {
+ constructor (host, port, log) {
log.info('Booting up gateway')
this.host = host
this.port = port
@@ -20,6 +20,7 @@ module.exports = class Gateway {
apiCall (type, method, data) {
let self = this
+ this.log.debug('Api Call %s %s', type, method)
return new Promise((resolve, reject) => {
let urlPath = '/api/'
if (self.key) {
@@ -90,6 +91,27 @@ module.exports = class Gateway {
}
}
+ registerApplication (application) {
+ let self = this
+ return new Promise((resolve, reject) => {
+ self.apiCall('POST', '', {devicetype: application}).then((result, error) => {
+ if (error) {
+ reject(error)
+ } else {
+ if (result.error) {
+ if (result.error.description) {
+ reject(new Error(result.error.description))
+ } else {
+ reject(new Error('error while obtaining an api key'))
+ }
+ } else {
+ resolve(result)
+ }
+ }
+ })
+ })
+ }
+
getConfig () {
let self = this
return new Promise((resolve, reject) => {
@@ -163,6 +185,21 @@ module.exports = class Gateway {
return this.lights
}
+ updateLightState (light) {
+ let self = this
+ return new Promise((resolve, reject) => {
+ self.apiCall('GET', 'lights/' + light.id).then((result, error) => {
+ if (error) {
+ reject(error)
+ } else {
+ self.log.debug('Current LightState is %s', JSON.stringify(result))
+ light.lightState = result.state
+ resolve(result.state)
+ }
+ })
+ })
+ }
+
_addNewLight (id, lightData) {
let self = this
let light
@@ -170,8 +207,9 @@ module.exports = class Gateway {
let LightClazz = require(clazzFile)
light = new LightClazz(id)
light._populate(lightData)
- light.on('lightstatechanged', (newState) => {
+ light.on('populate', (newState) => {
let pl = newState.getReducedPayload()
+ self.log.debug('Send new State %s', JSON.stringify(pl))
self.apiCall('PUT', 'lights/' + light.id + '/state', pl).then((result, error) => {
if (error) {
console.log(error)
@@ -207,7 +245,6 @@ module.exports = class Gateway {
if (event) {
if ((event.id) && (event.t) && (event.e) && (event.r)) {
if ((event.e === 'changed') && (event.t === 'event')) {
- // console.log(event.r)
switch (event.r) {
case 'sensors':
{
@@ -222,10 +259,8 @@ module.exports = class Gateway {
break
case 'lights':
let light = this.getLight(event.id)
- if (light) {
- light.state = event.state
- } else {
- this.log.warn('light %s not found', event.id)
+ if ((light) && (event.state)) {
+ light.updateFromGateway(event.state)
}
break
}
@@ -271,7 +306,7 @@ module.exports = class Gateway {
}
}
} catch (e) {
-
+ self.log.error(e)
}
} else {
self.log.error('unable to connect to socked server')
diff --git a/plugins/deConz/lib/model/lights/Light.js b/plugins/deConz/lib/model/lights/Light.js
index acef702..e51cc45 100644
--- a/plugins/deConz/lib/model/lights/Light.js
+++ b/plugins/deConz/lib/model/lights/Light.js
@@ -58,11 +58,16 @@ module.exports = class Light extends GatewayObjectWithId {
set lightState (newState) {
if (newState instanceof LightState) {
this._lightState = newState
+ // send this to the Gateway
+ this.emit('populate', this._lightState)
} else {
this._populateState(newState)
}
- // send this to the Gateway
- this.emit('lightstatechanged', this._lightState)
+ }
+
+ updateFromGateway (newState) {
+ this._populateState(newState)
+ this.emit('change')
}
_populate (light) {
diff --git a/plugins/deConz/lib/model/lightstate/BaseStates.js b/plugins/deConz/lib/model/lightstate/BaseStates.js
index c3394fe..bc06430 100644
--- a/plugins/deConz/lib/model/lightstate/BaseStates.js
+++ b/plugins/deConz/lib/model/lightstate/BaseStates.js
@@ -65,15 +65,27 @@ module.exports = class BaseStates extends States {
}
ct (value) {
- return this._setStateValue('ct', value)
+ if (value === undefined) {
+ return this._getStateValue('ct')
+ } else {
+ return this._setStateValue('ct', value)
+ }
}
effect (value) {
- return this._setStateValue('effect', value)
+ if (value === undefined) {
+ return this._getStateValue('effect')
+ } else {
+ return this._setStateValue('effect', value)
+ }
}
transitiontime (value) {
- return this._setStateValue('transitiontime', value)
+ if (value === undefined) {
+ return this._getStateValue('transitiontime')
+ } else {
+ return this._setStateValue('transitiontime', value)
+ }
}
/**
@@ -125,4 +137,14 @@ module.exports = class BaseStates extends States {
transitionDefault () {
return this.transitiontime(4)
}
+
+ max (stateName) {
+ let stateDefinition = this._getStateDefinition(stateName)
+ return stateDefinition.max
+ }
+
+ min (stateName) {
+ let stateDefinition = this._getStateDefinition(stateName)
+ return stateDefinition.min
+ }
}