Skip to content

Commit

Permalink
Trying things
Browse files Browse the repository at this point in the history
  • Loading branch information
HeatitControls committed Feb 20, 2024
1 parent 72a5ba0 commit da0c76b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .homeycompose/flow/triggers/thermofloor_mode_changed.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"tokens": [
{
"name": "mode",
"type": "string",
"title": {
"en": "ID",
"nl": "ID"
Expand All @@ -26,6 +27,7 @@
},
{
"name": "mode_name",
"type": "string",
"title": {
"en": "Name",
"nl": "Naam"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"name": "device",
"type": "device",
"filter": "driver_id=ZM-Thermostat-16A"
"filter": "driver_id=ZM-Thermostat-16A|Z-TRM6"
},
{
"name": "state",
Expand Down
17 changes: 15 additions & 2 deletions drivers/Z-TRM6/device.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';
const {ZwaveDevice} = require('homey-zwavedriver');
const Homey = require('homey');

const CapabilityToThermostatMode = {
'off': 'Off',
Expand All @@ -13,7 +14,10 @@ const ThermostatModeToCapability = {
'Cool': 'cool',
}

let timer = null
let timer = null;

ZwaveDevice.setMaxListeners(20);


class ZTRM6Device extends ZwaveDevice {
async onNodeInit() {
Expand All @@ -30,6 +34,14 @@ class ZTRM6Device extends ZwaveDevice {
this.registerCapability('measure_temperature', 'SENSOR_MULTILEVEL');
this.registerCapability('target_temperature', 'THERMOSTAT_SETPOINT');

let targetTempValue = await this.getCapabilityValue('target_temperature');

this.setCapabilityValue('target_temperature', targetTempValue).catch(error => {
console.error('Error setting target_temperature:', error);
});



await this.registerThermostatModeCapability();
await this.registerTemperature();

Expand Down Expand Up @@ -69,7 +81,7 @@ class ZTRM6Device extends ZwaveDevice {
&& report.Level.hasOwnProperty('Scale')) {
// Some devices send this when no temperature sensor is connected
if (report['Sensor Value (Parsed)'] === -999.9) return null;
this.log('+++++++ registerTemperature:', report)
this.log('+++++++ registerTemperature: ', capabilityId, '+++++++', report)
if (report.Level.Scale === 0) {
if (capabilityId === 'measure_temperature.internal') {
this.setCapabilityValue('measure_temperature', report['Sensor Value (Parsed)']).catch(this.error);
Expand Down Expand Up @@ -161,6 +173,7 @@ class ZTRM6Device extends ZwaveDevice {
return null;
}
});
this.setAvailable().catch(this.error);
}
}

Expand Down

0 comments on commit da0c76b

Please sign in to comment.