Documente Academic
Documente Profesional
Documente Cultură
It then adds a property to the incoming message based on its payload.state property value.
This is done here so that my (many) input nodes don't have to specify their color, and I only
have to change this one place if I decide to play with different colors.
It then updates the state variable and saves the new state to the flow variable "firstFloorState",
and passes this state object to the "template" node.
Basically, this function node serves as an aggregator of state messages into a single state object
for the whole system.
This is the deceptively simple last step in the actual UI node. Double click the "template" node,
and set the various values for "Name", "Group", etc., and make it general look like this. You'll
have to play with the size settings, and I recommend you choose a size that you
like before placing all the icons, because changing it later will change the layout and you'll have
to go through and place them all again:
For the template, we are going to paste an Angular HTML template into this field, that looks like
the following:
If you know basic HTML, this shouldn't look too daunting besides some Angular specific stuff,
but here's the 100,000 view of what this is doing.
1. The whole template is basically one big <div> element with the overhead image of the house
set as the background. The style rules are necessary to make things overlay the image in a
minute.
2. The second <div> element represents each one of our devices. The special sauce here is the
angular "ng-repeat", which tells the UI framework to repeat this element and its contents for
each element in the msg.payload which is handed to this node. That msg.payload is going to be
an array of individual device status objects that our previous function node put together for us.
So for each device status, create one <div> element.
3. Various aspects of the <div> element will be taken off the status object for a device. That's
hard to visualize with seeing the message