Improve support current supported devices.

This commit is contained in:
Koen Kanters
2018-04-23 21:44:06 +02:00
parent 59f16f76f1
commit 1543373b7f
4 changed files with 21 additions and 16 deletions
+5
View File
@@ -62,6 +62,11 @@ class Controller {
const device = message.endpoints[0].device;
if (!device) {
logger.warn('Message without device!');
return;
}
// Check if this is a new device.
if (!settings.getDevice(device.ieeeAddr)) {
logger.info(`New device with address ${device.ieeeAddr} connected!`);
+5 -5
View File
@@ -107,17 +107,17 @@ const parsers = [
}
store[deviceID] = setTimeout(() => {
publish({occupancy: 'no_motion'})
publish({occupancy: false})
store[deviceID] = null;
}, noMotionTimeout * 60 * 1000);
return {occupancy: 'motion'};
return {occupancy: true};
}
},
{
devices: ['MCCGQ01LM', 'MCCGQ11LM'],
cid: 'genOnOff',
type: 'attReport',
convert: (msg) => {return {state: msg.data.data['onOff'] ? 'open' : 'closed'}}
convert: (msg) => {return {contact: msg.data.data['onOff'] === 0}}
},
{
devices: ['LED1545G12', '7146060PH', 'LED1537R6'],
@@ -188,13 +188,13 @@ const parsers = [
// Ignore parsers (these message dont need parsing).
{
devices: ['WXKG11LM', 'MCCGQ11LM'],
devices: ['WXKG11LM', 'MCCGQ11LM', 'MCCGQ01LM', 'WXKG01LM', 'LED1545G12', '7146060PH', 'LED1537R6'],
cid: 'genOnOff',
type: 'devChange',
convert: () => null
},
{
devices: ['WXKG11LM', 'MCCGQ11LM', 'RTCGQ11LM', 'WSDCGQ11LM', 'SJCGQ11LM'],
devices: ['WXKG11LM', 'MCCGQ11LM', 'RTCGQ11LM', 'WSDCGQ11LM', 'SJCGQ11LM', 'MCCGQ01LM', 'RTCGQ01LM', 'WXKG01LM', 'WSDCGQ01LM'],
cid: 'genBasic',
type: 'devChange',
convert: () => null
+4 -4
View File
@@ -62,15 +62,15 @@ const devices = {
model: 'MCCGQ01LM',
vendor: 'Xiaomi',
description: 'MiJia door & window contact sensor',
supports: 'open and closed state',
homeassistant: [homeassistant.binary_sensor_state]
supports: 'contact',
homeassistant: [homeassistant.binary_sensor_contact]
},
'lumi.sensor_magnet.aq2': {
model: 'MCCGQ11LM',
vendor: 'Xiaomi',
description: 'Aqara door & window contact sensor',
supports: 'open and closed state',
homeassistant: [homeassistant.binary_sensor_state]
supports: 'contact',
homeassistant: [homeassistant.binary_sensor_contact]
},
'lumi.sensor_wleak.aq1': {
model: 'SJCGQ11LM',
+7 -7
View File
@@ -4,20 +4,20 @@ const homeassistant = {
type: 'binary_sensor',
object_id: 'occupancy',
discovery_payload: {
payload_on: 'motion',
payload_off: 'no_motion',
payload_on: true,
payload_off: false,
value_template: '{{ value_json.occupancy }}',
device_class: 'motion',
json_attributes: ['battery']
}
},
'binary_sensor_state': {
'binary_sensor_contact': {
type: 'binary_sensor',
object_id: 'state',
object_id: 'contact',
discovery_payload: {
payload_on: 'open',
payload_off: 'closed',
value_template: '{{ value_json.state }}',
payload_on: false,
payload_off: true,
value_template: '{{ value_json.contact }}',
device_class: 'door',
json_attributes: ['battery']
}