uwap-home, heating: support temperature offsets
This commit is contained in:
parent
6b78cc0a2f
commit
27a9544092
1 changed files with 21 additions and 9 deletions
|
|
@ -101,12 +101,24 @@ const topicTasmota = (name: string, topic: string) => ({
|
||||||
const topicHeating = (name: string) => ({
|
const topicHeating = (name: string) => ({
|
||||||
[`heater${name}Tsoll`]: {
|
[`heater${name}Tsoll`]: {
|
||||||
state: {
|
state: {
|
||||||
name: `tele/home-rust/fritzbox/device/${name}/tsoll`,
|
name: `tele/home-rust/fritzbox/device/${name}`,
|
||||||
type: (msg) => ((parseFloat(msg.toString().split(" ")[1])
|
type: (msg) => {
|
||||||
/2).toString())
|
const json = JSON.parse(msg.toString());
|
||||||
|
if (!json || !json["tsoll"]) {
|
||||||
|
return "126.5";
|
||||||
|
} else {
|
||||||
|
const tsoll = json["tsoll"] / 2;
|
||||||
|
if (!json["offset"] || tsoll > 50) {
|
||||||
|
return tsoll.toString();
|
||||||
|
} else {
|
||||||
|
return (tsoll - json["offset"]/10).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
command: {
|
command: {
|
||||||
name: `home-rust/fritzbox/device/${name}/tsoll/set`,
|
name: `home-rust/fritzbox/device/${name}/tsoll/set`,
|
||||||
|
//TODO: add offset before writing out new value
|
||||||
type: (msg) => (Buffer.from((parseFloat(msg) * 2).toString()))
|
type: (msg) => (Buffer.from((parseFloat(msg) * 2).toString()))
|
||||||
},
|
},
|
||||||
defaultValue: "126.5"
|
defaultValue: "126.5"
|
||||||
|
|
@ -180,7 +192,7 @@ const radiatorUI = (name: string) => ([
|
||||||
text: "Volle Power",
|
text: "Volle Power",
|
||||||
icon: svg(icons.mdiRadiator),
|
icon: svg(icons.mdiRadiator),
|
||||||
on: "127",
|
on: "127",
|
||||||
off: "25"
|
off: "22"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -188,20 +200,20 @@ const radiatorUI = (name: string) => ([
|
||||||
text: "Ausschalten",
|
text: "Ausschalten",
|
||||||
icon: svg(icons.mdiRadiatorDisabled),
|
icon: svg(icons.mdiRadiatorDisabled),
|
||||||
on: "126.5",
|
on: "126.5",
|
||||||
off: "25"
|
off: "22"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "slider",
|
type: "slider",
|
||||||
min: 8,
|
min: 8,
|
||||||
max: 28,
|
max: 33,
|
||||||
step: 0.5,
|
step: 0.5,
|
||||||
text: "Zieltemperatur",
|
text: "Zieltemperatur",
|
||||||
icon: svg(icons.mdiOilTemperature),
|
icon: svg(icons.mdiOilTemperature),
|
||||||
topic: `heater${name}Tsoll`,
|
topic: `heater${name}Tsoll`,
|
||||||
marks: [
|
marks: [
|
||||||
{ value: 8, label: "8°C" },
|
{ value: 3, label: "3°C" },
|
||||||
{ value: 18, label: "18°C" },
|
{ value: 22, label: "22°C" },
|
||||||
{ value: 28, label: "28°C" }
|
{ value: 33, label: "33°C" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue