Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zwave Mock addon: More mocks, rename files to include node ID, update Z-Wave JS #175

Merged
merged 9 commits into from
Oct 11, 2024
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
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