Skip to content

Commit

Permalink
Merge pull request #146 from OpenSprinkler/support/https
Browse files Browse the repository at this point in the history
Add support for HTTPS remote stations and MQTT support
  • Loading branch information
salbahra authored Jul 25, 2024
2 parents 8db2a27 + afc513a commit c5db91b
Show file tree
Hide file tree
Showing 39 changed files with 1,590 additions and 638 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
pushEng: {
command: [
"xgettext --keyword=_ --output=- www/js/main.js www/js/analog.js --omit-header --force-po --from-code=UTF-8 --language='Python' | sed '/^\#/d' > .msgjs",
"sed -E 's/data-translate=(\".*\")/_(\\1)/g' www/index.html | xgettext --keyword=_ --output=- --language='Python' --omit-header --force-po - | sed '/^\#/d' > .msghtml",
"sed -E 's/data-translate=\"([^\"]*)\"/_\(\"\\1\"\)/g' www/index.html > temp.html && xgettext --keyword=_ --output=- --language='Python' --omit-header --force-po temp.html | sed '/^#/d' > .msghtml && rm temp.html",
"msgcat .msgjs .msghtml > www/locale/messages_en.po",
"rm .msgjs .msghtml",
"tx push",
Expand Down
4 changes: 2 additions & 2 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="112" id="com.albahra.sprinklers" version="2.4.0" versionCode="113" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="113" id="com.albahra.sprinklers" version="2.4.1" versionCode="114" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>OpenSprinkler</name>
<description>
Designed to allow intuitive control of the OpenSprinkler irrigation controller.
Expand Down Expand Up @@ -42,7 +42,7 @@
<string>Your camera is used to provide an image for your stations.</string>
</config-file>
<config-file target="*-Info.plist" overwrite="true" parent="CFBundleShortVersionString">
<string>19905</string>
<string>19906</string>
</config-file>
<config-file target="*-Info.plist" overwrite="true" parent="LSApplicationCategoryType">
<string>public.app-category.utilities</string>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"phonegap": {
"id": "1371093"
},
"version": "2.4.0",
"version": "2.4.1",
"description": "Designed to allow intuitive control of the OpenSprinkler irrigation controller.",
"main": "index.html",
"scripts": {
Expand Down
9 changes: 9 additions & 0 deletions www/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,15 @@ input[type=number] {
vertical-align: middle
}

.edit-loc {
display: inline-block;
padding: 0;
margin: 0;
right: 30px;
position: absolute;
top: 3px;
}

.clear-loc {
display: inline-block;
padding: 0;
Expand Down
57 changes: 30 additions & 27 deletions www/js/analog.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

var analogSensors = {},
progAdjusts = {};
const CHARTS = 11;
const USERDEF_SENSOR = 49;
const USERDEF_UNIT = 99;
var CHARTS = 11;
var USERDEF_SENSOR = 49;
var USERDEF_UNIT = 99;

function checkAnalogSensorAvail() {
return controller.options && controller.options.feature === "ASB";
Expand Down Expand Up @@ -70,7 +70,7 @@ function updateSensorShowArea( page ) {
var sensor = analogSensors[ i ];
if ( sensor.show ) {
html += "<div id='sensor-show-" + sensor.nr + "' class='ui-body ui-body-a center'>";
html += "<label>" + sensor.name + ": " ( +( Math.round( sensor.data + "e+2" ) + "e-2" ) ) + sensor.unit + "</label>";
html += "<label>" + sensor.name + ": " + ( Number( Math.round( sensor.data + "e+2" ) + "e-2" ) ) + sensor.unit + "</label>";
html += "</div>";
}
}
Expand Down Expand Up @@ -333,8 +333,8 @@ function showSensorEditor( sensor, callback ) {
"</label>" +
"<input class='id' type='number' min='0' max='65535' value='" + sensor.id + "'>" +

((sensor.type === USERDEF_SENSOR) ?
("<label>" +
( ( sensor.type === USERDEF_SENSOR ) ?
( "<label>" +
_( "Factor" ) +
"</label>" +
"<input class='fac' type='number' min='-32768' max='32767' value='" + sensor.fac + "'>" +
Expand All @@ -348,7 +348,7 @@ function showSensorEditor( sensor, callback ) {
_( "Unit" ) +
"</label>" +
"<input class='unit' type='text' value='" + sensor.unit + "'>"
):"") +
) : "" ) +

"<label>" +
_( "Read Interval (s)" ) +
Expand Down Expand Up @@ -521,11 +521,11 @@ var showAnalogSensorConfig = ( function() {
"&port=" + sensorOut.port +
"&id=" + sensorOut.id +
"&ri=" + sensorOut.ri +
((sensorOut.type === USERDEF_SENSOR) ?
("&fac="+sensorOut.fac +
"&div="+sensorOut.div +
"&unit="+sensorOut.unit
):"") +
( ( sensorOut.type === USERDEF_SENSOR ) ?
( "&fac=" + sensorOut.fac +
"&div=" + sensorOut.div +
"&unit=" + sensorOut.unit
) : "" ) +
"&enable=" + sensorOut.enable +
"&log=" + sensorOut.log +
"&show=" + sensorOut.show
Expand Down Expand Up @@ -555,11 +555,11 @@ var showAnalogSensorConfig = ( function() {
"&port=" + sensorOut.port +
"&id=" + sensorOut.id +
"&ri=" + sensorOut.ri +
((sensorOut.type === USERDEF_SENSOR) ?
("&fac="+sensorOut.fac +
"&div="+sensorOut.div +
"&unit="+sensorOut.unit
):"") +
( ( sensorOut.type === USERDEF_SENSOR ) ?
( "&fac=" + sensorOut.fac +
"&div=" + sensorOut.div +
"&unit=" + sensorOut.unit
) : "" ) +
"&enable=" + sensorOut.enable +
"&log=" + sensorOut.log +
"&show=" + sensorOut.show
Expand Down Expand Up @@ -789,17 +789,20 @@ var showAnalogSensorCharts = ( function() {

var max = CHARTS;
for ( var j = 0; j < analogSensors.length; j++ ) {
if (!analogSensors[j].log)
if ( !analogSensors[ j ].log ) {
continue;
var unitid = analogSensors[j].unitid;
if (unitid === USERDEF_UNIT) max++;
}
var unitid = analogSensors[ j ].unitid;
if ( unitid === USERDEF_UNIT ) {
max++;
}
}

var last = "", week = "", month = "";
for ( var j = 1; j <= max; j++ ) {
last += "<div id='myChart"+j+"'></div>";
week += "<div id='myChartW"+j+"'></div>";
month += "<div id='myChartM"+j+"'></div>";
for ( j = 1; j <= max; j++ ) {
last += "<div id='myChart" + j + "'></div>";
week += "<div id='myChartW" + j + "'></div>";
month += "<div id='myChartM" + j + "'></div>";
}

var page = $( "<div data-role='page' id='analogsensorchart'>" +
Expand Down Expand Up @@ -869,10 +872,10 @@ function buildGraph( prefix, chart, csv, titleAdd, timestr ) {
var series = { name: analogSensors[ j ].name, data: logdata };

// User defined sensor:
if (unitid === USERDEF_UNIT) {
if ( unitid === USERDEF_UNIT ) {
unitid = chart.length;
chart.push(undefined);
} else if (unitid >= CHARTS) {
chart.push( undefined );
} else if ( unitid >= CHARTS ) {
unitid = 0;
}

Expand Down
4 changes: 3 additions & 1 deletion www/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@

// Insert jQuery
insertScript( assetLocation + "js/jquery.js", function() {

// Insert libraries
insertScript( assetLocation + "js/libs.js", function() {

// Insert primary application script
insertScript( assetLocation + "js/main.js", function() {
try {
Expand All @@ -153,7 +155,7 @@

// Insert charting library for analog support
insertScript( assetLocation + "js/apexcharts.min.js" );
} )
} );
} );

// Insert home page icon for iOS
Expand Down
Loading

0 comments on commit c5db91b

Please sign in to comment.