Hello,
I want to show temperature en humidity form different deivces on an floorplan. So I use a join to combine the different payloads. After that I use a function to save the values and restore them at reload. ( otherwise I have empty values).
This is the output of the join node:
So I have 4 different payloads.
This is the function node:
var temp1 = flow.get("tBadkamer") || undefined;
var hum1 = flow.get("hBadkamer") || undefined;
var temp2 = flow.get("tEntree") || undefined;
var hum2 = flow.get("hEntree") || undefined;
var temp3 = flow.get("tBuiten") || undefined;
var hum3 = flow.get("hBuiten") || undefined;
var temp4 = flow.get("tWoonkamer") || undefined;
var hum4 = flow.get("hWoonkamer") || undefined;
flow.set("tBadkamer",msg.payload[1].sensorDataPoints.insideTemperature.celsius);
flow.set("hBadkamer",msg.payload[1].sensorDataPoints.humidity.percentage);
msg.payload.tbadkamer = temp1
msg.payload.hbadkamer = hum1
flow.set("tEntree",msg.payload[2].sensorDataPoints.insideTemperature.celsius);
flow.set("hEntree",msg.payload[2].sensorDataPoints.humidity.percentage);
msg.payload.tentree = temp2
msg.payload.hentree = hum2
return msg
flow.set("tBuiten",msg.payload[3].devices[0].modules[0].dashboard_data.Temperature);
flow.set("hBuiten",msg.payload[3].devices[0].modules[0].dashboard_data.Humidity);
msg.payload.tbuiten = temp3
msg.payload.hbuiten = hum3
return msg
flow.set("tWoonkamer",msg.payload[0].sensorDataPoints.insideTemperature.celsius);
flow.set("hWoonkamer",msg.payload[0].sensorDataPoints.humidity.percentage);
msg.payload.twoonkamer = temp4
msg.payload.hWoonkamer = hum4
return msg
This is the template:
<style>
#THBuiten {
left: 1300px !important;
Top: 730px !important;
}
#THWoonkamer {
left: 500px !important;
Top: 310px !important;
}
#THBadkamer {
left: 1250px !important;
Top: 250px !important;
}
#THEntree {
left: 30% !important;
Top: 65% !important;
}
#valuehome {
color: black;
vertical-align: middle;
text-align: right;
}
#svghome {
text-align: -webkit-right;
}
.divTable{
display: table;
border-collapse: separate;
border: 2px solid #999999;
border-radius: 10px;
position: absolute;
width:100px;
height:30px;
}
.divTableRow {
display: table-row;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
}
.divTableCell, .divTableHead {
border: 1px solid #999999;
display: table-cell;
z-index: 1000;
}
.divTableBody {
display: table-row-group;
}
</style>
<div>
<div class="divTable" id="THBuiten">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell" id="valuehome">{{msg.payload.tbuiten}}</div><div class="divTableCell" id="valuehome">°C</div><div class="divTableCell" id="svghome"><img src="icons/thermometer.svg" width="30" height="30"></div>
</div>
<div class="divTableRow">
<div class="divTableCell" id="valuehome">{{msg.payload.hbuiten}}</div><div class="divTableCell" id="valuehome">%</div><div class="divTableCell" id="svghome"><img src="icons/humidity.svg" width="30" height="30"></div>
</div>
</div>
</div>
</div>
<div>
<div class="divTable" id="THWoonkamer">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell" id="valuehome">{{msg.payload.twoonkamer}}</div><div class="divTableCell" id="valuehome">°C</div><div class="divTableCell" id="svghome"><img src="icons/thermometer.svg" width="30" height="30"></div>
</div>
<div class="divTableRow">
<div class="divTableCell" id="valuehome">{{msg.payload.hwoonkamer}}</div><div class="divTableCell" id="valuehome">%</div><div class="divTableCell" id="svghome"><img src="icons/humidity.svg" width="30" height="30"></div>
</div>
</div>
</div>
<div>
<div class="divTable" id="THBadkamer">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell" id="valuehome">{{flow.temp1}}</div><div class="divTableCell" id="valuehome">°C</div><div class="divTableCell" id="svghome"><img src="icons/thermometer.svg" width="30" height="30"></div>
</div>
<div class="divTableRow">
<div class="divTableCell" id="valuehome">{{flow.hum1}}</div><div class="divTableCell" id="valuehome">%</div><div class="divTableCell" id="svghome"><img src="icons/humidity.svg" width="30" height="30"></div>
</div>
</div>
</div>
</div>
<div>
<div class="divTable" id="THEntree">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell" id="valuehome">{{msg.payload.tentree}}</div><div class="divTableCell" id="valuehome">°C</div><div class="divTableCell" id="svghome"><img src="icons/thermometer.svg" width="30" height="30"></div>
</div>
<div class="divTableRow">
<div class="divTableCell" id="valuehome">{{msg.payload.hentree}}</div><div class="divTableCell" id="valuehome">%</div><div class="divTableCell" id="svghome"><img src="icons/humidity.svg" width="30" height="30"></div>
</div>
</div>
</div>
</div>
</div>
But I don't get any values. Anyone know why?