diff --git a/Makefile b/Makefile index 7e114d0..85445c4 100755 --- a/Makefile +++ b/Makefile @@ -213,6 +213,11 @@ SLOG_AMD64 = ./release/serial_logger-amd64 # Before the below works, you need to build the aqualinkd-releasebin docker for compiling. # sudo docker build -f Dockerfile.releaseBinaries -t aqualinkd-releasebin . +# Something like below +#releasebuilddocker: +# sudo docker build -f ./docker/Dockerfile.releaseBinaries -t aqualinkd-releasebin . +# $(info Docker for building release binaries has been created) + release: sudo docker run -it --mount type=bind,source=./,target=/build aqualinkd-releasebin make buildrelease $(info Binaries for release have been built) diff --git a/README.md b/README.md index 00adf83..afcdaf3 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,8 @@ Designed to mimic AqualinkRS devices, used to fully configure the master control * Decoded more Pentair VSP pump status. * Changed VSP pump status handling (display more in web UI) * VSP Pump status & other attributes in HASSIO +* Dual temperature sensors supported +* Updated to serial_logger # Updates in Release 2.3.7 * Fix for Pentair VSP losing connection & bouncing SWG to 0 and back. diff --git a/docker/Dockerfile.releaseBinaries b/docker/Dockerfile.releaseBinaries new file mode 100755 index 0000000..3b9f5f8 --- /dev/null +++ b/docker/Dockerfile.releaseBinaries @@ -0,0 +1,269 @@ + +##################################### +# +# Build container to compile AqualnkD Release binaries (armhf and arm64) +# +# armhf is 32 bit armv6l (armhf) stretch and newer - work on all Pi's running 32bit (Pi1 to Pi4) +# arm64 is 64 bit aarch64 buster and newer - work on Pi3/Pi4/2w running 64bit os +# +# docker build -f Dockerfile.releaseBinaries -t aqualinkd-releasebin . +# docker run -it --mount type=bind,source=./build,target=/build aqualinkd-releasebin bash +# +# clean method +# docker system prune +# +##################################### + +FROM debian:buster + +# ############ +# Get arm64 build environment. +# + +RUN apt-get update && \ + apt-get install -y \ + build-essential \ + gcc-aarch64-linux-gnu \ + binutils-arm-linux-gnueabi \ + file + +RUN dpkg --add-architecture arm64 +RUN apt-get update && \ + apt-get install -y libsystemd-dev:arm64 + +# ############ +# Get armhf build environment +# prebuilt armhf doesn't support hard float, (or something that causes it to fail on armhf machines) +#RUN apt-get install -y \ +# gcc-arm-linux-gnueabihf \ +# binutils-arm-linux-gnueabihf + +#RUN dpkg --add-architecture armhf +#RUN apt-get update && \ +# apt-get install -y libsystemd-dev:armhf + +# So we need to build arnhf our selves. Since we are doing that, using debian/rasbian stretch versions of +# everthing for best compatibality + +ENV GCC_VERSION gcc-6.3.0 +ENV GLIBC_VERSION glibc-2.24 +ENV BINUTILS_VERSION binutils-2.28 +ARG DEBIAN_FRONTEND=noninteractive + +# Install some tools and compilers + clean up +RUN apt-get update && \ + #apt-get install -y rsync git wget gcc-6 g++-6 cmake gdb gdbserver bzip2 && \ + apt-get install -y rsync git wget cmake gdb gdbserver bzip2 && \ + apt-get clean autoclean && \ + apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* + + +# Use GCC 6 as the default +#RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 999 \ +# && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 999 \ +# && update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-6 999 \ +# && update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-6 999 + +# Add a user called `develop` +RUN useradd -ms /bin/bash develop +RUN echo "develop ALL=(ALL:ALL) ALL" >> /etc/sudoers + +WORKDIR /home/develop + +# Download and extract GCC +RUN wget https://ftp.gnu.org/gnu/gcc/${GCC_VERSION}/${GCC_VERSION}.tar.gz && \ + tar xf ${GCC_VERSION}.tar.gz && \ + rm ${GCC_VERSION}.tar.gz +# Download and extract LibC +RUN wget https://ftp.gnu.org/gnu/libc/${GLIBC_VERSION}.tar.bz2 && \ + tar xjf ${GLIBC_VERSION}.tar.bz2 && \ + rm ${GLIBC_VERSION}.tar.bz2 +# Download and extract BinUtils +RUN wget https://ftp.gnu.org/gnu/binutils/${BINUTILS_VERSION}.tar.bz2 && \ + tar xjf ${BINUTILS_VERSION}.tar.bz2 && \ + rm ${BINUTILS_VERSION}.tar.bz2 +# Download the GCC prerequisites +RUN cd ${GCC_VERSION} && contrib/download_prerequisites && rm *.tar.* +#RUN cd gcc-9.2.0 && contrib/download_prerequisites && rm *.tar.* + +# Build BinUtils +RUN mkdir -p /opt/cross-pi-gcc +WORKDIR /home/develop/build-binutils +RUN ../${BINUTILS_VERSION}/configure \ + --prefix=/opt/cross-pi-gcc --target=arm-linux-gnueabihf \ + --with-arch=armv6 --with-fpu=vfp --with-float=hard \ + --disable-multilib +RUN make -j$(nproc) +RUN make install + + +# Apply batch to GCC +# https://github.com/qca/open-ath9k-htc-firmware/issues/135 +WORKDIR /home/develop +RUN sed -i '1474s/file ==/file[0] ==/' gcc-6.3.0/gcc/ubsan.c + +# Build the first part of GCC +WORKDIR /home/develop/build-gcc +RUN ../${GCC_VERSION}/configure \ + --prefix=/opt/cross-pi-gcc \ + --target=arm-linux-gnueabihf \ + --enable-languages=c,c++,fortran \ + --with-arch=armv6 --with-fpu=vfp --with-float=hard \ + --disable-multilib \ + --enable-linker-build-id +RUN make -j$(nproc) 'LIMITS_H_TEST=true' all-gcc +RUN make install-gcc +ENV PATH=/opt/cross-pi-gcc/bin:${PATH} + +# Install dependencies +RUN apt-get update && \ + apt-get install -y gawk bison python3 && \ + apt-get clean autoclean && \ + apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* + +# Download and install the Linux headers +WORKDIR /home/develop +RUN git clone --depth=1 https://github.com/raspberrypi/linux +WORKDIR /home/develop/linux +ENV KERNEL=kernel7 +RUN make ARCH=arm INSTALL_HDR_PATH=/opt/cross-pi-gcc/arm-linux-gnueabihf headers_install + +# Build GLIBC +WORKDIR /home/develop/build-glibc +RUN ../${GLIBC_VERSION}/configure \ + --prefix=/opt/cross-pi-gcc/arm-linux-gnueabihf \ + --build=$MACHTYPE --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf \ + --with-arch=armv6 --with-fpu=vfp --with-float=hard \ + --with-headers=/opt/cross-pi-gcc/arm-linux-gnueabihf/include \ + --disable-multilib libc_cv_forced_unwind=yes +RUN make install-bootstrap-headers=yes install-headers +RUN make -j8 csu/subdir_lib +RUN install csu/crt1.o csu/crti.o csu/crtn.o /opt/cross-pi-gcc/arm-linux-gnueabihf/lib +RUN arm-linux-gnueabihf-gcc -nostdlib -nostartfiles -shared -x c /dev/null \ + -o /opt/cross-pi-gcc/arm-linux-gnueabihf/lib/libc.so +RUN touch /opt/cross-pi-gcc/arm-linux-gnueabihf/include/gnu/stubs.h + +# Continue building GCC +WORKDIR /home/develop/build-gcc +RUN make -j$(nproc) all-target-libgcc +RUN make install-target-libgcc + +# Finish building GLIBC +WORKDIR /home/develop/build-glibc +RUN make -j$(nproc) +RUN make install + +# Finish building GCC +WORKDIR /home/develop/build-gcc +RUN make -j$(nproc) +RUN make install + + +# Download systemd and it's dependancys. +RUN mkdir -p /home/develop/packages +WORKDIR /home/develop/packages + + +#################### +# Manually libsystemd-dev and all it's depandancys +# Commented out ones are what I really want, but couldn;t find. +#####RUN wget https://archive.debian.org/debian/pool/main/s/systemd/libsystemd-dev_232-25+deb9u14_armhf.deb +#RUN wget https://archive.debian.org/debian/pool/main/s/systemd/libsystemd-dev_232-25+deb9u12_armhf.deb +#####RUN wget https://archive.debian.org/debian/pool/main/s/systemd/libsystemd0_232-25+deb9u14_armhf.deb +#RUN wget https://archive.debian.org/debian/pool/main/s/systemd/libsystemd0_232-25+deb9u12_armhf.deb +#RUN wget https://archive.debian.org/debian/pool/main/g/glibc/libc6_2.24-11+deb9u4_armhf.deb +#RUN wget https://archive.debian.org/debian/pool/main/libg/libgpg-error/libgpg-error0_1.26-2_armhf.deb +#####RUN wget https://archive.debian.org/debian/pool/main/x/xz-utils/liblzma5_5.2.2-1.2+deb9u1_armhf.deb +#RUN wget https://archive.debian.org/debian/pool/main/x/xz-utils/liblzma5_5.2.2-1.2+b1_armhf.deb +#RUN wget https://archive.debian.org/debian/pool/main/libs/libselinux/libselinux1_2.6-3+b3_armhf.deb +#####RUN wget https://archive.debian.org/debian/pool/main/libg/libgcrypt20//libgcrypt20_1.7.6-2+deb9u4_armhf.deb +#RUN wget https://archive.debian.org/debian/pool/main/libg/libgcrypt20//libgcrypt20_1.7.6-2+deb9u3_armhf.deb +#####RUN wget https://archive.debian.org/debian/pool/main/l/lz4/liblz4-1_0.0~r131-2+deb9u1_armhf.deb +#RUN wget https://archive.debian.org/debian/pool/main/l/lz4/liblz4-1_0.0~r131-2+b1_armhf.deb +#####RUN wget https://archive.debian.org/debian/pool/main/p/pcre3/libpcre3_2%3a8.39-3_armhf.deb +#RUN wget https://archive.debian.org/debian/pool/main/p/pcre3/libpcre3_8.39-3_armhf.deb +# +# Now we have all packaged, let's unpack them. +# +# Install all packages into /opt/cross-pi-gcc/arm-linux-gnueabihf +#RUN for file in *; do dpkg-deb -x $file /opt/cross-pi-gcc/arm-linux-gnueabihf; done +# + +#################### +# Rather than manually, Let's do some modifications to apt and get that working (kinda) + +# Get just enough for apt-get and dpk to run. apt-get doesn't actually work, just enough to download +ENV APT_ROOT=/opt/cross-pi-gcc/apt-armhf +RUN mkdir -p $APT_ROOT +#RUN APT_ROOT=/opt/cross-pi-gcc/apt-armhf; export APT_ROOT + +RUN mkdir -p $APT_ROOT/etc/apt/sources.list.d/ +RUN mkdir -p $APT_ROOT/var/lib/dpkg/updates/ +RUN mkdir -p $APT_ROOT/var/lib/dpkg/info +RUN mkdir -p $APT_ROOT/var/cache/apt/archives/partial +RUN mkdir -p $APT_ROOT/var/log/apt/ +#mkdir -p $APT_ROOT/usr/share/ + +RUN echo "deb http://archive.debian.org/debian/ stretch main contrib non-free" > $APT_ROOT/etc/apt/sources.list +RUN echo "deb http://archive.debian.org/debian/ stretch-proposed-updates main contrib non-free" >> $APT_ROOT/etc/apt/sources.list +RUN echo "deb http://archive.debian.org/debian-security stretch/updates main contrib non-free" >> $APT_ROOT/etc/apt/sources.list + +RUN touch $APT_ROOT/var/lib/dpkg/status + +RUN ln -s /etc/apt/trusted.gpg.d $APT_ROOT/etc/apt/ +RUN ln -s /etc/apt/preferences.d $APT_ROOT/etc/apt/ +RUN ln -s /etc/apt/auth.conf.d $APT_ROOT/etc/apt/ + +# needed for download +RUN dpkg --add-architecture armhf +# needed for install +RUN dpkg --root=$APT_ROOT --add-architecture armhf + +RUN apt -o Dir=$APT_ROOT update + +RUN apt -o Dir=$APT_ROOT download libsystemd-dev:armhf \ + libsystemd0:armhf \ + libc6:armhf \ + libgcrypt20:armhf \ + liblz4-1:armhf \ + liblzma5:armhf \ + libselinux1:armhf \ + libpcre3:armhf \ + libgpg-error0:armhf + +############ +# Now we have all packaged, let's unpack them. + +# Install all packages into /opt/cross-pi-gcc/arm-linux-gnueabihf +# Could use `dpkg --root=$APT_ROOT --force-all -i` in below, but extract works without any warnings. +RUN for file in *; do dpkg -x $file /opt/cross-pi-gcc/arm-linux-gnueabihf; done + +# the above will ge installed in /opt/cross-pi-gcc/arm-linux-gnueabihf/lib/arm-linux-gnueabihf, +# and we need them in /opt/cross-pi-gcc/arm-linux-gnueabihf/lib/, so make come links. +WORKDIR /opt/cross-pi-gcc/arm-linux-gnueabihf/lib +RUN for file in ./arm-linux-gnueabihf/*; do ln -s $file ./`basename $file` 2> /dev/null; done; exit 0 + +# liblz4.so.1 is installed in a different directory, so link that as well. +RUN ln -s /opt/cross-pi-gcc/arm-linux-gnueabihf/usr/lib/arm-linux-gnueabihf/liblz4.so.1 /opt/cross-pi-gcc/arm-linux-gnueabihf/lib/liblz4.so.1 + + +ENV C_INCLUDE_PATH=/opt/cross-pi-gcc/arm-linux-gnueabihf/usr/include + +ENV PATH=$PATH:/opt/cross-pi-gcc/bin:/opt/cross-pi-gcc/libexec/gcc/arm-linux-gnueabihf/6.3.0/ + +RUN mkdir /build +WORKDIR /build + +# Add a user called `build` uid 1001 & gid 10000 +# You chould change RB_UID & RB_GID to what works on your build setup +ENV RB_USER=build +ENV RB_UID=1001 +ENV RB_GID=1000 +RUN groupadd -g $RB_GID $RB_USER 2> /dev/null; exit 0 +RUN useradd $RB_USER -u $RB_UID -g $RB_GID -m -s /bin/bash +RUN echo "$RB_USER ALL=(ALL:ALL) ALL" >> /etc/sudoers + +USER $RB_USER + \ No newline at end of file diff --git a/docker/buildx.sh b/docker/buildx.sh index 1d3ec0c..964fdd7 100755 --- a/docker/buildx.sh +++ b/docker/buildx.sh @@ -58,7 +58,7 @@ if echo $DOCKER_TAGS | grep -q $VERSION; then fi # Login first -# cat ~sf/.docker.token | docker login --username sfeakes --password-stdin +# cat ~/.docker.token | docker login --username sfeakes --password-stdin echo "Building Docker container for $IMAGE using branch $VERSION" docker buildx build --platform=linux/amd64,linux/arm64 \ diff --git a/extras/start_pump_reboot.sh b/extras/start_pump_reboot.sh new file mode 100755 index 0000000..326fe7a --- /dev/null +++ b/extras/start_pump_reboot.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Pass time between as #1 and #2 using 24 hour + +# example crontab entry to start pump if system boots is between 6am and 11pm +# +# @reboot /path/start_pump_reboot 6 23 +# + +startAfter=$1 +startBefore=$2 + +SLEEP_BETWEEN_TRIES=5 # 5 seconds +TRIES=5 # 5 tries + +# Wait for AqualinkD to come up and connect to panel +sleep 30 + +hour=$(date +%H) + + +function turn_on() { + curl -s -S -o /dev/null http://localhost:80/api/Filter_Pump/set -d value=1 -X PUT --fail + rtn=$? + echo $rtn + return $rtn +} + +#echo "Hour=$hour Ater=$startAfter Before=$startBefore" + +# Remember 11:45 is 11, so don't use <= for startBefore +if (($hour >= $startAfter && $hour < $startBefore )); then + x=1 + while [ $x -le $TRIES ] && [ $(turn_on) -gt 0 ]; do + sleep $SLEEP_BETWEEN_TRIES + x=$(( $x + 1 )) + done +fi \ No newline at end of file diff --git a/release/aqualinkd-arm64 b/release/aqualinkd-arm64 index 16bb637..152a4dd 100755 Binary files a/release/aqualinkd-arm64 and b/release/aqualinkd-arm64 differ diff --git a/release/aqualinkd-armhf b/release/aqualinkd-armhf index 5d2b34c..e13c7f8 100755 Binary files a/release/aqualinkd-armhf and b/release/aqualinkd-armhf differ diff --git a/release/aqualinkd.conf b/release/aqualinkd.conf index 508fce6..43ac10e 100755 --- a/release/aqualinkd.conf +++ b/release/aqualinkd.conf @@ -112,11 +112,9 @@ convert_dz_temp_to_c = yes # decide how to report. report_zero_spa_temp = yes -# default is to not report changes to pool temp when the filter pump is off or in spa mode -# enable below to report 0 as the pool temp when the filter pump is off or when in spa mode. -# This is for MQTT cnnections only, WEB socket and WEB API always report TEMP_UNKNOWN (-999) allowing the consumer to -# decide how to report. -report_zero_pool_temp = no +# When pool or spa is off, report 0deg for water temp. If set to no, last known value will be used. +report_zero_pool_temp = yes +report_zero_spa_temp = yes # mqtt stuff #mqtt_address = localhost:1883 diff --git a/release/serial_logger-arm64 b/release/serial_logger-arm64 index b312924..ac85596 100755 Binary files a/release/serial_logger-arm64 and b/release/serial_logger-arm64 differ diff --git a/release/serial_logger-armhf b/release/serial_logger-armhf index b30aa11..0841b40 100755 Binary files a/release/serial_logger-armhf and b/release/serial_logger-armhf differ diff --git a/source/allbutton.c b/source/allbutton.c index e393a7e..1317aa1 100644 --- a/source/allbutton.c +++ b/source/allbutton.c @@ -78,6 +78,8 @@ void setUnits(char *msg, struct aqualinkdata *aq_data) #define MSG_RS16BUTTON (1 << 8) #define MSG_BATTERY_LOW (1 << 9) #define MSG_SWG_DEVICE (1 << 10) +#define MSG_LOOP_POOL_TEMP (1 << 11) +#define MSG_LOOP_SPA_TEMP (1 << 12) #ifdef AQ_RS16 int16_t RS16_endswithLEDstate(char *msg, struct aqualinkdata *aq_data) @@ -224,6 +226,14 @@ void _processMessage(char *message, struct aqualinkdata *aq_data, bool reset) // NSF Need something to catch startup when SWG=0 so we set it to enabeled. // when other ways/protocols to detect SWG=0 are turned off. } + + if ((msg_loop & MSG_LOOP_POOL_TEMP) != MSG_LOOP_POOL_TEMP && aq_data->pool_temp != TEMP_UNKNOWN ) { + aq_data->pool_temp = TEMP_UNKNOWN; + } + if ((msg_loop & MSG_LOOP_SPA_TEMP) != MSG_LOOP_SPA_TEMP && aq_data->spa_temp != TEMP_UNKNOWN ) { + aq_data->spa_temp = TEMP_UNKNOWN; + } + /* // AQUAPURE=0 we never get that message on ALLBUTTON so don't turn off unless filter pump if off if ((msg_loop & MSG_SWG) != MSG_SWG && aq_data->aqbuttons[PUMP_INDEX].led->state == OFF ) { @@ -302,6 +312,7 @@ void _processMessage(char *message, struct aqualinkdata *aq_data, bool reset) } else if (strncasecmp(msg, MSG_POOL_TEMP, MSG_POOL_TEMP_LEN) == 0) { + msg_loop |= MSG_LOOP_POOL_TEMP; aq_data->pool_temp = atoi(msg + MSG_POOL_TEMP_LEN); if (aq_data->temp_units == UNKNOWN) @@ -309,6 +320,7 @@ void _processMessage(char *message, struct aqualinkdata *aq_data, bool reset) } else if (strncasecmp(msg, MSG_SPA_TEMP, MSG_SPA_TEMP_LEN) == 0) { + msg_loop |= MSG_LOOP_SPA_TEMP; aq_data->spa_temp = atoi(msg + MSG_SPA_TEMP_LEN); if (aq_data->temp_units == UNKNOWN) @@ -620,6 +632,10 @@ bool process_allbutton_packet(unsigned char *packet, int length, struct aqualink //LOG(ALLB_LOG,LOG_DEBUG_SERIAL, "RS Received STATUS length %d.\n", length); memcpy(aq_data->raw_status, packet + 4, AQ_PSTLEN); processLEDstate(aq_data); + + /* NSF Take this out, and use the ALLButton loop cycle to determin if we get spa/pool temp + messages. Works better for dual equiptment when both pool & spa pumps and dual temp sensors */ + /* if (aq_data->aqbuttons[PUMP_INDEX].led->state == OFF) { aq_data->pool_temp = TEMP_UNKNOWN; @@ -635,6 +651,7 @@ bool process_allbutton_packet(unsigned char *packet, int length, struct aqualink { aq_data->pool_temp = TEMP_UNKNOWN; } + */ // COLOR MODE programming relies on state changes, so let any threads know //if (aq_data->active_thread.ptype == AQ_SET_LIGHTPROGRAM_MODE) { diff --git a/source/aq_panel.c b/source/aq_panel.c index 6a2154a..a807054 100644 --- a/source/aq_panel.c +++ b/source/aq_panel.c @@ -46,6 +46,40 @@ char *name2label(char *str) return newst; } +// This has NOT been tested. +uint8_t getPanelSupport( char *rev_string, int rev_len) +{ + uint8_t supported = 0; + + char REV[5]; + + // Get the actual rev letter + if ( rsm_get_revision(REV, rev_string, rev_len) ) { + // Rev >=I == one touch protocol + // Rev >=O == VSP + // Rev >=Q == iaqualink touch protocol. + // REv >= P == chemlink + // Rev >= HH serial adapter. + if (REV[0] >= 81) // Q in ascii + supported |= RSP_SUP_IAQT; + + if (REV[0] >= 80) // P in ascii + supported |= RSP_SUP_CHEM; + + if (REV[0] >= 79) // O in ascii + supported |= RSP_SUP_VSP; + + if (REV[0] >= 73) // I in ascii + supported |= RSP_SUP_ONET; + + if (REV[0] > 72 || (REV[0] == 72 && REV[1] == 72) ) // H in ascii + supported |= RSP_SUP_SERA; + + } + + return supported; +} + void changePanelToMode_Only() { _aqconfig_.paneltype_mask |= RSP_SINGLE; _aqconfig_.paneltype_mask &= ~RSP_COMBO; diff --git a/source/aq_panel.h b/source/aq_panel.h index ef2a9ab..fec7052 100644 --- a/source/aq_panel.h +++ b/source/aq_panel.h @@ -30,6 +30,15 @@ #define RSP_RSSA (1 << 14) // 128 #define RSP_EXT_PROG (1 << 15) // 128 + +// Bitmask for pannel support against board rev +// used in getPanelSupport() +#define RSP_SUP_ONET (1 << 0) +#define RSP_SUP_IAQT (1 << 1) +#define RSP_SUP_VSP (1 << 2) +#define RSP_SUP_CHEM (1 << 3) +#define RSP_SUP_SERA (1 << 4) // Serial adapter + //void initButtons(struct aqualinkdata *aqdata); void setPanelByName(struct aqualinkdata *aqdata, const char *str); void setPanel(struct aqualinkdata *aqdata, bool rs, int size, bool combo, bool dual); @@ -42,6 +51,8 @@ void addPanelOneTouchInterface(); void addPanelIAQTouchInterface(); void addPanelRSserialAdapterInterface(); void changePanelToExtendedIDProgramming(); + +uint8_t getPanelSupport( char *rev_string, int rev_len); //void panneltest(); #define isPDA_PANEL ((_aqconfig_.paneltype_mask & RSP_PDA) == RSP_PDA) diff --git a/source/config.c b/source/config.c index 5834d6f..e440bd5 100644 --- a/source/config.c +++ b/source/config.c @@ -120,8 +120,8 @@ void init_parameters (struct aqconfig * parms) //parms->onetouch_mode = false; parms->convert_mqtt_temp = true; parms->convert_dz_temp = true; - parms->report_zero_pool_temp = false; - parms->report_zero_spa_temp = false; + parms->report_zero_pool_temp = true; + parms->report_zero_spa_temp = true; //parms->read_all_devices = true; //parms->read_pentair_packets = false; parms->read_RS485_devmask = 0; diff --git a/source/devices_jandy.c b/source/devices_jandy.c index b5650fc..97dd4b5 100644 --- a/source/devices_jandy.c +++ b/source/devices_jandy.c @@ -934,6 +934,13 @@ bool processPacketFromJandyChemFeeder(unsigned char *packet_buffer, int packet_l LOG(DJAN_LOG, LOG_INFO, "%s\n", msg); + /* + ph_setpoint = float(raw_data[8]) / 10 + acl_setpoint = raw_data[9] * 10 + ph_current = float(raw_data[10]) / 10 + acl_current = raw_data[11] * 10 + */ + return false; } diff --git a/source/iaqtouch.c b/source/iaqtouch.c index 4061c66..5404bd3 100644 --- a/source/iaqtouch.c +++ b/source/iaqtouch.c @@ -347,7 +347,7 @@ void processPageButton(unsigned char *message, int length, struct aqualinkdata * int rtn=-1; //LOG(IAQT_LOG,LOG_DEBUG, "Button compare '%s' to '%s'\n",button->name, aq_data->aqbuttons[i].label); // If we are loading HOME page then simply button name is the label ie "Aux3" - // If loading DEVICES? page then button name + statusis "Aux3 OFF " + // If loading DEVICES? page then button name + status is "Aux3 OFF " if (_currentPageLoading == IAQ_PAGE_HOME) rtn = rsm_strmatch((const char *)button->name, aq_data->aqbuttons[i].label); @@ -630,6 +630,15 @@ void processPage(struct aqualinkdata *aq_data) //Info: iAQ Touch: Home Status page 01| 72 //Info: iAQ Touch: Home Status page 04| Spa Temp //Info: iAQ Touch: Home Status page 05| Air Temp +// IF WE HAVE A PANEL WITH EXTRA PUMP & TEMP SENSOR, THEN WE GET DIFFERENT INFO. +// We Need to code for both cases. +//Info: iAQ Touch: Home Status page 00| 96 <- pool +//Info: iAQ Touch: Home Status page 01| 96 <- air +//Info: iAQ Touch: Home Status page 02| Spa Temp +//Info: iAQ Touch: Home Status page 03| 95 <- spa temp +//Info: iAQ Touch: Home Status page 04| Pool Temp +//Info: iAQ Touch: Home Status page 05| Air Temp + if (isPDA_PANEL) { // Set temp if PDA panel if (rsm_strcmp(_homeStatus[5],"Air Temp") == 0) { aq_data->air_temp = atoi(_homeStatus[1]); diff --git a/source/serial_logger.c b/source/serial_logger.c index c3b5fc5..53fd2d8 100644 --- a/source/serial_logger.c +++ b/source/serial_logger.c @@ -39,9 +39,9 @@ #include "config.h" #define SLOG_MAX 80 -#define PACKET_MAX 600 +#define PACKET_MAX 800 -#define VERSION "serial_logger V2.3" +#define VERSION "serial_logger V2.4" /* typedef enum used { @@ -65,6 +65,7 @@ struct aqconfig _aqconfig_; char _panelType[AQ_MSGLEN]; char _panelRev[AQ_MSGLEN]; bool _panelPDA = false; +int _panelRevInt = 0; typedef struct serial_id_log { unsigned char ID; @@ -301,6 +302,12 @@ void getPanelInfo(int rs_fd, unsigned char *packet_buffer, int packet_length) if (_panelType[1] == 'P' && _panelType[2] == 'D') { // PDA Panel _panelPDA = true; } + + char REV[5]; + if ( rsm_get_revision(REV, _panelRev, AQ_MSGLEN) ) { + _panelRevInt = REV[0]; + } + } #ifdef SERIAL_LOGGER @@ -759,8 +766,12 @@ int _serial_logger(int rs_fd, char *port_name, int logPackets, int logLevel, boo rssaID = slog[i].ID; else if (canUseONET(slog[i].ID) && extID == 0x00) extID = slog[i].ID; - else if (canUseIQAT(slog[i].ID) && (extID == 0x00 || canUseONET(extID))) - extID = slog[i].ID; + else if (canUseIQAT(slog[i].ID) && (extID == 0x00 || canUseONET(extID))) + { + // Check panel rev is higher than REV Q (if it's been found). Panel rev I pings on IAQtouch id but it's not supported. + if ( _panelRevInt == 0 || _panelRevInt >= 81 ) + extID = slog[i].ID; + } } else { if (canUsePDA(slog[i].ID) && mainID == 0x00) mainID = slog[i].ID; diff --git a/web/config.js b/web/config.js index 3c6bc82..53aff92 100644 --- a/web/config.js +++ b/web/config.js @@ -138,4 +138,6 @@ // var head_background = "#000D53"; // REMOVE THIS. - //document.writeln(""); \ No newline at end of file + //document.writeln(""); + + \ No newline at end of file diff --git a/web/controller.html b/web/controller.html index e65b84c..c47a6d2 100644 --- a/web/controller.html +++ b/web/controller.html @@ -1018,7 +1018,7 @@ } } catch (e) { // NSF Do we need to create the device? - console.log('ERROR id=' + id + ' Line 837 | element = '+document.getElementById(id)); + console.log('ERROR id=' + id + ' Line '+new Error().lineNumber+' | element = '+document.getElementById(id)); } //document.getElementById(id + '_tile_icon_value').textContent = value; var tile; @@ -2193,7 +2193,8 @@ // If we have 2 lines, then BOTTOM (line #1) is ERROR (not priming) or what the pump needs to control (RPM for all except VF which is GPM) // TOP (line #2) is (priming/RPM/GPM). - // 1,0,-1 are all good states, anything else error + // 1,0,-1 are all good states, anything else error + try { if (status >= 1 || status <= -3) { if (status == -3) { setTileOnText(tileid, 'Pump Offline'); @@ -2233,6 +2234,10 @@ setTileOnText(tileid, bLine); setTileOnTextLine2(tileid, tLine); + } catch (e) { + // NSF Do we need to create the device? + console.log('ERROR id=' + tileid + ' Line '+new Error().lineNumber+' | element = '+document.getElementById(tileid)); + } } function deviceSort(a, b) {