Skip to content

Commit

Permalink
Fix MQTT set mode bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mantorok1 committed Jun 20, 2020
1 parent 33291ea commit 7cd12c5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 30 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## 2.4.4 (2020-06-21)

* [FIX] Setting mode via MQTT /hvac/mode/set topic throws error

## 2.4.3 (2020-06-19)

* [FIX] Publish delay after processing command
Expand Down
31 changes: 6 additions & 25 deletions index.js
Expand Up @@ -66,23 +66,7 @@ class RinnaiTouchPlatform {

this.#repository = new RinnaiTouchRepository(this.log, this.settings);
this.service = new RinnaiTouchService(this.log, this.#repository);
/*
this.service.on('mode', (mode) => {
if (!this.service.hasMultiSetPoint) {
this.configureZoneSwitches();
}
if (this.service.hasEvaporative) {
this.configurePump();
}
});

if (this.settings.mqtt.formatNative) {
this.nativeClient = new NativeClient(this.log, this.settings.mqtt, this.#repository);
}
if (this.settings.mqtt.formatHomeAssistant) {
this.homeAssistantClient = new HomeAssistantClient(this.log, this.settings.mqtt, this.service);
}
*/
this.#started = true;

if (api) {
Expand Down Expand Up @@ -167,15 +151,12 @@ class RinnaiTouchPlatform {
if (this.service.hasHeater) this.log.info('Found Heater');
if (this.service.hasCooler) this.log.info('Found Cooler');
if (this.service.hasEvaporative) this.log.info('Found Evaporative Cooler');
if (this.service.hasMultiSetPoint) {
this.log.info('Found Zone Plus (Multi Set Point))');
let zones = this.service.controllers.map(z => this.service.getZoneName(z));
this.log.info(`Found Zone(s): ${zones.join()}`);
}
else if (this.service.zones.length > 0) {
let zones = this.service.zones.map(z => this.service.getZoneName(z));
this.log.info(`Found Zone(s): ${zones.join()}`);
}

let zones = this.service.zones.map(z => this.service.getZoneName(z));
this.log.info(`Found Zone(s): ${zones.join()}`);

let operation = this.service.hasMultiSetPoint ? 'Multi' : 'Single';
this.log.info(`Operation Mode: ${operation} Temperature Set Point`);

this.configureThermostats();
this.configureHeaterCoolers();
Expand Down
6 changes: 3 additions & 3 deletions mqtt/HomeAssistantClient.js
Expand Up @@ -240,7 +240,7 @@ class HomeAssistantClient extends ClientBase {
case 'switch/heat/set':
case 'switch/cool/set':
case 'switch/evap/set':
this.setMode(topic, payload);
this.setModeSwitch(topic, payload);
break;
case 'switch/fan/set':
this.setFanState(payload);
Expand Down Expand Up @@ -364,8 +364,8 @@ class HomeAssistantClient extends ClientBase {
}
}

async setMode(topic, payload) {
this.log.debug(this.constructor.name, 'setMode', topic, payload);
async setModeSwitch(topic, payload) {
this.log.debug(this.constructor.name, 'setModeSwitch', topic, payload);

try {
let mode = topic.split('/')[1].toUpperCase();
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "homebridge-rinnai-touch-plugin",
"version": "2.4.3",
"version": "2.4.4",
"description": "Homebridge Plugin to control heating/cooling via a Rinnai Touch WiFi Module",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion services/RinnaiTouchService.js
Expand Up @@ -269,7 +269,7 @@ class RinnaiTouchService extends EventEmitter {
this.#log.debug(this.constructor.name, 'updateZones', 'status');

let zones = [];
for(let zone of ['U','A','B','C','D']) {
for(let zone of this.AllZones) {
let installed = this.#stateService.getState('ZoneInstalled', status, zone);
if (installed === 'Y') {
zones.push(zone);
Expand Down

0 comments on commit 7cd12c5

Please sign in to comment.