zigbee2mqtt/lib/homeassistant.js

113 lines
3.1 KiB
JavaScript
Raw Normal View History

2018-04-23 09:29:35 -07:00
const homeassistant = {
// Binary sensor
'binary_sensor_occupancy': {
type: 'binary_sensor',
object_id: 'occupancy',
discovery_payload: {
payload_on: 'motion',
payload_off: 'no_motion',
value_template: '{{ value_json.occupancy }}',
device_class: 'motion',
json_attributes: ['battery']
}
},
'binary_sensor_state': {
type: 'binary_sensor',
object_id: 'state',
discovery_payload: {
payload_on: 'open',
payload_off: 'closed',
value_template: '{{ value_json.state }}',
device_class: 'door',
json_attributes: ['battery']
}
},
'binary_sensor_water_leak': {
type: 'binary_sensor',
object_id: 'water_leak',
discovery_payload: {
payload_on: true,
payload_off: false,
value_template: '{{ value_json.water_leak }}',
device_class: 'moisture',
json_attributes: ['battery']
}
},
// Sensor
'sensor_illuminance': {
type: 'sensor',
object_id: 'illuminance',
discovery_payload: {
unit_of_measurement: 'lx',
icon: 'mdi:theme-light-dark',
value_template: '{{ value_json.illuminance }}',
json_attributes: ['battery'],
}
},
'sensor_humidity': {
type: 'sensor',
object_id: 'humidity',
discovery_payload: {
unit_of_measurement: '%',
icon: 'mdi:water-percent',
value_template: '{{ value_json.humidity }}',
json_attributes: ['battery'],
}
},
'sensor_temperature': {
type: 'sensor',
object_id: 'temperature',
discovery_payload: {
unit_of_measurement: '°C',
icon: 'mdi:temperature-celsius',
value_template: '{{ value_json.temperature }}',
json_attributes: ['battery'],
}
},
'sensor_pressure': {
type: 'sensor',
object_id: 'pressure',
discovery_payload: {
unit_of_measurement: 'Pa',
icon: 'mdi:speedometer',
value_template: '{{ value_json.pressure }}',
json_attributes: ['battery'],
}
},
'sensor_button': {
type: 'sensor',
object_id: 'button',
discovery_payload: {
icon: 'mdi:toggle-switch',
value_template: '{{ value_json.click }}',
json_attributes: ['battery'],
}
},
// Light
'light_brightness_colortemp_xy': {
type: 'light',
object_id: 'light',
discovery_payload: {
brightness: true,
color_temp: true,
xy: true,
platform: 'mqtt_json',
command_topic: true
}
},
'light_brightness_colortemp': {
type: 'light',
object_id: 'light',
discovery_payload: {
brightness: true,
color_temp: true,
platform: 'mqtt_json',
command_topic: true
}
},
};
module.exports = homeassistant;