Improve naming of configuration

This commit is contained in:
Koen Kanters
2018-04-24 18:04:36 +02:00
parent 97f54facde
commit 8673fa27e2
4 changed files with 10 additions and 9 deletions
+3 -2
View File
@@ -1,10 +1,11 @@
default:
allowJoin: true
homeassistant_discovery: false
permit_join: true
homeassistant: false
mqtt:
server: "mqtt://localhost"
base_topic: zigbee2mqtt
serial:
port: /dev/ttyACM0
user:
devices: {}
+2 -2
View File
@@ -25,7 +25,7 @@ class Controller {
} else {
this.mqtt.connect(this.handleMQTTMessage, () => {
// Home assistant MQTT discovery on startup.
if (settings.get().homeassistant_discovery) {
if (settings.get().homeassistant) {
const devices = this.zigbee.getAllClients();
devices.forEach((device) => {
@@ -96,7 +96,7 @@ class Controller {
}
// Home assistant MQTT discovery
if (settings.get().homeassistant_discovery && mappedModel.homeassistant &&
if (settings.get().homeassistant && mappedModel.homeassistant &&
!this.hassDiscoveryCache[device.ieeeAddr]) {
this.homeassistantDiscover(mappedModel, device, friendlyName);
this.hassDiscoveryCache[device.ieeeAddr] = true;
+4 -4
View File
@@ -64,13 +64,13 @@ class Zigbee {
});
// Allow or disallow new devices to join the network.
if (settings.get().allowJoin) {
logger.warn('allowJoin set to true in configuration.yaml.')
if (settings.get().permit_join) {
logger.warn('`permit_join` set to `true` in configuration.yaml.')
logger.warn('Allowing new devices to join.');
logger.warn('Remove this parameter once you joined all devices.');
logger.warn('Set `permit_join` to `false` once you joined all devices.');
}
this.shepherd.permitJoin(settings.get().allowJoin ? 255 : 0, (error) => {
this.shepherd.permitJoin(settings.get().permit_join ? 255 : 0, (error) => {
if (error) {
logger.info(error);
}
+1 -1
View File
@@ -57,7 +57,7 @@ fs.writeFileSync(outputdir + '/' + file, text);
file = 'Integrating-with-home-assistant.io.md';
text = '*NOTE: Automatically generated by `npm run docgen`*\n\n';
text += 'The easiest way to integrate zigbee2mqtt with home assistant is by using [MQTT discovery](https://www.home-assistant.io/docs/mqtt/discovery/).'
text += ' To enable MQTT discovery set `homeassistant_discovery: true` in your zigbee2mqtt `configuration.yaml` and add the following to your home assistant `configuration.yaml`.\n'
text += ' To enable MQTT discovery set `homeassistant: true` in your zigbee2mqtt `configuration.yaml` and add the following to your home assistant `configuration.yaml`.\n'
text += '```yaml\n'
text += 'mqtt:\n'
text += ' discovery: true\n'