export thermostat to openhab
This commit is contained in:
5
dist/Export.js
vendored
5
dist/Export.js
vendored
@ -17,7 +17,7 @@ function SwitchExport(itemId, label, stateTopic, stateFeedbackTopic, type) {
|
|||||||
}
|
}
|
||||||
exports.SwitchExport = SwitchExport;
|
exports.SwitchExport = SwitchExport;
|
||||||
function ThermostatExport(itemId, label, temperatureTopic, temperatureFeedbackTopic) {
|
function ThermostatExport(itemId, label, temperatureTopic, temperatureFeedbackTopic) {
|
||||||
return { 'homekit': ThermostatHomekitExport(itemId, label, temperatureTopic, temperatureFeedbackTopic), 'openhab': '' };
|
return { 'homekit': ThermostatHomekitExport(itemId, label, temperatureTopic, temperatureFeedbackTopic), 'openhab': ThermostatOpenHAPExport(itemId, label, temperatureTopic, temperatureFeedbackTopic) };
|
||||||
}
|
}
|
||||||
exports.ThermostatExport = ThermostatExport;
|
exports.ThermostatExport = ThermostatExport;
|
||||||
function ContactExport(itemId, label, status) {
|
function ContactExport(itemId, label, status) {
|
||||||
@ -97,6 +97,9 @@ function SwitchOpenHABExport(id, label, setOn, statusOn) {
|
|||||||
// Switch windowLightKitchen {mqtt=">[localbroker:nodered/items/windowLightKitchen:command:*:default]", mqtt="<[localbroker:nodered/items/windowLightKitchen/feedback:state:default]"}
|
// Switch windowLightKitchen {mqtt=">[localbroker:nodered/items/windowLightKitchen:command:*:default]", mqtt="<[localbroker:nodered/items/windowLightKitchen/feedback:state:default]"}
|
||||||
return `Switch ${id} {mqtt=">[localbroker:${setOn}:command:*:default],<[localbroker:${statusOn}:state:default]"}`;
|
return `Switch ${id} {mqtt=">[localbroker:${setOn}:command:*:default],<[localbroker:${statusOn}:state:default]"}`;
|
||||||
}
|
}
|
||||||
|
function ThermostatOpenHAPExport(id, label, setTemperature, statusTemperature) {
|
||||||
|
return `Number ${id} {mqtt=">[localbroker:${setTemperature}:command:*:default],<[localbroker:${statusTemperature}:state:default]"}`;
|
||||||
|
}
|
||||||
function HueColorLightHomekitExport(id, label, stateTopic, stateFeedbackTopic, brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic, saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic) {
|
function HueColorLightHomekitExport(id, label, stateTopic, stateFeedbackTopic, brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic, saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic) {
|
||||||
let o = {
|
let o = {
|
||||||
"id": id,
|
"id": id,
|
||||||
|
@ -28,7 +28,7 @@ export function SwitchExport(itemId: string, label: string, stateTopic: string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function ThermostatExport(itemId: string, label: string, temperatureTopic: string, temperatureFeedbackTopic: string) : ExportType {
|
export function ThermostatExport(itemId: string, label: string, temperatureTopic: string, temperatureFeedbackTopic: string) : ExportType {
|
||||||
return {'homekit': ThermostatHomekitExport(itemId, label, temperatureTopic, temperatureFeedbackTopic), 'openhab': ''}
|
return {'homekit': ThermostatHomekitExport(itemId, label, temperatureTopic, temperatureFeedbackTopic), 'openhab': ThermostatOpenHAPExport(itemId, label, temperatureTopic, temperatureFeedbackTopic)}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ContactExport(itemId: string, label: string, status: string) : ExportType {
|
export function ContactExport(itemId: string, label: string, status: string) : ExportType {
|
||||||
@ -120,6 +120,10 @@ function SwitchOpenHABExport(id: string, label: string, setOn: string, statusOn:
|
|||||||
return `Switch ${id} {mqtt=">[localbroker:${setOn}:command:*:default],<[localbroker:${statusOn}:state:default]"}`
|
return `Switch ${id} {mqtt=">[localbroker:${setOn}:command:*:default],<[localbroker:${statusOn}:state:default]"}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ThermostatOpenHAPExport(id: string, label: string, setTemperature: string, statusTemperature: string) : string {
|
||||||
|
return `Number ${id} {mqtt=">[localbroker:${setTemperature}:command:*:default],<[localbroker:${statusTemperature}:state:default]"}`
|
||||||
|
}
|
||||||
|
|
||||||
function HueColorLightHomekitExport(id: string, label: string,
|
function HueColorLightHomekitExport(id: string, label: string,
|
||||||
stateTopic: string, stateFeedbackTopic: string,
|
stateTopic: string, stateFeedbackTopic: string,
|
||||||
brightnessTopic: string, brightnessFeedbackTopic: string,
|
brightnessTopic: string, brightnessFeedbackTopic: string,
|
||||||
|
Reference in New Issue
Block a user