Added proper barrel image handling based on input / sensor readings #10

Merged
senaduka merged 1 commits from barrel_image_handling into master 2016-03-13 19:00:54 +01:00
12 changed files with 9 additions and 4 deletions

View File

@@ -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,

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB