diff --git a/app/client/state.js b/app/client/state.js index ed7e21a..1e0bbca 100644 --- a/app/client/state.js +++ b/app/client/state.js @@ -44,11 +44,16 @@ Template.state.helpers({ bucket_image: function() { var sensor = last_sensor_reading(); - if (sensor && sensor.tankFull === "1") { - return "/images/barell_full.png"; - } else { - return "/images/barell_draining.png"; + var stateObject = controller_state(); + if (sensor) { + if (sensor.tankFull === 1 && (stateObject.state.out_valve === 'closed' || stateObject.state.out_valve === 'opening')) return "/images/barellFull.png"; + else if (sensor.tankFull === 0 && (stateObject.state.out_valve === 'closed' || stateObject.state.out_valve === 'opening')) return "/images/barellNotFull.png"; + else if (sensor.tankFull === 1 && (stateObject.state.out_valve === 'open' || stateObject.state.out_valve === 'closing')) return "/images/barellWateringFull.png"; + else if (sensor.tankFull === 0 && (stateObject.state.out_valve === 'open' || stateObject.state.out_valve === 'closing')) return "/images/barellWateringNotFull.png" + else if (sensor.tankFull === 0 && stateObject.state.in_valve === 'open') return "/images/barellFillingUp.png"; + else return "/images/statusAmber.png"; } + else return "/images/statusRed.png"; }, last_sensor_reading: last_sensor_reading, diff --git a/app/public/images/barellFillingUp.png b/app/public/images/barellFillingUp.png new file mode 100644 index 0000000..6cae5ed Binary files /dev/null and b/app/public/images/barellFillingUp.png differ diff --git a/app/public/images/barellFull.png b/app/public/images/barellFull.png new file mode 100644 index 0000000..7a8d025 Binary files /dev/null and b/app/public/images/barellFull.png differ diff --git a/app/public/images/barellNotFull.png b/app/public/images/barellNotFull.png new file mode 100644 index 0000000..d0e461d Binary files /dev/null and b/app/public/images/barellNotFull.png differ diff --git a/app/public/images/barellWateringFull.png b/app/public/images/barellWateringFull.png new file mode 100644 index 0000000..5a7c816 Binary files /dev/null and b/app/public/images/barellWateringFull.png differ diff --git a/app/public/images/barellWateringNotFull.png b/app/public/images/barellWateringNotFull.png new file mode 100644 index 0000000..2007fc3 Binary files /dev/null and b/app/public/images/barellWateringNotFull.png differ diff --git a/app/public/images/barell_draining.png b/app/public/images/barell_draining.png deleted file mode 100644 index f1efa87..0000000 Binary files a/app/public/images/barell_draining.png and /dev/null differ diff --git a/app/public/images/barell_full.png b/app/public/images/barell_full.png deleted file mode 100644 index a78c0d4..0000000 Binary files a/app/public/images/barell_full.png and /dev/null differ diff --git a/app/public/images/statusAmber.png b/app/public/images/statusAmber.png new file mode 100644 index 0000000..f87cf0a Binary files /dev/null and b/app/public/images/statusAmber.png differ diff --git a/app/public/images/statusBlue.png b/app/public/images/statusBlue.png new file mode 100644 index 0000000..77c5605 Binary files /dev/null and b/app/public/images/statusBlue.png differ diff --git a/app/public/images/statusGreen.png b/app/public/images/statusGreen.png new file mode 100644 index 0000000..a1593d1 Binary files /dev/null and b/app/public/images/statusGreen.png differ diff --git a/app/public/images/statusRed.png b/app/public/images/statusRed.png new file mode 100644 index 0000000..b83bf4a Binary files /dev/null and b/app/public/images/statusRed.png differ