├── README.md
├── btscrip.sh
├── castle.py
├── castleNodeRed.json
└── images
├── Node Red Dashboard.png
├── README.MD
├── castle.png
└── castledash.png
/README.md:
--------------------------------------------------------------------------------
1 | # IoT Minecraft Castle
2 |
3 |
4 |
Introduction
5 |
6 | This project is a approach to the IoT with some friendly tools like Node-RED, Minecraft and Raspberry Pi.
7 |
8 | The Castle
9 |
10 |
11 |
12 | I have found it here and was develop by Matt Hawkins
13 |
14 | The Code
15 |
16 | The Castle.py and castleNodeRed.json were runned in a Raspberry Pi (with Jesse), and the btscrip.sh in a Intel Edison which incorporates Bluetooth connectivity.
17 | Al the files use MQTT Protocol and the broker provided by the Eclipse Foundation
18 |
19 |
20 |
21 |
22 | The final product
23 |
24 | You can control the light in the environment in the dashboard, also, the walls height and the lights in each level of the castle
25 |
26 | The Gate control depends of the Bluetooth connectivity.
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/btscrip.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | on=0
3 | off=0
4 | while :
5 | do
6 | #Just Add yout Bluetooth address instead FF:FF:FF:FF.FF:FF:FF
7 | if l2ping -c 2 FF:FF:FF:FF:FF:FF -s 1 &> /dev/null
8 | then
9 | let on=${on}+1
10 | else
11 | let off=${off}+1
12 | fi
13 |
14 | if [[ $on -eq 5 && $off -le 5 ]]; then
15 | off=0
16 | on=0
17 | #echo "Opened"
18 | mosquitto_pub -h iot.eclipse.org -m "Open" -t /mc/nodeRed/CastleGate -r
19 | fi
20 | if [[ $off -eq 5 && $on -le 5 ]]; then
21 | on=0
22 | off=0
23 | #echo "Closed"
24 | mosquitto_pub -h iot.eclipse.org -m "Close" -t /mc/nodeRed/CastleGate -r
25 | fi
26 | done
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/castle.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/pyth:
2 | #--------------------------------------
3 | #
4 | # Minecraft Python API
5 | # Castle Builder
6 | #
7 | # This script creates a castle complete
8 | # with moat and perimeter walls.
9 | #
10 | # Author : Matt Hawkins
11 | # Date : 07/06/2014
12 | #
13 | # http://www.raspberrypi-spy.co.uk/
14 | #
15 | #---------------------------------------
16 | # Castle with IoT
17 | #
18 | # This script modifies the environment in
19 | # the castle, including castle properties
20 | # working with MQTT
21 | #
22 | # Author : https://github.com/cyaelcastro
23 | # Date : 03/20/2018
24 | #
25 | # Import Minecraft libraries
26 | import mcpi.minecraft as minecraft
27 | import mcpi.block as block
28 | import paho.mqtt.client as mqtt
29 | import time
30 |
31 | mc = minecraft.Minecraft.create()
32 |
33 | mc.postToChat("Let's build a castle!")
34 |
35 | #--------------------------------------
36 | # Define Functions
37 | #--------------------------------------
38 |
39 | def CreateWalls(size,baseheight,height,material,battlements,walkway):
40 | # Create 4 walls with a specified width, height and material.
41 | # Battlements and walkways can also be added to the top edges.
42 |
43 | mc.setBlocks(-size,baseheight+1,-size,size,baseheight+height,-size,material)
44 | mc.setBlocks(-size,baseheight+1,-size,-size,baseheight+height,size,material)
45 | mc.setBlocks(size,baseheight+1,size,-size,baseheight+height,size,material)
46 | mc.setBlocks(size,baseheight+1,size,size,baseheight+height,-size,material)
47 |
48 | # Add battlements to top edge
49 | if battlements==True:
50 | for x in range(0,(2*size)+1,2):
51 | mc.setBlock(size,baseheight+height+1,(x-size),material)
52 | mc.setBlock(-size,baseheight+height+1,(x-size),material)
53 | mc.setBlock((x-size),baseheight+height+1,size,material)
54 | mc.setBlock((x-size),baseheight+height+1,-size,material)
55 |
56 | for x in range(0,(2*size)+1,2):
57 | mc.setBlock(size,baseheight+height+2,(x-size),block.TORCH)
58 | mc.setBlock(-size,baseheight+height+2,(x-size),block.TORCH)
59 | mc.setBlock((x-size),baseheight+height+2,size,block.TORCH)
60 | mc.setBlock((x-size),baseheight+height+2,-size,block.TORCH)
61 |
62 | # Add wooden walkways
63 | if walkway==True:
64 | mc.setBlocks(-size+1,baseheight+height-1,size-1,size-1,baseheight+height-1,size-1,block.WOOD_PLANKS)
65 | mc.setBlocks(-size+1,baseheight+height-1,-size+1,size-1,baseheight+height-1,-size+1,block.WOOD_PLANKS)
66 | mc.setBlocks(-size+1,baseheight+height-1,-size+1,-size+1,baseheight+height-1,size-1,block.WOOD_PLANKS)
67 | mc.setBlocks(size-1,baseheight+height-1,-size+1,size-1,baseheight+height-1,size-1,block.WOOD_PLANKS)
68 |
69 | def CreateLandscape(moatwidth,moatdepth,islandwidth):
70 | # Set upper half to air
71 | mc.setBlocks(-128,1,-128,128,128,128,block.AIR)
72 | # Set lower half of world to dirt with a layer of grass
73 | mc.setBlocks(-128,-1,-128,128,-128,128,block.DIRT)
74 | mc.setBlocks(-128,0,-128,128,0,128,block.GRASS)
75 | # Create water moat
76 | mc.setBlocks(-moatwidth,0,-moatwidth,moatwidth,-moatdepth,moatwidth,block.WATER)
77 | # Create island inside moat
78 | mc.setBlocks(-islandwidth,0,-islandwidth,islandwidth,1,islandwidth,block.GRASS)
79 |
80 | def CreateKeep(size,baseheight,levels):
81 | # Create a keep with a specified number
82 | # of floors levels and a roof
83 | height=(levels*5)+5
84 |
85 | CreateWalls(size,baseheight,height,block.STONE_BRICK,True,True)
86 |
87 | # Floors & Windows
88 | for level in range(1,levels+1):
89 | mc.setBlocks(-size+1,(level*5)+baseheight,-size+1,size-1,(level*5)+baseheight,size-1,block.WOOD_PLANKS)
90 |
91 | # Windows
92 | for level in range(0,levels+1):
93 | CreateWindows(0,(level*5)+baseheight+2,size,"N")
94 | CreateWindows(0,(level*5)+baseheight+2,-size,"S")
95 | CreateWindows(-size,(level*5)+baseheight+2,0,"W")
96 | CreateWindows(size,(level*5)+baseheight+2,0,"E")
97 |
98 | # Door
99 | mc.setBlocks(0,baseheight+1,size,0,baseheight+2,size,block.AIR)
100 |
101 | def CreateWindows(x,y,z,dir):
102 |
103 | if dir=="N" or dir=="S":
104 | z1=z
105 | z2=z
106 | x1=x-2
107 | x2=x+2
108 |
109 | if dir=="E" or dir=="W":
110 | z1=z-2
111 | z2=z+2
112 | x1=x
113 | x2=x
114 |
115 | mc.setBlocks(x1,y,z1,x1,y+1,z1,block.AIR)
116 | mc.setBlocks(x2,y,z2,x2,y+1,z2,block.AIR)
117 |
118 | if dir=="N":
119 | a=3
120 | if dir=="S":
121 | a=2
122 | if dir=="W":
123 | a=0
124 | if dir=="E":
125 | a=1
126 |
127 | mc.setBlock(x1,y-1,z1,109,a)
128 | mc.setBlock(x2,y-1,z2,109,a)
129 |
130 | def dayLight(light):
131 | if light:
132 | mc.setBlocks(-50,60,-60,50,60,60,0)
133 | else:
134 | mc.setBlocks(-50,60,-60,50,60,60,1)
135 |
136 | def lightFloor(level, light):
137 | #for i in range(1,level+1):
138 | if light:
139 | mc.setBlocks(-4,5*(level+1),-4,4,5*(level+1),4,51)
140 | else:
141 | mc.setBlocks(-4,5*(level+1),-4,4,5*(level+1),4,block.AIR)
142 |
143 |
144 | #--------------------------------------
145 | #
146 | # MQTT
147 | #
148 | #--------------------------------------
149 |
150 | daylightFlag = True
151 | outterWallFlag = True
152 | gateFlag = False
153 | outterWallHeight = 8
154 | innerWallHeight = 8
155 | level0LightFlag = False
156 | level1LightFlag = False
157 | level2LightFlag = False
158 | level3LightFlag = False
159 |
160 |
161 | def on_message(client, userdata, message):
162 | global daylightFlag, outterWallHeight, innerWallHeight, outterWallFlag, gateFlag, level0LightFlag, level1LightFlag, level2LightFlag, level3LightFlag
163 | if message.topic == "/mc/nodeRed/Daylight":
164 | if message.payload.decode("utf-8") == "Light" and daylightFlag:
165 | dayLight(True)
166 | daylightFlag = False
167 | if message.payload.decode("utf-8") == "No light" and not daylightFlag:
168 | dayLight(False)
169 | daylightFlag = True
170 |
171 | if message.topic == "/mc/nodeRed/CastleGate":
172 | if message.payload.decode("utf-8") == "Open" and outterWallFlag:
173 | gateFlag = True
174 | OutterWall(outterWallHeight,gateFlag)
175 | InnerWall(innerWallHeight,gateFlag)
176 | outterWallFlag = False
177 |
178 | if message.payload.decode("utf-8") == "Close" and not outterWallFlag:
179 | gateFlag = False
180 | OutterWall(outterWallHeight,gateFlag)
181 | InnerWall(innerWallHeight,gateFlag)
182 | outterWallFlag = True
183 |
184 | if message.topic == "/mc/nodeRed/CastleLight/0":
185 | if message.payload.decode("utf-8") == "On" and level0LightFlag:
186 | lightFloor(0,True)
187 | level0LightFlag = False
188 | if message.payload.decode("utf-8") == "Off" and not level0LightFlag:
189 | lightFloor(0,False)
190 | level0LightFlag = True
191 |
192 | if message.topic == "/mc/nodeRed/CastleLight/1":
193 | if message.payload.decode("utf-8") == "On" and level1LightFlag:
194 | lightFloor(1,True)
195 | level1LightFlag = False
196 | if message.payload.decode("utf-8") == "Off" and not level1LightFlag:
197 | lightFloor(1,False)
198 | level1LightFlag = True
199 |
200 | if message.topic == "/mc/nodeRed/CastleLight/2":
201 | if message.payload.decode("utf-8") == "On" and level2LightFlag:
202 | lightFloor(2,True)
203 | level2LightFlag = False
204 | if message.payload.decode("utf-8") == "Off" and not level2LightFlag:
205 | lightFloor(2,False)
206 | level2LightFlag = True
207 |
208 | if message.topic == "/mc/nodeRed/CastleLight/3":
209 | if message.payload.decode("utf-8") == "On" and level3LightFlag:
210 | lightFloor(3,True)
211 | level3LightFlag = False
212 | if message.payload.decode("utf-8") == "Off" and not level3LightFlag:
213 | lightFloor(3,False)
214 | level3LightFlag = True
215 |
216 | if message.topic == "/mc/nodeRed/InnerWalls":
217 | innerWallHeight = int(message.payload.decode("utf-8"))
218 | InnerWall(innerWallHeight,gateFlag)
219 |
220 | if message.topic == "/mc/nodeRed/OutterWalls":
221 | outterWallHeight = int(message.payload.decode("utf-8"))
222 | OutterWall(outterWallHeight,gateFlag)
223 |
224 | def OutterWall (height, openGate):
225 |
226 | CreateWalls(20,1,50,block.AIR,False,False)
227 | CreateWalls(21,1,52,block.AIR,False,False)
228 | CreateWalls(21,1,height,block.STONE_BRICK,True,True)
229 | mc.setBlocks(-2,2,21,2,6,21,block.AIR)
230 | if openGate:
231 | #print "Open gate"
232 | mc.setBlocks(-2,2,21,2,6,21,block.AIR)
233 | mc.setBlocks(-2,1,24,2,1,34,block.WOOD_PLANKS)
234 | else:
235 | mc.setBlocks(-2,1,24,2,1,34,block.AIR)
236 | mc.setBlocks(-2,2,21,2,6,21,block.WOOD_PLANKS)
237 |
238 |
239 | def InnerWall (height, openGate):
240 | CreateWalls(13,1,52,block.AIR,False,False)
241 | CreateWalls(12,1,50,block.AIR,False,False)
242 | CreateWalls(13,1,height,block.STONE_BRICK,True,True)
243 | mc.setBlocks(-1,2,13,1,4,13,block.WOOD_PLANKS)
244 | if openGate:
245 | mc.setBlocks(-1,2,13,1,4,13,block.AIR)
246 |
247 | if __name__ == '__main__':
248 |
249 | #broker = "192.168.1.118"
250 | broker = "iot.eclipse.org"
251 | client = mqtt.Client("RaspberryCastle")
252 | client.on_message = on_message
253 | client.connect(broker)
254 |
255 | # print("Create ground and moat")
256 | CreateLandscape(33,10,23)
257 |
258 | print("Create outer walls")
259 | # CreateWalls(21,1,8,block.STONE_BRICK,True,True)
260 | global outterWallHeight, gateFlag, innerWallHeight
261 | OutterWall(outterWallHeight,gateFlag)
262 |
263 | #print("Create inner walls")
264 | InnerWall(innerWallHeight,gateFlag)
265 |
266 |
267 | #print("Create Keep with 4 levels")
268 | CreateKeep(5,1,4)
269 |
270 | #print("Position player on Keep's walkway")
271 | mc.player.setPos(0,30,4)
272 | #lightFloor(4,True)
273 |
274 |
275 |
276 | while True:
277 | client.loop_start()
278 | client.subscribe([("/mc/nodeRed/Daylight",0),("/mc/nodeRed/CastleGate",0),("/mc/nodeRed/CastleLight/#",0),("/mc/nodeRed/OutterWalls",0),("/mc/nodeRed/InnerWalls",0)])
279 | time.sleep(3) # wait
280 | client.loop_stop() #stop the loop
--------------------------------------------------------------------------------
/castleNodeRed.json:
--------------------------------------------------------------------------------
1 | [{"id":"2a099374.9a2dac","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"99336c78.4c8ab","type":"ui_base","z":0,"theme":{"name":"theme-dark","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#0071c5","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","reset":false},"themeState":{"base-color":{"default":"#097479","value":"#0071c5","edited":true},"page-titlebar-backgroundColor":{"value":"#0071c5","edited":false},"page-backgroundColor":{"value":"#111111","edited":false},"page-sidebar-backgroundColor":{"value":"#000000","edited":false},"group-textColor":{"value":"#129aff","edited":false},"group-borderColor":{"value":"#555555","edited":false},"group-backgroundColor":{"value":"#333333","edited":false},"widget-textColor":{"value":"#eeeeee","edited":false},"widget-backgroundColor":{"value":"#0071c5","edited":false},"widget-borderColor":{"value":"#333333","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}}},"site":{"name":"Minecraft Castle","hideToolbar":"false","allowSwipe":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"89c7fde1.4503a","type":"ui_tab","z":"","name":"Minecraft Castle","icon":"dashboard"},{"id":"39206a8b.c5f8a6","type":"mqtt-broker","z":"","name":"Eclipse","broker":"iot.eclipse.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"/pruebasNodeRed","willQos":"0","willPayload":"","birthTopic":"/pruebasNodeRed","birthQos":"0","birthPayload":""},{"id":"8fb3768.b8ac088","type":"ui_group","z":"","name":"Castle outside","tab":"89c7fde1.4503a","order":2,"disp":true,"width":"6","collapse":false},{"id":"e4b868dc.4bb848","type":"ui_group","z":"","name":"Environment","tab":"89c7fde1.4503a","order":1,"disp":true,"width":"6","collapse":false},{"id":"af8cc9b6.e919d8","type":"ui_group","z":"","name":"Castle inside","tab":"89c7fde1.4503a","disp":true,"width":"6","collapse":false},{"id":"3e0dfd0b.2101e2","type":"ui_group","z":"","name":"Walls","tab":"89c7fde1.4503a","disp":true,"width":"6","collapse":false},{"id":"9244c093.ccefd","type":"ui_switch","z":"2a099374.9a2dac","name":"","label":"Daylight","group":"e4b868dc.4bb848","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"Light","onvalueType":"str","onicon":"","oncolor":"","offvalue":"No light","offvalueType":"str","officon":"","offcolor":"","x":114,"y":27,"wires":[["b81bda78.93ccf8","afc873e6.813d5"]]},{"id":"b3372389.28ee1","type":"ui_switch","z":"2a099374.9a2dac","name":"Level 1 Light","label":"Level 1 Light","group":"af8cc9b6.e919d8","order":3,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"On","onvalueType":"str","onicon":"","oncolor":"","offvalue":"Off","offvalueType":"str","officon":"","offcolor":"","x":585,"y":387,"wires":[["810bd8d.aab2028"]]},{"id":"ebdb6a38.48e3d8","type":"ui_switch","z":"2a099374.9a2dac","name":"Level 0 Light","label":"Level 0 Light","group":"af8cc9b6.e919d8","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"/mc/nodeRed/CastleLight/0","style":"","onvalue":"On","onvalueType":"str","onicon":"","oncolor":"","offvalue":"Off","offvalueType":"str","officon":"","offcolor":"","x":585,"y":328,"wires":[["8bdf3f76.73035"]]},{"id":"de8a35c4.974498","type":"ui_switch","z":"2a099374.9a2dac","name":"Level 2 Light","label":"Level 2 Light","group":"af8cc9b6.e919d8","order":5,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"On","onvalueType":"str","onicon":"","oncolor":"","offvalue":"Off","offvalueType":"str","officon":"","offcolor":"","x":584,"y":438,"wires":[["df07f960.ddd098"]]},{"id":"c1ee785b.242278","type":"ui_switch","z":"2a099374.9a2dac","name":"Level 3 Light","label":"Level 3 Light","group":"af8cc9b6.e919d8","order":7,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"On","onvalueType":"str","onicon":"","oncolor":"","offvalue":"Off","offvalueType":"str","officon":"","offcolor":"","x":578,"y":482,"wires":[["c1bf6b4a.29b0d8"]]},{"id":"e42c3eaa.18b7a","type":"ui_slider","z":"2a099374.9a2dac","name":"Outter Walls Height","label":"Outter Walls Height","group":"3e0dfd0b.2101e2","order":2,"width":0,"height":0,"passthru":true,"topic":"","min":"8","max":"50","step":1,"x":128,"y":165,"wires":[["447d014c.0b6a3","560144d.eb329bc"]]},{"id":"cff1b833.b88928","type":"ui_slider","z":"2a099374.9a2dac","name":"Inner Walls Height","label":"Inner Walls Height","group":"3e0dfd0b.2101e2","order":4,"width":0,"height":0,"passthru":true,"topic":"","min":"8","max":"50","step":1,"x":144,"y":247,"wires":[["92dac8ea.6bc438","b9fe4946.4225e8"]]},{"id":"447d014c.0b6a3","type":"ui_gauge","z":"2a099374.9a2dac","name":"","group":"3e0dfd0b.2101e2","order":3,"width":0,"height":0,"gtype":"gage","title":"Outter","label":"units","format":"{{value}}","min":0,"max":"50","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":331,"y":146,"wires":[]},{"id":"92dac8ea.6bc438","type":"ui_gauge","z":"2a099374.9a2dac","name":"","group":"3e0dfd0b.2101e2","order":5,"width":0,"height":0,"gtype":"gage","title":"Inner","label":"blocks","format":"{{value}}","min":"0","max":"50","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":327,"y":226,"wires":[]},{"id":"560144d.eb329bc","type":"mqtt out","z":"2a099374.9a2dac","name":"","topic":"/mc/nodeRed/OutterWalls","qos":"","retain":"","broker":"39206a8b.c5f8a6","x":387,"y":183,"wires":[]},{"id":"b9fe4946.4225e8","type":"mqtt out","z":"2a099374.9a2dac","name":"","topic":"/mc/nodeRed/InnerWalls","qos":"","retain":"","broker":"39206a8b.c5f8a6","x":389,"y":260,"wires":[]},{"id":"8bdf3f76.73035","type":"mqtt out","z":"2a099374.9a2dac","name":"Level 0","topic":"/mc/nodeRed/CastleLight/0","qos":"0","retain":"true","broker":"39206a8b.c5f8a6","x":762,"y":325,"wires":[]},{"id":"810bd8d.aab2028","type":"mqtt out","z":"2a099374.9a2dac","name":"Level 1","topic":"/mc/nodeRed/CastleLight/1","qos":"","retain":"true","broker":"39206a8b.c5f8a6","x":760,"y":387,"wires":[]},{"id":"df07f960.ddd098","type":"mqtt out","z":"2a099374.9a2dac","name":"Level 2","topic":"/mc/nodeRed/CastleLight/2","qos":"","retain":"true","broker":"39206a8b.c5f8a6","x":761,"y":436,"wires":[]},{"id":"c1bf6b4a.29b0d8","type":"mqtt out","z":"2a099374.9a2dac","name":"Level 3","topic":"/mc/nodeRed/CastleLight/3","qos":"","retain":"true","broker":"39206a8b.c5f8a6","x":758,"y":477,"wires":[]},{"id":"36f9583.9a21fa8","type":"ui_text","z":"2a099374.9a2dac","group":"af8cc9b6.e919d8","order":2,"width":0,"height":0,"name":"","label":"Level 0 Lights","format":"{{msg.payload}}","layout":"row-center","x":414,"y":330,"wires":[]},{"id":"49453e03.0d91a","type":"mqtt in","z":"2a099374.9a2dac","name":"Level 0","topic":"/mc/nodeRed/CastleLight/0","qos":"0","broker":"39206a8b.c5f8a6","x":70,"y":331,"wires":[["d6ba833e.7c803"]]},{"id":"f0bfc782.c99958","type":"ui_text","z":"2a099374.9a2dac","group":"af8cc9b6.e919d8","order":4,"width":0,"height":0,"name":"","label":"Level 1 Lights","format":"{{msg.payload}}","layout":"row-center","x":241,"y":389,"wires":[]},{"id":"f2239038.691b2","type":"mqtt in","z":"2a099374.9a2dac","name":"Level 1","topic":"/mc/nodeRed/CastleLight/1","qos":"0","broker":"39206a8b.c5f8a6","x":68,"y":388,"wires":[["f0bfc782.c99958","d00bb16e.32e1b"]]},{"id":"9931a20b.20583","type":"ui_text","z":"2a099374.9a2dac","group":"af8cc9b6.e919d8","order":6,"width":0,"height":0,"name":"","label":"Level 2 Lights","format":"{{msg.payload}}","layout":"row-center","x":233,"y":436,"wires":[]},{"id":"fa20b396.ead92","type":"mqtt in","z":"2a099374.9a2dac","name":"Level 2","topic":"/mc/nodeRed/CastleLight/2","qos":"0","broker":"39206a8b.c5f8a6","x":65,"y":438,"wires":[["9931a20b.20583","5528ba60.c45024"]]},{"id":"9ba51362.a8b2c","type":"ui_text","z":"2a099374.9a2dac","group":"af8cc9b6.e919d8","order":8,"width":0,"height":0,"name":"","label":"Level 3 Lights","format":"{{msg.payload}}","layout":"row-center","x":231,"y":478,"wires":[]},{"id":"de6d0b62.bbd518","type":"mqtt in","z":"2a099374.9a2dac","name":"Level 3","topic":"/mc/nodeRed/CastleLight/3","qos":"0","broker":"39206a8b.c5f8a6","x":62,"y":481,"wires":[["9ba51362.a8b2c","1de69934.c8ea77"]]},{"id":"d6ba833e.7c803","type":"delay","z":"2a099374.9a2dac","name":"","pauseType":"rate","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":221,"y":323,"wires":[["ebdb6a38.48e3d8","36f9583.9a21fa8"]]},{"id":"d00bb16e.32e1b","type":"delay","z":"2a099374.9a2dac","name":"","pauseType":"rate","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":428,"y":390,"wires":[["b3372389.28ee1"]]},{"id":"5528ba60.c45024","type":"delay","z":"2a099374.9a2dac","name":"","pauseType":"rate","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":422,"y":438,"wires":[["de8a35c4.974498"]]},{"id":"1de69934.c8ea77","type":"delay","z":"2a099374.9a2dac","name":"","pauseType":"rate","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":420,"y":485,"wires":[["c1ee785b.242278"]]},{"id":"b81bda78.93ccf8","type":"mqtt out","z":"2a099374.9a2dac","name":"","topic":"/mc/nodeRed/Daylight","qos":"","retain":"true","broker":"39206a8b.c5f8a6","x":402,"y":26,"wires":[]},{"id":"afc873e6.813d5","type":"switch","z":"2a099374.9a2dac","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Light","vt":"str"},{"t":"eq","v":"No light","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":590,"y":60,"wires":[["7acd296e.f332b8"],["f61d1747.fa4908"]]},{"id":"7acd296e.f332b8","type":"change","z":"2a099374.9a2dac","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":20,"wires":[["8bdf3f76.73035","810bd8d.aab2028","df07f960.ddd098","c1bf6b4a.29b0d8"]]},{"id":"f61d1747.fa4908","type":"change","z":"2a099374.9a2dac","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"On","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":100,"wires":[["8bdf3f76.73035","810bd8d.aab2028","df07f960.ddd098","c1bf6b4a.29b0d8"]]},{"id":"8f9c4ae0.28fdf8","type":"mqtt in","z":"2a099374.9a2dac","name":"CastleGate","topic":"/mc/nodeRed/CastleGate","qos":"2","broker":"39206a8b.c5f8a6","x":100,"y":100,"wires":[["6df135b5.c2636c"]]},{"id":"6df135b5.c2636c","type":"ui_text","z":"2a099374.9a2dac","group":"8fb3768.b8ac088","order":0,"width":0,"height":0,"name":"","label":"CastleGate","format":"{{msg.payload}}","layout":"row-center","x":450,"y":100,"wires":[]}]
--------------------------------------------------------------------------------
/images/Node Red Dashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cyaelcastro/Castle-IoT/1b9748ef09f7ed9131dfaa4561b97ee0d98004c4/images/Node Red Dashboard.png
--------------------------------------------------------------------------------
/images/README.MD:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/images/castle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cyaelcastro/Castle-IoT/1b9748ef09f7ed9131dfaa4561b97ee0d98004c4/images/castle.png
--------------------------------------------------------------------------------
/images/castledash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cyaelcastro/Castle-IoT/1b9748ef09f7ed9131dfaa4561b97ee0d98004c4/images/castledash.png
--------------------------------------------------------------------------------