Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ping check #220

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ef3161e
Added sensor2 and soil moisture sensor
opensprinklershop Jul 12, 2019
df7c098
RAIN->SOIL
opensprinklershop Jul 12, 2019
3992adb
Added sensor2 and soil moisture sensor
opensprinklershop Jul 12, 2019
889210d
RAIN->SOIL
opensprinklershop Jul 12, 2019
fd56955
Merge remote-tracking branch 'upstream/dev/219-7'
opensprinklershop Oct 1, 2020
69e35e3
Merge branch 'master' of https://github.com/opensprinklershop/OpenSpr…
opensprinklershop Oct 1, 2020
61673ab
lwip version - bases on Arduino 3.0.2: Needs updates version of LitteFS
opensprinklershop Apr 1, 2022
0b70b8b
Update README.txt
opensprinklershop Apr 1, 2022
e1af753
Update README.txt
opensprinklershop Apr 1, 2022
81eaf3b
Version 105: Register check enc_28j60, dhcp_renew und check_network
Apr 2, 2022
ad2c2a3
- static ip init fix
May 26, 2022
337ddf0
When using a Fixed IP don't call dhcp_renew
Jun 7, 2022
37d7beb
2.2.0.108
Jul 24, 2022
6bf0802
Version .109 mit geänderten Build Flags und zusätzlicher Wiederholung…
Jul 30, 2022
35f0e02
Version 111
Sep 7, 2022
2d88056
Update 112
Oct 15, 2022
8f2cb95
sensor groups added
Oct 15, 2022
a2e5757
Sensor Api working
Oct 28, 2022
e404865
Water adjustments calculation added (incomplete...)
Nov 1, 2022
b932e97
Analog sensor board test commit
opensprinklershop Nov 11, 2022
c2401b8
Added ADS1015 support
Nov 15, 2022
9fa0931
Working plattformio.ini , new sensors: SMT50 Moisture+Temp, changed l…
Nov 15, 2022
4eefe68
List Program adjustments (se) and List supported sensor types (sf) added
Nov 16, 2022
892faca
- list sensor types
Nov 19, 2022
dc34bba
1. Update Sensor API
Nov 23, 2022
af2cce4
sg+sr with optional nr parameter
Dec 7, 2022
1571ef3
Sensor API added flags / show option
Dec 26, 2022
6c64ebb
Added effective program adjustment output for se
Dec 27, 2022
092b0be
Fixt sensor timeout issue
Dec 28, 2022
66c3d30
Analog Sensor API V1.0 Release
Jan 12, 2023
3430975
Analog Sensor API V1.0 Release
Jan 13, 2023
930de19
Added dhcp and enc28J60 check
Jan 13, 2023
7bdcd0a
Fix ADC sensor id
Jan 16, 2023
1955089
*.bak to gitignore
Jan 16, 2023
bc71c28
Added Ping check (icmp ping)
Jan 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ testmode.h
build-1284/*
.vscode
.pio
*.bak
137 changes: 137 additions & 0 deletions Sensor API.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
Sensor API
This api documentation is part of the opensprinkler

<ip> the ip-address, for example 192.168.0.55
<pw> the MD5 encrypted password, opendoor=a6d82bced638de3def1e9bbb4983225c


Create Sensors (sc):
creates, modifies or deletes a sensor.
"nr" for a unique number >= 1
"type" for the sensor-type, see sf. type=0 deletes the sensor
"group" for group assignment, a nr of another sensor with type=SENSOR_GROUP_YXZ
"name" a name
"ip" for the ip-address, only for network connected sensors. All others use ip=0
"port" for the ip-port-address, only for network connected sensors. All others use port=0
"id" sub-id, e.a. modbus address or subid, for ADC Sensors 0..7
"ri" read interval in seconds
"enable" 0=sensor disabled, 1=sensor enabled
"log" 0=logging disabled, 1=logging enabled

examples:
http://<ip>/sc?pw=<pw>&nr=1&type=1&group=0&name=SMT100-Mois&ip=4261456064&port=8899&id=253&ri=60&enable=1&log=1
http://<ip>/sc?pw=<pw>&nr=2&type=2&group=0&name=SMT100-Temp&ip=4261456064&port=8899&id=253&ri=60&enable=1&log=1
http://<ip>/sc?pw=<pw>&nr=3&type=11&group=0&name=SMT50-Mois&ip=0&id=0&ri=60&enable=1&log=1
http://<ip>/sc?pw=<pw>&nr=4&type=12&group=0&name=SMT50-Temp&ip=0&id=1&ri=60&enable=1&log=1

ip: dec=4261456064 = hex=FE00A8C0 =
FE = 254
00 = 000
A8 = 168
C0 = 192
= 192.168.000.254

For the Truebner SMT100 RS485 Modbus you need a RS485 Modbus RTU over TCP converter.
Set ip/port for the converter, e.a PUSR USR-W610 in transparent modus.

For the analog ports of the extension board (including SMT50) use id 0..7

type:
SENSOR_NONE 0 None or deleted sensor
SENSOR_SMT100_MODBUS_RTU_MOIS 1 Truebner SMT100 RS485 Modbus RTU over TCP, moisture mode
SENSOR_SMT100_MODBUS_RTU_TEMP 2 Truebner SMT100 RS485 Modbus RTU over TCP, temperature mode
SENSOR_ANALOG_EXTENSION_BOARD 10 New OpenSprinkler analog extension board x8 - voltage mode 0..4V
SENSOR_ANALOG_EXTENSION_BOARD_P 11 New OpenSprinkler analog extension board x8 - percent 0..3.3V to 0..100%
SENSOR_SMT50_MOIS 15 New OpenSprinkler analog extension board x8 - SMT50 VWC [%] = (U * 50) : 3
SENSOR_SMT50_TEMP 16 New OpenSprinkler analog extension board x8 - SMT50 T [°C] = (U – 0,5) * 100
SENSOR_OSPI_ANALOG_INPUTS 20 Old OSPi analog input
SENSOR_REMOTE 100 Remote sensor of an remote opensprinkler
SENSOR_GROUP_MIN 1000 Sensor group with min value
SENSOR_GROUP_MAX 1001 Sensor group with max value
SENSOR_GROUP_AVG 1002 Sensor group with avg value
SENSOR_GROUP_SUM 1003 Sensor group with sum value

List Sensors (sl):
lists the current sensors
examples:
http://<ip>/sl?pw=<pw>

Get last Sensor values (sg):
returns last read sensor values
examples:
http://<ip>/sg?pw=<pw>
http://<ip>/sg?pw=<pw>&nr=1

Read sensor now (sr):
executes sensor read and returns the values
examples:
http://<ip>/sr?pw=<pw>
http://<ip>/sr?pw=<pw>&nr=1

Set sensor address for SMT100 (sa):
Only for SMT100: Set modbus address
Disconnect all other modbus sensors, so that only one sensor is connected. Sets the modbus address for sensor nr to id
examples:
http://<ip>/sa?pw=<pw>&nr=1&id=1

Dump Sensor Log (so):
dumps the sensor log
examples:
http://<ip>/so?pw=<pw>
http://<ip>/so?pw=<pw>&start=0&max=100&nr=1&type=1&before=1666915277&after=1666915277

Clear Sensor Log (sn):
clears the sensor log
examples:
http://<ip>/sn?pw=<pw>

Program adjustments (sb):
defines program adjustments
"nr" adjustment-nr
"type" adjustment-type (0=delete, 1=linear, 2=digital min, 3=digital max)
"sensor" sensor-nr
"prog" program-nr
"factor1", "factor2", "min", "max" formula-values
examples:
http://<ip>/sb?pw=<pw>&nr=1&type=1&sensor=4&prog=1&factor1=0&factor2=2&min=0&max=50

type:
PROG_NONE 0 //No adjustment (delete)
PROG_LINEAR 1 //formula
PROG_DIGITAL_MIN 2 //1=under or equal min, 0=above
PROG_DIGITAL_MAX 3 //1=over or equal max, 0=below

formula:
min max factor1 factor2
10..90 -> 5..1 factor1 > factor2
a b c d
(b-sensorData) / (b-a) * (c-d) + d

10..90 -> 1..5 factor1 < factor2
a b c d
(sensorData-a) / (b-a) * (d-c) + c

min/max is the used range of the sensor (for example min=10 max=80)
factor1/factor2 is the calculated adjustment (for example factor1=2 factor2=0)
So a sensordata of 10 will be a adjustment of factor 2 (200%) or
a sensordata of 80 will be a adjustment of factor 0 (0%)
everything between will be linear scaled in the range of 0..2

List Program adjustments (se):
lists the current program adjustments
examples:
http://<ip>/se?pw=<pw>
&nr=1&prog=1

List supported sensor types (sf):
lists supported sensor types
examples:
http://<ip>/sf?pw=<pw>

List supported program adjustments (sh):
http://<ip>/sh?pw=<pw>

System used and free space (du):
http://<ip>/du?pw=<pw>


7 changes: 5 additions & 2 deletions defines.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
#ifndef _DEFINES_H
#define _DEFINES_H

//#define ENABLE_DEBUG // enable serial debug
#define ENABLE_DEBUG // enable serial debug

typedef unsigned char byte;
typedef unsigned long ulong;

#define TMP_BUFFER_SIZE 255 // scratch buffer size

/** Firmware version, hardware version, and maximal values */
#define OS_FW_VERSION 220 // Firmware version: 220 means 2.2.0
#define OS_FW_VERSION 230 // Firmware version: 220 means 2.2.0
// if this number is different from the one stored in non-volatile memory
// a device reset will be automatically triggered

Expand All @@ -57,6 +57,9 @@ typedef unsigned long ulong;
#define NVCON_FILENAME "nvcon.dat" // non-volatile controller data file, see OpenSprinkler.h --> struct NVConData
#define PROG_FILENAME "prog.dat" // program data file
#define DONE_FILENAME "done.dat" // used to indicate the completion of all files
#define SENSOR_FILENAME "sensor.dat" // analog sensor filename
#define PROG_SENSOR_FILENAME "progsensor.dat" // sensor to program assign filename
#define SENSORLOG_FILENAME "sensorlog.dat" // analog sensor log filename

/** Station macro defines */
#define STN_TYPE_STANDARD 0x00 // standard solenoid station
Expand Down
Loading