Skip to content

Commit

Permalink
Final Update for 2.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeakes committed Apr 22, 2024
1 parent 6768ca5 commit 9d580cb
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 20 deletions.
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ https://github.com/sfeakes/AqualinkD/wiki/Jandy-Aqualink-RS485-protocol
</td></tr>
</table>

### Simulator
Designed to mimic AqualinkRS6 All Button keypad and (like the keypad) is used to fully configure the master control panel<br>
<img src="extras/simulator.png?raw=true" width="550">
### Simulators
Designed to mimic AqualinkRS devices, used to fully configure the master control panel<br>
<img src="extras/onetouch_sim.png?raw=true">
<img src="extras/allbutton_sim.png?raw=true">

### In Apple Home app.
<img src="extras/HomeKit2.png?raw=true" width="800"></img>
Expand All @@ -71,13 +72,26 @@ Designed to mimic AqualinkRS6 All Button keypad and (like the keypad) is used to
## All Web interfaces.
* http://aqualink.ip/ <- (Standard WEB UI
* http://aqualink.ip/simple.html <- (Simple opion if you don't like the above)
* http://aqualink.ip/simulator.html <- (RS8 All Button Control Panel simulator)
* http://aqualink.ip/debug.html <- (Turn on/off debug/serial debug & download logs)
* http://aqualink.ip/simulator.html <- (Displays all simulators in one page with tabs)
* http://aqualink.ip/aqmanager.html <- (Manage AqualinkD configuration & runtime)
* http://aqualink.ip/allbutton_sim.html <- (All Button Simulator)
* http://aqualink.ip/onetouch_sim.html <- (One Touch Simulator)
* http://aqualink.ip/aquapda_sim.html <- (PDA simulator)
#<a name="release"></a>
# ToDo (future release)
* Allow selecting of pre-defined VSP programs (Aqualink Touch & OneTouch protocols.)
* Add set time to OneTouch protocol.
* Publish AqualinkD Management console. (Configure, Restart, run serial_logger) within AqualinkD.
* Update AqualinkD Management console to manage configuration
* Create iAqualink Touch Simulator

# Update in Release 2.3.4
* Changes for Docker
* Updated simulator code base and added new simulators for AllButton, OneTouch & PDA.
* <aqualinkd.ip>/allbutton_sim.html
* <aqualinkd.ip>/onetouch_sim.html
* <aqualinkd.ip>/aquapda_sim.html
* On PDA only panel AqualinkD has to share the same ID with the PDA simulator. There for AqualinkD will not respond to commands while simulator is active.
* Now you can completley program the control panel with the simulators removing the need to have Jandy device.

# Update in Release 2.3.3
* Introduced Aqualink Manager UI http://aqualink.ip/aqmanager.html
Expand Down
8 changes: 6 additions & 2 deletions aqualinkd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1879,8 +1879,12 @@ void main_loop()
_aqualink_data.updated = process_packet(packet_buffer, packet_length);

#ifdef AQ_PDA
if (isPDA_PANEL)
caculate_ack_packet(rs_fd, packet_buffer, AQUAPDA);
if (isPDA_PANEL) {
// If we are in simulator mode, the sim has already send the ack
if (_aqualink_data.simulator_active == SIM_NONE) {
caculate_ack_packet(rs_fd, packet_buffer, AQUAPDA);
}
}
else
#endif
caculate_ack_packet(rs_fd, packet_buffer, ALLBUTTON);
Expand Down
Binary file added extras/allbutton_sim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extras/onetouch_sim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified release/aqualinkd
Binary file not shown.
9 changes: 5 additions & 4 deletions release/aqualinkd.test.pda.conf
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,12 @@ device_id=0x60
#extended_device_id_programming = no

# Not documented
serial_readahead_b4_write = yes
mqtt_timed_update = no
thread_netservices = yes
rs_poll_speed = -1
#serial_readahead_b4_write = yes
#mqtt_timed_update = no
#thread_netservices = yes
#rs_poll_speed = -1
#rs_poll_speed = 1
rs485_frame_delay = 4

# Your RS panel size. ie 4, 6, 8, 12 or 16 relates to RS4, RS6, RS8, RS12 or RS16.
# VERY important that you select 12 or 16, if you have either of those size panels.
Expand Down
7 changes: 7 additions & 0 deletions simulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ bool processSimulatorPacket(unsigned char *packet, int packet_length, struct aqu

bool start_simulator(struct aqualinkdata *aqdata, emulation_type type) {

// If we are a PDA panel and PDA sim, we are connected, so just set that
// since PDA only panel can only handle one remote ID.
if (isPDA_PANEL && type == AQUAPDA) {
aqdata->simulator_active = type;
aqdata->simulator_id = _aqconfig_.device_id;
}

// if type is same AND id is valid, sim is already started, their is nothing to do.
if (aqdata->simulator_active == type) {
if (aqdata->simulator_id >= 0x40 && aqdata->simulator_id <= 0x43) {
Expand Down
35 changes: 29 additions & 6 deletions web/aquapda_sim.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@
flex-direction: column;
}

.inner {
display: inline;
}

.wrapper {
display: flex;
justify-content: center;
width: 100%;
align-items: center;
/*position: absolute;
justify-content: center;
width: 100%;
Expand Down Expand Up @@ -131,6 +136,14 @@
/*font-family: monospace;*/
font-size: x-small;
}

.hide {
display: none;
/*
filter: alpha(opacity=0);
opacity: 0.0;
*/
}
</style>

<script type='text/javascript'>
Expand All @@ -157,6 +170,8 @@
var _hlightcharstart = -1;
var _hlightcharend = -1;

var _initial_click=false;

// See if we are in an iframe and capture focus
function capture_iframe_focus() {
var targetNode = parent.document.getElementById('aquapda_iframe');
Expand Down Expand Up @@ -417,12 +432,18 @@
}
}


function update_status(data) {
// Some form of error if PDA only panel.

if (data.panel_type.startsWith("PDA")) {
//document.getElementById("status").innerHTML = ' !!! PDA only panels are not Supported !!! '
//document.getElementById("status").classList.add("error");
update_status_message("PDA only panels are not Supported", true);
// If we are a PDA only panel, we are already connected, send the back command to get some PDA clar
// message to reset the screen.
if (_initial_click == false) {
document.getElementById("pdaWarning").style.display = 'block';
document.getElementById("Back").click();
_initial_click = true;
}
}

const versionlabel = document.getElementById("version");
Expand Down Expand Up @@ -541,7 +562,7 @@
<div class="wrapper">

<div class="inner">

<div>
<table border='0' id="deviceList">
<tr>
<th id="status" align="center" colspan="5">&nbsp;</th>
Expand Down Expand Up @@ -652,9 +673,11 @@
<td colspan="5" id="version" class="version">&nbsp;</td>
</tr>
</table>

</div>
<!--<div class="inner">END</div>-->

<div id="pdaWarning" class='hide'>
Warning<br>AqualinkD will not respond to commands while this window is open,<br>Please close when finished.
</div>
</div>

</div>
Expand Down
67 changes: 67 additions & 0 deletions web/controller.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,27 @@
/*flex-direction: column;*/
}

.simulator_pane {
background-color: var(--options_pane_background);
border: 2px solid var(--options_pane_bordercolor);
border-radius: 20px;
justify-content: center;
align-items: center;
/* Actual size of sim 305 by 385 */
width: 325px;
height: 405px;
padding: 10px;
/*overflow-y: scroll; didn't work*/
/*height: 100%;*/
/*flex-basis: content;*/
/*flex-direction: column;*/
}

.simiframe {
width: 305px;
height: 385px;
}

.options {
top: 10px;
/*left: 10px;*/
Expand Down Expand Up @@ -609,6 +630,8 @@
document.getElementById('vspswitch_options').classList.remove("hide");
document.getElementById('timer_options').classList.remove("hide");
document.getElementById('scheduler_options').classList.remove("hide");
//document.getElementById('simulator_options').classList.remove("hide");
document.getElementById('simulator_iframe').classList.remove("hide");
setColors();
load_background();
showTileOptions(false);
Expand Down Expand Up @@ -1233,48 +1256,63 @@
document.getElementById('vspswitch_options').style.display = 'none';
document.getElementById('timer_options').style.display = 'none';
document.getElementById('scheduler_options').style.display = 'none';
document.getElementById('simulator_iframe').style.display = 'none';
} else if (id != null && document.getElementById(id).getAttribute('type') == 'switch_program') {
active_option = document.getElementById('pswitch_options');
document.getElementById('thermostat_options').style.display = 'none';
document.getElementById('swg_options').style.display = 'none';
document.getElementById('vspswitch_options').style.display = 'none';
document.getElementById('timer_options').style.display = 'none';
document.getElementById('scheduler_options').style.display = 'none';
document.getElementById('simulator_iframe').style.display = 'none';
} else if (id != null && document.getElementById(id).getAttribute('type') == 'setpoint_swg') {
active_option = document.getElementById('swg_options');
document.getElementById('thermostat_options').style.display = 'none';
document.getElementById('pswitch_options').style.display = 'none';
document.getElementById('vspswitch_options').style.display = 'none';
document.getElementById('timer_options').style.display = 'none';
document.getElementById('scheduler_options').style.display = 'none';
document.getElementById('simulator_iframe').style.display = 'none';
} else if (id != null && document.getElementById(id).getAttribute('type') == 'setpoint_freeze') {
active_option = document.getElementById('swg_options');
document.getElementById('thermostat_options').style.display = 'none';
document.getElementById('pswitch_options').style.display = 'none';
document.getElementById('vspswitch_options').style.display = 'none';
document.getElementById('timer_options').style.display = 'none';
document.getElementById('scheduler_options').style.display = 'none';
document.getElementById('simulator_iframe').style.display = 'none';
} else if (id != null && document.getElementById(id).getAttribute('type') == 'switch_vsp') {
active_option = document.getElementById('vspswitch_options');
document.getElementById('thermostat_options').style.display = 'none';
document.getElementById('pswitch_options').style.display = 'none';
document.getElementById('swg_options').style.display = 'none';
document.getElementById('timer_options').style.display = 'none';
document.getElementById('scheduler_options').style.display = 'none';
document.getElementById('simulator_iframe').style.display = 'none';
} else if (id != null && document.getElementById(id).getAttribute('type') == 'switch_timer') {
active_option = document.getElementById('timer_options');
document.getElementById('thermostat_options').style.display = 'none';
document.getElementById('pswitch_options').style.display = 'none';
document.getElementById('swg_options').style.display = 'none';
document.getElementById('vspswitch_options').style.display = 'none';
document.getElementById('scheduler_options').style.display = 'none';
document.getElementById('simulator_iframe').style.display = 'none';
} else if (id != null && document.getElementById(id).getAttribute('type') == 'scheduler') {
active_option = document.getElementById('scheduler_options');
document.getElementById('thermostat_options').style.display = 'none';
document.getElementById('pswitch_options').style.display = 'none';
document.getElementById('swg_options').style.display = 'none';
document.getElementById('vspswitch_options').style.display = 'none';
document.getElementById('timer_options').style.display = 'none';
document.getElementById('simulator_iframe').style.display = 'none';
} else if (id != null && document.getElementById(id).getAttribute('type') == 'simulator') {
active_option = document.getElementById('simulator_iframe');
document.getElementById('thermostat_options').style.display = 'none';
document.getElementById('pswitch_options').style.display = 'none';
document.getElementById('swg_options').style.display = 'none';
document.getElementById('vspswitch_options').style.display = 'none';
document.getElementById('timer_options').style.display = 'none';
document.getElementById('scheduler_options').style.display = 'none';
}

active_option.style.display = 'flex';
Expand Down Expand Up @@ -1310,6 +1348,7 @@
document.getElementById('vspswitch_options').style.display = 'none';
document.getElementById('timer_options').style.display = 'none';
document.getElementById('scheduler_options').style.display = 'none';
document.getElementById('simulator_iframe').style.display = 'none';
document.getElementById('wrapper').classList.remove("opaque");
return;
}
Expand Down Expand Up @@ -1363,6 +1402,8 @@
} else if (type == 'scheduler') {
title = document.getElementById("scheduler_options_title");
close_button = document.getElementById("scheduler_options_close");
} else if (type == 'simulator') {
close_button = document.getElementById("simulator_iframe_close");
} else {
slider = document.getElementById("option_slider_range");
slider_output = document.getElementById("option_slider_text_value");
Expand Down Expand Up @@ -1415,6 +1456,8 @@

if (type == 'scheduler') {
title.innerHTML = "Scheduler";
} else if (type == 'simulator') {
// title.innerHTML = "Simulator";
} else {
title.innerHTML = document.getElementById(id + '_name').innerHTML;
}
Expand Down Expand Up @@ -1480,6 +1523,8 @@
cs_clearSchedules();
//cs_loadJSON("/api/schedules", cs_schedules,'jsonp');
get_schedules();
} else if (type == 'simulator') {
startSimulator();
} else {
slider.value = sp_value;
oswitch = document.getElementById("option_switch");
Expand Down Expand Up @@ -1597,6 +1642,7 @@
if ( ! cs_createJSON() ) {
return // This stops pane from closing.
}
} else if (type == 'simulator') {
} else {
var value = slider.value;
if (state == (tile.getAttribute('status') == 'off'))
Expand Down Expand Up @@ -1673,6 +1719,16 @@
}
}

function showSimulator(caller){
caller.setAttribute('type', 'simulator');
showTileOptions(true, caller.id);
}

function startSimulator() {
console.log("Starting ifram sim init");
document.getElementById('onetouch_iframe').display = 'block';
}

// NSF CHANGE TO USING WS FOR THIS REQUEST
/*
function cs_loadJSON(path, success, error) {
Expand Down Expand Up @@ -2418,6 +2474,7 @@
<!-- <div id='body_wrap' class='body_wrap' onmousedown='showTileOptions(false);'> -->
<div id='wrapper' class="wrapper">
<div id="header" class="head" onclick="showBackground();">
<!--<div id="header" class="head" onclick="event.stopPropagation();showSimulator(this);">-->
<table border='0' width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td width="70px" align='left' id='td_name'><span class='title' id='name'
Expand Down Expand Up @@ -2650,6 +2707,14 @@
</div>


<div id="simulator_iframe" class='options hide'>
<div id="onetouch_iframe" class="simulator_pane" onclick='event.stopPropagation();''>
<iframe id="simulatoriframe" src="/onetouch_sim.html" class="simiframe"></iframe>
<input type="button" class="options_button" id="simulator_iframe_close" value="Close">
</div>

</div>

<div id='scheduler_options' class='options hide'>
<div id='scheduler_options_pane' class='scheduler_pane' onclick='event.stopPropagation();'>
<table id="cronschedules" border="0">
Expand Down Expand Up @@ -2684,6 +2749,8 @@
</div>
</div>



</div>

</body>
Expand Down
Loading

0 comments on commit 9d580cb

Please sign in to comment.