Skip to content

Commit

Permalink
Zwave Mock addon: More mocks, rename files to include node ID, update…
Browse files Browse the repository at this point in the history
… Z-Wave JS (#175)

* add new mock files for switches, rename files to include node ID

* add two more dumps

* Bump zwave-js

* Add mock for setback thermostat

* bump zwave-js

* add thermostat without overlap between modes and setpoints

* bump addon version

* remove duplicate mock file
  • Loading branch information
AlCalzone authored Oct 11, 2024
1 parent 55d0dd3 commit 2386b44
Show file tree
Hide file tree
Showing 11 changed files with 7,495 additions and 12 deletions.
2 changes: 1 addition & 1 deletion zwave_mock_server/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ build_from:
aarch64: ghcr.io/home-assistant/aarch64-base:3.19
args:
ZWAVEJS_SERVER_VERSION: 1.38.0
ZWAVEJS_VERSION: 13.5.0
ZWAVEJS_VERSION: 13.8.0
2 changes: 1 addition & 1 deletion zwave_mock_server/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Z-Wave JS Mock Server
version: 1.1.0
version: 1.2.0
slug: zwave_mock_server
description: Simple Z-Wave JS Mock Server for testing purposes - Instantiates a Z-Wave JS Server using mock/dump files for testing purposes.
url: https://github.com/home-assistant/addons/tree/master/zwave_mock_server
Expand Down
16 changes: 6 additions & 10 deletions ...ck_files/thermostat-from-certification.js → ...les/003-thermostat-setpoint-no-overlap.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
/// This mock simulates a thermostat without overlap between its thermostat modes and thermostat setpoints
/// It MUST be possible to change all setpoints

// @ts-check
const {
CommandClasses,
} = require("@zwave-js/core");
const {
ccCaps,
} = require("@zwave-js/testing");
const {
ThermostatMode,
ThermostatSetpointType,
} = require("zwave-js");
const { CommandClasses } = require("@zwave-js/core");
const { ccCaps } = require("@zwave-js/testing");
const { ThermostatMode, ThermostatSetpointType } = require("zwave-js");

/** @type {import("zwave-js/Testing").MockServerOptions["config"]} */
module.exports.default = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/// This mock simulates a device with a Multilevel Switch, a Binary Switch, and a Color Switch command class
/// The resulting entities should be a colored light and a switch.

// @ts-check
const { CommandClasses } = require("@zwave-js/core");
const { ccCaps } = require("@zwave-js/testing");
const { ColorComponent } = require("zwave-js");

/** @type {import("zwave-js/Testing").MockServerOptions["config"]} */
module.exports.default = {
nodes: [
{
id: 4,
capabilities: {
commandClasses: [
CommandClasses.Version,
ccCaps({
ccId: CommandClasses["Multilevel Switch"],
isSupported: true,
version: 4,
}),
ccCaps({
ccId: CommandClasses["Binary Switch"],
isSupported: true,
version: 2,
}),
ccCaps({
ccId: CommandClasses["Color Switch"],
isSupported: true,
version: 3,
colorComponents: {
[ColorComponent.Red]: 0,
[ColorComponent.Green]: 0,
[ColorComponent.Blue]: 0,
},
}),
],
},
},
],
};
25 changes: 25 additions & 0 deletions zwave_mock_server/default_mock_files/005-binary-switch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/// This mock simulates a device with just a Binary Switch

// @ts-check
const { CommandClasses } = require("@zwave-js/core");
const { ccCaps } = require("@zwave-js/testing");
const { ColorComponent } = require("zwave-js");

/** @type {import("zwave-js/Testing").MockServerOptions["config"]} */
module.exports.default = {
nodes: [
{
id: 5,
capabilities: {
commandClasses: [
CommandClasses.Version,
ccCaps({
ccId: CommandClasses["Binary Switch"],
isSupported: true,
version: 2,
}),
],
},
},
],
};
25 changes: 25 additions & 0 deletions zwave_mock_server/default_mock_files/006-multilevel-switch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/// This mock simulates a device with just a Multilevel Switch

// @ts-check
const { CommandClasses } = require("@zwave-js/core");
const { ccCaps } = require("@zwave-js/testing");
const { ColorComponent } = require("zwave-js");

/** @type {import("zwave-js/Testing").MockServerOptions["config"]} */
module.exports.default = {
nodes: [
{
id: 6,
capabilities: {
commandClasses: [
CommandClasses.Version,
ccCaps({
ccId: CommandClasses["Multilevel Switch"],
isSupported: true,
version: 4,
}),
],
},
},
],
};
41 changes: 41 additions & 0 deletions zwave_mock_server/default_mock_files/007-binary-color-switch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/// This mock simulates a device with a Binary Switch, and a Color Switch CC.
/// The resulting entity should support on/off and dimming by reducing the color intensity.

// @ts-check
const { CommandClasses } = require("@zwave-js/core");
const { ccCaps } = require("@zwave-js/testing");
const { ColorComponent } = require("zwave-js");

/** @type {import("zwave-js/Testing").MockServerOptions["config"]} */
module.exports.default = {
nodes: [
{
id: 7,
capabilities: {
commandClasses: [
CommandClasses.Version,
ccCaps({
ccId: CommandClasses["Multilevel Switch"],
isSupported: true,
version: 4,
}),
ccCaps({
ccId: CommandClasses["Binary Switch"],
isSupported: true,
version: 2,
}),
ccCaps({
ccId: CommandClasses["Color Switch"],
isSupported: true,
version: 3,
colorComponents: {
[ColorComponent.Red]: 0,
[ColorComponent.Green]: 0,
[ColorComponent.Blue]: 0,
},
}),
],
},
},
],
};
Loading

0 comments on commit 2386b44

Please sign in to comment.