signage: bring in from external repo

This is b28e6f07aa48f1e2f01eb37bffa180f97a7b03bd from
https://code.hackerspace.pl/q3k/love2d-signage/. We only keep code
commited by inf and q3k, and we're both now licensing this code under
the ISC license, as per COPYING in the root of hscloud.

Change-Id: Ibeee2e6923605e4b1a17a1d295867c056863ef59
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1335
Reviewed-by: informatic <informatic@hackerspace.pl>
Reviewed-by: q3k <q3k@hackerspace.pl>
diff --git a/hswaw/signage/nodes/at.lua b/hswaw/signage/nodes/at.lua
new file mode 100644
index 0000000..9adf98c
--- /dev/null
+++ b/hswaw/signage/nodes/at.lua
@@ -0,0 +1,46 @@
+local node = ThreadNode:extend('nodes.at', {
+  threadFile = 'nodes/at_thread.lua',
+  threadChannel = 'at',
+
+  api = 'http://at.hackerspace.pl/api',
+})
+
+local bigFont = love.graphics.newFont('fonts/Lato-Light.ttf', 80)
+local textFont = love.graphics.newFont('fonts/Lato-Light.ttf', 50)
+local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 30)
+
+function node:render()
+  love.graphics.setColor( 0, 0, 0 )
+  love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
+
+  if self.state then
+    love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
+    love.graphics.setFont(bigFont)
+    love.graphics.printf('Currently at hackerspace:', 50, 100, love.graphics.getWidth() - 100, 'center')
+
+    usersList = (table.concat(lume.map(self.state.users, function(v) return v.login end), ', ') or 'nobody...') .. '\n'
+
+    if self.state.unknown > 0 then
+      usersList = usersList .. '\n...and ' .. tostring(self.state.unknown) .. ' unknown creatures'
+    end
+
+    if self.state.kektops > 0 then
+      usersList = usersList .. '\n...and ' .. tostring(self.state.kektops) .. ' kektops'
+    end
+
+    if self.state.esps > 0 then
+      usersList = usersList .. '\n...and ' .. tostring(self.state.esps) .. ' ESPs'
+    end
+
+    love.graphics.setColor( 1.0, 1.0, 1.0 )
+    love.graphics.setFont(textFont)
+    love.graphics.printf(usersList, 50, 220, love.graphics.getWidth() - 100, 'center')
+  else
+    love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
+
+    love.graphics.setFont(smallFont)
+    love.graphics.printf("Loading at...", 0, love.graphics.getHeight() - 200, love.graphics.getWidth(), 'center')
+  end
+end
+
+return node
diff --git a/hswaw/signage/nodes/at_thread.lua b/hswaw/signage/nodes/at_thread.lua
new file mode 100644
index 0000000..1bc782d
--- /dev/null
+++ b/hswaw/signage/nodes/at_thread.lua
@@ -0,0 +1,14 @@
+local socket = require("socket")
+local http = require("socket.http")
+local json = require("vendor.json")
+local lume = require("vendor.lume")
+
+local miseryURL = 'http://at.hackerspace.pl/api'
+
+local r, c, h = http.request(miseryURL)
+if c == 200 then
+  love.thread.getChannel('at'):push(json.decode(r))
+  print("Update finished")
+else
+  print("Update failed")
+end
diff --git a/hswaw/signage/nodes/countdown.lua b/hswaw/signage/nodes/countdown.lua
new file mode 100644
index 0000000..c5f9530
--- /dev/null
+++ b/hswaw/signage/nodes/countdown.lua
@@ -0,0 +1,55 @@
+local node = Node:extend('nodes.countdown', {
+  target = 1498780800,
+  description = 'to get the fuck out of here',
+  precision = 3,
+})
+
+local textFont = love.graphics.newFont('fonts/Lato-Thin.ttf', 100)
+local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 60)
+
+function node:init(config)
+  node.super.init(self, config)
+end
+
+function timefmt(time, precision)
+  precision = precision or 3
+
+  local p = {
+    {60, "seconds"},
+    {60, "minutes"},
+    {24, "hours"},
+    {7, "days"},
+    {nil, "weeks"},
+  }
+  local parts = {}
+  local v
+  for i, e in ipairs(p) do
+    if e[1] == nil then
+      v = time
+    else
+      v = time % e[1]
+      time = math.floor(time / e[1])
+    end
+
+    if v ~= 0 then
+      table.insert(parts, 1, tostring(v) .. " " .. e[2])
+    end
+  end
+
+  return table.concat(lume.slice(parts, 1, precision), " ")
+end
+
+function node:render()
+  love.graphics.setColor( 0, 0, 0 )
+  love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
+
+  love.graphics.setColor( 1.0, 1.0, 1.0 )
+
+  love.graphics.setFont(textFont);
+  love.graphics.printf(timefmt(math.abs(self.target - os.time()), self.precision), 0, 0.3*love.graphics.getHeight(), love.graphics.getWidth(), 'center');
+
+  love.graphics.setFont(smallFont);
+  love.graphics.printf(self.description, 0, 0.7*love.graphics.getHeight(), love.graphics.getWidth(), 'center');
+end
+
+return node
diff --git a/hswaw/signage/nodes/cube.lua b/hswaw/signage/nodes/cube.lua
new file mode 100644
index 0000000..ab9570b
--- /dev/null
+++ b/hswaw/signage/nodes/cube.lua
@@ -0,0 +1,64 @@
+local node = Node:extend('nodes.at', {
+})
+-- local papa = love.graphics.newImage("papa.png")
+local h = 25.0
+local v = {
+	{-h, -h, -h},
+	{ h, -h, -h},
+	{ h,  h, -h},
+	{-h,  h, -h},
+	{-h, -h,  h},
+	{ h, -h,  h},
+	{ h,  h,  h},
+	{-h,  h,  h}
+}
+
+local c = {
+	{0, 1, 31},
+	{1, 2, 31},
+	{2, 3, 31},
+	{3, 0, 31},
+	{0, 4, 34},
+	{1, 5, 34},
+	{2, 6, 34},
+	{3, 7, 34},
+	{4, 5, 32},
+	{5, 6,32},
+	{6, 7,32},
+	{7, 4,32}
+}
+
+local E = 100 * math.tan(2*math.pi/3)
+
+function to2d(p) return p[1] * E / (p[3]+E), p[2] * E / (p[3]+E) end
+
+function node:render()
+  love.graphics.setColor( 0, 0, 0 )
+  love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
+  love.graphics.setColor( 1.0, 1.0, 1.0 )
+  local w = love.graphics.getWidth() / 2
+  local h = love.graphics.getHeight() / 2
+  local scl = 6
+	for _, p in ipairs(c) do
+		x1, y1 = to2d(v[p[1]+1])
+		x2, y2 = to2d(v[p[2]+1])
+    love.graphics.line(x1 * scl + w, y1 * scl + h, x2 * scl + w, y2 * scl + h)
+	end
+end
+
+function node:update(dt)
+  for _, vec in ipairs(v) do
+    angle = -dt/3
+    nv0 = math.cos(angle) * vec[1] + math.sin(angle) * vec[3]
+    nv2 = -math.sin(angle) * vec[1] + math.cos(angle) * vec[3]
+    vec[1] = nv0
+    vec[3] = nv2
+    angle = dt
+    nv1 = math.cos(angle) * vec[2] - math.sin(angle) * vec[3]
+    nv2 = math.sin(angle) * vec[2] + math.cos(angle) * vec[3]
+    vec[2] = nv1
+    vec[3] = nv2
+  end
+end
+
+return node
diff --git a/hswaw/signage/nodes/currency.lua b/hswaw/signage/nodes/currency.lua
new file mode 100644
index 0000000..a0444d5
--- /dev/null
+++ b/hswaw/signage/nodes/currency.lua
@@ -0,0 +1,64 @@
+local node = ThreadNode:extend('node.currency', {
+  threadFile = 'nodes/currency_thread.lua',
+  threadChannel = 'currency',
+
+  updateInterval = 10,
+  state = {
+    values = {},
+    changes = {},
+  },
+})
+
+local inspect = require('vendor.inspect')
+
+local textFont = love.graphics.newFont('fonts/Lato-Light.ttf', 90)
+local headFont = love.graphics.newFont('fonts/Lato-Regular.ttf', 90)
+local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 30)
+
+function node:render()
+  love.graphics.setColor( 0, 0, 0 )
+  love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
+
+  if self.state.values and self.state.values[2] then
+    local pad = 20
+    love.graphics.setColor( 1.0, 1.0, 1.0 )
+    love.graphics.setFont(headFont)
+    love.graphics.printf("BTCPLN", 0, 180, love.graphics.getWidth()/2, 'right')
+    love.graphics.printf("TRYIDR", 0, 350, love.graphics.getWidth()/2, 'right')
+    love.graphics.setFont(textFont)
+    if self.state.changes[1] then
+      love.graphics.setColor( 0, 1.0, 0 )
+    else
+      love.graphics.setColor( 1.0, 0, 0 )
+    end
+    love.graphics.printf(self.state.values[1], love.graphics.getWidth()/2 + 2*pad, 180, love.graphics.getWidth()/2 - 2*pad, 'left')
+
+    if self.state.changes[2] then
+      love.graphics.setColor( 0, 1.0, 0 )
+    else
+      love.graphics.setColor( 1.0, 0, 0 )
+    end
+    love.graphics.printf(self.state.values[2], love.graphics.getWidth()/2 + 2*pad, 350, love.graphics.getWidth()/2 - 2*pad, 'left')
+  else
+    love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
+
+    love.graphics.setFont(smallFont)
+    love.graphics.printf("Loading currency...", 0, love.graphics.getHeight() - 200, love.graphics.getWidth(), 'center')
+  end
+end
+
+function node:onUpdate(v)
+  for n in ipairs(v.values) do
+    if self.state.values[n] then
+      if self.state.values[n] ~= v.values[n] then
+        self.state.changes[n] = self.state.values[n] > v.values[n]
+      end
+    else
+      self.state.changes[n] = true
+    end
+  end
+
+  self.state.values = v.values
+end
+
+return node
diff --git a/hswaw/signage/nodes/currency_thread.lua b/hswaw/signage/nodes/currency_thread.lua
new file mode 100644
index 0000000..77b98dc
--- /dev/null
+++ b/hswaw/signage/nodes/currency_thread.lua
@@ -0,0 +1,22 @@
+local socket = require("socket")
+local http = require("socket.http")
+local json = require("vendor.json")
+local lume = require("vendor.lume")
+
+local btcURL = 'http://www.bitmarket.pl/json/BTCPLN/ticker.json'
+local tryURL = 'http://api.fixer.io/latest?base=TRY'
+
+local r, c, h = http.request(btcURL)
+if c == 200 then
+  btcpln = json.decode(r)['last']
+  local r, c, h = http.request(tryURL)
+  if c == 200 then
+    tryidr = json.decode(r)['rates']['IDR']
+  end
+  love.thread.getChannel('currency'):push({
+    values = {math.floor(btcpln), math.floor(tryidr)},
+  })
+  print("Update finished")
+else
+  print("Update failed")
+end
diff --git a/hswaw/signage/nodes/misery.lua b/hswaw/signage/nodes/misery.lua
new file mode 100644
index 0000000..c20ec1a
--- /dev/null
+++ b/hswaw/signage/nodes/misery.lua
@@ -0,0 +1,34 @@
+local node = ThreadNode:extend('node.misery', {
+  threadFile = 'nodes/misery_thread.lua',
+  threadChannel = 'misery',
+
+  updateInterval = 10,
+})
+
+local inspect = require('vendor.inspect')
+
+local textFont = love.graphics.newFont('fonts/Lato-Light.ttf', 50)
+local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 30)
+
+function node:render()
+  love.graphics.setColor( 0, 0, 0 )
+  love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
+
+  if self.state then
+    love.graphics.setColor( 1.0, 1.0, 1.0 )
+    love.graphics.setFont(textFont)
+    love.graphics.printf(self.state.entry, 50, 180, love.graphics.getWidth() - 100, 'center')
+
+    love.graphics.setColor( 1.0, 1.0, 1.0, 0.8 )
+    love.graphics.setFont(smallFont)
+    local description = 'added by ' .. self.state.author .. ' on ' .. os.date('%Y/%m/%d %X', self.state.added)
+    love.graphics.printf(description, 200, love.graphics.getHeight() - 100, love.graphics.getWidth() - 400, 'center')
+  else
+    love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
+
+    love.graphics.setFont(smallFont)
+    love.graphics.printf("Loading misery...", 0, love.graphics.getHeight() - 200, love.graphics.getWidth(), 'center')
+  end
+end
+
+return node
diff --git a/hswaw/signage/nodes/misery_thread.lua b/hswaw/signage/nodes/misery_thread.lua
new file mode 100644
index 0000000..fcfc31c
--- /dev/null
+++ b/hswaw/signage/nodes/misery_thread.lua
@@ -0,0 +1,14 @@
+local socket = require("socket")
+local https = require("https")
+local json = require("vendor.json")
+local lume = require("vendor.lume")
+
+local miseryURL = 'https://oodviewer.q3k.me/randomterm.json/_,'
+
+local c, r, h = https.request(miseryURL)
+if c == 200 then
+  love.thread.getChannel('misery'):push(json.decode(r))
+  print("Update finished")
+else
+  print("Update failed: " .. tostring(c) .. ": " .. tostring(r))
+end
diff --git a/hswaw/signage/nodes/newdash.lua b/hswaw/signage/nodes/newdash.lua
new file mode 100644
index 0000000..2e0f651
--- /dev/null
+++ b/hswaw/signage/nodes/newdash.lua
@@ -0,0 +1,123 @@
+local node = ThreadNode:extend('nodes.newdash', {
+  threadFile = 'nodes/newdash_thread.lua',
+  threadChannel = 'newdash',
+
+  updateInterval = 60,
+})
+
+local weatherFont = love.graphics.newFont('fonts/weathericons-regular-webfont.ttf', 165)
+local tempFont = love.graphics.newFont('fonts/Lato-Light.ttf', 120)
+local timeFont = love.graphics.newFont('fonts/Lato-Thin.ttf', 330)
+local dateFont = love.graphics.newFont('fonts/Lato-Light.ttf', 90)
+local headerFont = love.graphics.newFont('fonts/Lato-Regular.ttf', 40)
+local valueFont = love.graphics.newFont('fonts/Lato-Light.ttf', 45)
+local atFont = love.graphics.newFont('fonts/Lato-Light.ttf', 35)
+
+local weatherGlyphs = {
+  snow = "",
+  mist = "",
+  clear = "",
+  -- clouds = "",
+  clouds = "", -- x---DDD
+  drizzle = "",
+}
+
+function node:spejsiotData(node_id, endpoint, parameter)
+  if self.state.spejsiot[node_id] and self.state.spejsiot[node_id]["$online"] and self.state.spejsiot[node_id][endpoint] and self.state.spejsiot[node_id][endpoint][parameter] ~= nil then
+    return self.state.spejsiot[node_id][endpoint][parameter]
+  else
+    return nil
+  end
+end
+
+function node:renderIOTState(node_id, endpoint, parameter, x, y)
+  local rawValue =  self:spejsiotData(node_id, endpoint, parameter)
+  if rawValue == true then
+    love.graphics.setColor( 0, 1.0, 0 )
+    love.graphics.printf("ON", x, y, 400, 'left')
+  elseif rawValue == false then
+    love.graphics.setColor( 1.0, 0, 0 )
+    love.graphics.printf("OFF", x, y, 400, 'left')
+  elseif rawValue == nil then
+    love.graphics.setColor( 1.0, 0, 0 )
+    love.graphics.printf("OFFLINE", x, y, 400, 'left')
+  else
+    love.graphics.setColor( 1.0, 1.0, 1.0 )
+    love.graphics.printf(rawValue, x, y, 400, 'left')
+  end
+end
+
+function node:render()
+  love.graphics.setColor( 0, 0, 0 )
+  love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
+
+  if self.state then
+    love.graphics.setColor( 1.0, 1.0, 1.0 )
+
+    if weatherGlyphs[self.state.weather] then
+      love.graphics.setFont(weatherFont)
+      love.graphics.print(weatherGlyphs[self.state.weather], 100, 340)
+    else
+      love.graphics.setFont(atFont)
+      love.graphics.print(self.state.weather, 100, 370)
+    end
+
+    love.graphics.setFont(tempFont)
+    love.graphics.printf(string.format("%d°", self.state.temperature), 350, 390, 270, 'center')
+
+    love.graphics.setFont(headerFont)
+    love.graphics.printf("Ambient:", 720, 380, 160, 'right')
+    love.graphics.printf("Exhaust:", 720, 440, 160, 'right')
+    love.graphics.printf("Pope:", 720, 500, 160, 'right')
+
+    love.graphics.setFont(valueFont)
+
+    if self:spejsiotData("d106e1", "environment", "degree") then
+      love.graphics.printf(string.format(
+        "%d° / %d%%RH",
+        self:spejsiotData("d106e1", "environment", "degree"),
+        self:spejsiotData("d106e1", "environment", "humidity")
+        ), 900, 378, 400, 'left')
+    else
+      love.graphics.printf("?!", 900, 378, 400, 'left')
+    end
+
+    self:renderIOTState("c0dbe7", "relay", "on", 900, 438)
+    self:renderIOTState("0eac42", "spin and blink", "on", 900, 498)
+
+    love.graphics.setColor( 1.0, 1.0, 1.0 )
+    love.graphics.setFont(headerFont)
+    love.graphics.printf("at hackerspace:", 50, 593, 300, 'left')
+    love.graphics.setFont(atFont)
+    users = {}
+    if self.state.at then
+      users = lume.map(self.state.at.users, function(v) return v.login end)
+      if self.state.at.unknown > 0 then
+        users[#users + 1] = string.format("%d unknown creatures", self.state.at.unknown)
+      end
+      if self.state.at.kektops > 0 then
+        users[#users + 1] = string.format("%d kektops", self.state.at.kektops)
+      end
+      if self.state.at.esps > 0 then
+        users[#users + 1] = string.format("%d ESPs", self.state.at.esps)
+      end
+    end
+
+    usersList = (table.concat(users, ', ') or 'nobody...')
+
+    love.graphics.printf(usersList, 350, 598, 900, 'left')
+  else
+    love.graphics.setColor(1.0, 1.0, 1.0, 0.5)
+    love.graphics.setFont(valueFont)
+    love.graphics.printf("Loading...", 0, 530, love.graphics.getWidth(), "center")
+  end
+
+  love.graphics.setColor( 1.0, 1.0, 1.0 )
+  love.graphics.setFont(timeFont)
+  love.graphics.printf(os.date("%H:%M"), 50, -10, 850, 'center')
+  love.graphics.setFont(dateFont)
+  love.graphics.printf(os.date("%Y\n%m/%d"), 960, 80, 270, 'center')
+
+end
+
+return node
diff --git a/hswaw/signage/nodes/newdash_thread.lua b/hswaw/signage/nodes/newdash_thread.lua
new file mode 100644
index 0000000..ab256e5
--- /dev/null
+++ b/hswaw/signage/nodes/newdash_thread.lua
@@ -0,0 +1,36 @@
+local socket = require("socket")
+local https = require("https")
+local json = require("vendor.json")
+
+local weatherURL = 'https://openweathermap.org/data/2.5/weather?id=6695624&units=metric&appid=439d4b804bc8187953eb36d2a8c26a02'
+local spejsiotURL = 'https://spejsiot.waw.hackerspace.pl/api/1/devices'
+local atURL = 'https://at.hackerspace.pl/api'
+local spejsiotData = {}
+local atData = nil
+
+local c, r, h = https.request(weatherURL)
+if c == 200 then
+  local data = json.decode(r)
+
+  local c, r, h = https.request(spejsiotURL)
+  if c == 200 then
+    spejsiotData = json.decode(r)
+  end
+
+  local c, r, h = https.request(atURL)
+
+  if c == 200 then
+    atData = json.decode(r)
+  end
+
+  love.thread.getChannel('newdash'):push({
+    weather = data.weather[1].main:lower(),
+    temperature = data.main.temp,
+    lastUpdate = data.dt,
+    spejsiot = spejsiotData,
+    at = atData,
+  })
+  print("Update finished")
+else
+  print("Update failed")
+end
diff --git a/hswaw/signage/nodes/screen1.lua b/hswaw/signage/nodes/screen1.lua
new file mode 100644
index 0000000..e9b1ffb
--- /dev/null
+++ b/hswaw/signage/nodes/screen1.lua
@@ -0,0 +1,16 @@
+local node = Node:extend('nodes.screen1', {})
+
+function node:render()
+  love.graphics.setColor( 0, 0, 0 )
+  love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
+
+  for x = 0, love.graphics.getWidth() / 50, 1 do
+    for y = 0, love.graphics.getHeight() / 50, 1 do
+      local r = math.sin(x +  love.timer.getTime() * 2) + math.cos(y + love.timer.getTime() * math.sin(x));
+      love.graphics.setColor(1.0, 1.0, 1.0, (r + 2) * 1.0)
+      love.graphics.circle("line", x * 50, y * 50, r * 10)
+    end
+  end
+end
+
+return node
diff --git a/hswaw/signage/nodes/shadertoy.lua b/hswaw/signage/nodes/shadertoy.lua
new file mode 100644
index 0000000..871ef12
--- /dev/null
+++ b/hswaw/signage/nodes/shadertoy.lua
@@ -0,0 +1,117 @@
+local node = Node:extend('nodes.shadertoy', {})
+
+local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 20)
+
+function node:init(config)
+  node.super.init(self, config)
+
+  self.path = self.path or "test.glsl"
+  self.resolution = self.resolution or {1280, 720}
+
+  self:loadShader()
+end
+
+function node:beforeEnter()
+  self:loadShader()
+end
+
+function node:loadShader()
+    local iSystem = {}
+    local header = ""
+    local ender=[[
+    vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords) {
+      vec2 fragCoord = texture_coords * iResolution.xy;
+      mainImage( color, fragCoord );
+      return color;
+    }
+    ]]
+    local file = io.open(self.path, "r")
+    local shaderData = file:read("*all")
+
+    shaderData = string.gsub(shaderData,"texture2D","Texel")
+    shaderData = string.gsub(shaderData,"iTime","iGlobalTime")
+    shaderData = string.gsub(shaderData,"precision highp float;","")
+
+    if string.find(shaderData,"iGlobalTime") then
+      iSystem.iGlobalTime=0
+      if not string.find(shaderData,"number iGlobalTime") then
+        header="extern number iGlobalTime;\n"..header
+      end
+    end
+
+    -- TODO
+    -- if string.find(shaderData,"iChannel") then
+    --   iSystem.iChannel={}
+    --   for k,v in pairs(shaderChannel) do
+    --     header="extern Image iChannel"..k..";\n"..header
+    --   end
+    -- end
+
+    if string.find(shaderData,"iMouse") then
+      iSystem.iMouse = {0, 0, -1, -1}
+      header = "extern vec4 iMouse;\n"..header
+    end
+
+    if string.find(shaderData,"iResolution") then
+      iSystem.iResolution = {self.resolution[1], self.resolution[2],1}
+      header = "extern vec3 iResolution;\n"..header
+    end
+
+    shaderData = header..shaderData
+    if not string.find(shaderData,"vec4 effect") then
+      shaderData = shaderData.."\n"..ender
+    end
+
+    print('Shader loaded')
+
+    self.shaderLoadError = nil
+    shaderLoaded, self.shader = pcall(love.graphics.newShader, shaderData)
+    if not shaderLoaded then
+      print('Shader load failed:', self.shader)
+      self.shaderLoadError = self.shader
+      self.shader = nil
+    else
+      print(shaderLoaded, self.shader)
+      if iSystem.iResolution then
+        self.shader:send("iResolution",iSystem.iResolution)
+      end
+
+      self.iSystem = iSystem
+      self.canvas = love.graphics.newCanvas(self.resolution[1], self.resolution[2])
+      self.renderCanvas = love.graphics.newCanvas(self.resolution[1], self.resolution[2])
+    end
+end
+
+function node:update(dt)
+  if self.shader ~= nil then
+    if self.iSystem.iGlobalTime then
+      self.iSystem.iGlobalTime=self.iSystem.iGlobalTime+dt
+      self.shader:send("iGlobalTime", self.iSystem.iGlobalTime)
+    end
+  end
+end
+
+function node:render()
+  love.graphics.setColor( 0, 0, 0 )
+  love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
+
+  if self.shaderLoadError ~= nil then
+    print('render!')
+    love.graphics.setColor(1.0, 0.0, 0.0, 1.0)
+    love.graphics.setFont(smallFont)
+    love.graphics.printf(self.shaderLoadError, 0, 0.1*love.graphics.getHeight(), love.graphics.getWidth(), 'left');
+  elseif self.shader ~= nil then
+    oldCanvas = love.graphics.getCanvas( )
+    love.graphics.setColor( 1.0, 1.0, 1.0 )
+    self.canvas:renderTo(function ()
+      love.graphics.setShader(self.shader)
+      love.graphics.draw(self.renderCanvas)
+      love.graphics.setShader()
+    end)
+    love.graphics.setCanvas(oldCanvas)
+
+    love.graphics.draw(self.canvas,0,0,math.pi,love.graphics.getWidth() / self.resolution[1], love.graphics.getHeight() / self.resolution[2], self.resolution[1], self.resolution[2])
+  end
+end
+
+return node
diff --git a/hswaw/signage/nodes/time.lua b/hswaw/signage/nodes/time.lua
new file mode 100644
index 0000000..48b5110
--- /dev/null
+++ b/hswaw/signage/nodes/time.lua
@@ -0,0 +1,25 @@
+local node = Node:extend('nodes.time', {})
+
+local textFont = love.graphics.newFont('fonts/Lato-Thin.ttf', 400)
+local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 60)
+
+function node:init(config)
+  node.super.init(self, config)
+  self.timeFormat = self.timeFormat or '%H:%M'
+  self.dateFormat = self.dateFormat or '%Y/%m/%d'  
+end
+
+function node:render()
+  love.graphics.setColor( 0, 0, 0 )
+  love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
+
+  love.graphics.setColor( 1.0, 1.0, 1.0 )
+
+  love.graphics.setFont(textFont);
+  love.graphics.printf(os.date(self.timeFormat), 0, 0.14*love.graphics.getHeight(), love.graphics.getWidth(), 'center');
+
+  love.graphics.setFont(smallFont);
+  love.graphics.printf(os.date(self.dateFormat), 0, 0.8*love.graphics.getHeight(), love.graphics.getWidth(), 'center');
+end
+
+return node
diff --git a/hswaw/signage/nodes/weather.lua b/hswaw/signage/nodes/weather.lua
new file mode 100644
index 0000000..b29b96e
--- /dev/null
+++ b/hswaw/signage/nodes/weather.lua
@@ -0,0 +1,88 @@
+local node = ThreadNode:extend('nodes.weather', {
+  threadFile = 'nodes/weather_thread.lua',
+  threadChannel = 'weather',
+
+  updateInterval = 5 * 60,
+})
+
+local weatherFont = love.graphics.newFont('fonts/weathericons-regular-webfont.ttf', 400)
+local textFont = love.graphics.newFont('fonts/Lato-Thin.ttf', 300)
+local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 30)
+
+local weatherGlyphs = {}
+
+local weatherGlyphsSet = {
+  day = {
+    snow = "",
+    mist = "",
+    clear = "",
+    -- clouds = "",
+    clouds = "", -- x---DDD
+    drizzle = "",
+  },
+  night = {
+    snow = "",
+    mist = "",
+    clear = "",
+    clouds = "",
+    drizzle = "",
+    
+  }
+}
+
+function node:timeOfDay()
+  local sunRise = tonumber(os.date("%H%M", self.state.sunRise)) 
+  local sunSet = tonumber(os.date("%H%M", self.state.sunSet))
+  local now = tonumber(os.date("%H%M"))
+  if sunRise == nil or sunSet == nil then
+    return weatherGlyphsSet["day"] -- smth gone wrong. assume daylight
+  end
+  if now < sunSet and now > sunRise then
+     print('day')
+     return weatherGlyphsSet["day"]
+  else
+     print('night')
+     return weatherGlyphsSet["night"]
+  end
+end
+
+function node:beforeEnter()
+  if self.state then
+    weatherGlyphs = self:timeOfDay()
+  else
+    weatherGlyphs = weatherGlyphsSet["day"] -- do not know sunraise and sunset yet. assume daylight
+  end
+end
+
+function node:render()
+  love.graphics.setColor( 0, 0, 0 )
+  love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
+
+  if self.state then
+    love.graphics.setColor( 1.0, 1.0, 1.0 )
+
+    if weatherGlyphs[self.state.weather] then
+      love.graphics.setFont(weatherFont)
+      love.graphics.print(weatherGlyphs[self.state.weather], 120, 35)
+    else
+      love.graphics.setFont(smallFont)
+      love.graphics.print(self.state.weather, 150, love.graphics.getHeight()/2 - 60)
+    end
+
+    love.graphics.setFont(textFont)
+    love.graphics.printf(tostring(math.floor(self.state.temperature + 0.5)) .. "°", 600, 150, 650, 'center')
+
+    love.graphics.setFont(smallFont)
+    love.graphics.printf(os.date("Last update: %Y/%m/%d %H:%M", self.state.lastUpdate), 0, love.graphics.getHeight() - 60, love.graphics.getWidth(), 'center')
+    if self.state.insideTemperature then
+      love.graphics.printf("Room: " .. tostring(self.state.insideTemperature) .. "° / " .. tostring(self.state.insideHumidity) .. "%RH", 0, love.graphics.getHeight() - 100, love.graphics.getWidth(), 'center')
+    end
+  else
+    love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
+
+    love.graphics.setFont(smallFont)
+    love.graphics.printf("Loading weather...", 0, love.graphics.getHeight() - 200, love.graphics.getWidth(), 'center')
+  end
+end
+
+return node
diff --git a/hswaw/signage/nodes/weather_thread.lua b/hswaw/signage/nodes/weather_thread.lua
new file mode 100644
index 0000000..5585e15
--- /dev/null
+++ b/hswaw/signage/nodes/weather_thread.lua
@@ -0,0 +1,32 @@
+local socket = require("socket")
+local https = require("https")
+local json = require("vendor.json")
+
+local weatherURL = 'https://openweathermap.org/data/2.5/weather?id=6695624&units=metric&appid=439d4b804bc8187953eb36d2a8c26a02'
+--local insideURL = 'https://dht01.waw.hackerspace.pl/'
+--local insideData = {}
+
+local c, r, h = https.request(weatherURL)
+if c == 200 then
+  local data = json.decode(r)
+
+  --local r, c, h = http.request(insideURL)
+  --if c == 200 then
+  --  for n in string.gmatch(string.gsub(r, ",", "."), ":%s*(%S+)[*%%]") do
+  --    insideData[#insideData+1] = n
+  --  end
+  --end
+
+  love.thread.getChannel('weather'):push({
+    weather = data.weather[1].main:lower(),
+    temperature = data.main.temp,
+    lastUpdate = data.dt,
+    sunRise = data.sys.sunrise,
+    sunSet = data.sys.sunset,
+    insideTemperature = nil,
+    insideHumidity = nil,
+  })
+  print("Update finished")
+else
+  print("Update failed")
+end