-
Notifications
You must be signed in to change notification settings - Fork 125
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
Added support for 5 Channel S0 USB Pulse meter (original: 5-kanaals S0 Pulse Meter op USB) #596
Open
Lurchi70
wants to merge
7
commits into
volkszaehler:master
Choose a base branch
from
Lurchi70:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bef8864
Support SOS S0 Pulse Meter via USB
Lurchi70 65a7030
Support SOS S0 Pulse Meter via USB
Lurchi70 196cbca
Merge branch 'master' of https://github.com/Lurchi70/vzlogger
Lurchi70 404ff47
Add support for 'send_zero' option to sos_s0 protocols
Lurchi70 9031953
Several smaller changes
Lurchi70 20f067e
Changed misleading comment in sourcefile
Lurchi70 c4eda17
Merge branch 'volkszaehler:master' into master
Lurchi70 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/** | ||
* vzlogger configuration | ||
* | ||
* Use properly encoded JSON with javascript comments | ||
* | ||
* Take a look at the wiki for detailed information: | ||
* http://wiki.volkszaehler.org/software/controller/vzlogger#configuration | ||
* | ||
* For an online configuration editor refer to: | ||
* http://volkszaehler.github.io/vzlogger/ | ||
*/ | ||
|
||
{ | ||
// General settings | ||
"verbosity": 10, // log verbosity (0=log_alert, 1=log_error, 3=log_warning, 5=log_info, 10=log_debug, 15=log_finest) | ||
"log": "/var/log/vzlogger.log", // log file, optional | ||
"retry": 30, // http retry delay in seconds | ||
|
||
// Build-in HTTP server | ||
"local": { | ||
"enabled": false, // enable local HTTPd for serving live readings | ||
"port": 8080, // TCP port for local HTTPd | ||
"index": true, // provide index listing of available channels if no UUID was requested | ||
"timeout": 30, // timeout for long polling comet requests in seconds (0 disables comet) | ||
"buffer": -1 // HTTPd buffer configuration for serving readings, default -1 | ||
// >0: number of seconds of readings to serve | ||
// <0: number of tuples to server per channel (e.g. -3 will serve 3 tuples) | ||
}, | ||
|
||
// realtime notification settings | ||
//"push": [ | ||
// { | ||
// "url": "http://127.0.0.1:5582" // notification destination, e.g. frontend push-server | ||
// } | ||
//], | ||
|
||
// mqtt client support (if ENABLE_MQTT set at cmake generation) | ||
"mqtt": { | ||
"enabled": false, // enable mqtt client. needs host and port as well | ||
"host": "test.mosquitto.org", // mqtt server addr | ||
"port": 1883, // 1883 for unencrypted, 8883 enc, 8884 enc cert needed, | ||
"cafile": "", // optional file with server CA | ||
"capath": "", // optional path for server CAs. see mosquitto.conf. Specify only cafile or capath | ||
"certfile": "", // optional file for your client certificate (e.g. client.crt) | ||
"keyfile": "", // optional path for your client certficate private key (e.g. client.key) | ||
"keypass": "", // optional password for your private key | ||
"keepalive": 30, // optional keepalive in seconds. | ||
"topic": "vzlogger/data", // optional topic dont use $ at start and no / at end | ||
"id": "", // optional static id, if not set "vzlogger_<pid>" will be used | ||
"user": "", // optional user name for the mqtt server | ||
"pass": "", // optional password for the mqtt server | ||
"retain": false, // optional use retain message flag | ||
"rawAndAgg": false, // optional publish raw values even if agg mode is used | ||
"qos": 0, // optional quality of service, default is 0 | ||
"timestamp": false // optional whether to include a timestamp in the payload | ||
}, | ||
|
||
// Meter configuration | ||
"meters": [ | ||
{ | ||
// Example SOS S0 meter | ||
|
||
"enabled": true, // disabled meters will be ignored (default) | ||
"allowskip": false, // errors when opening meter may be ignored if enabled | ||
"protocol": "sos_s0", // meter protocol, see 'vzlogger -h' for full list | ||
"device": "/dev/ttyACM0", // meter device | ||
|
||
// "aggtime": 20, // aggregate meter readings and send middleware update after <aggtime> seconds | ||
"interval": -1, // wait time in seconds until new values will transmitted to middleware | ||
// "send_zero": false, | ||
|
||
"channels": [{ | ||
"uuid": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeee", | ||
"identifier": "M1", // S0 Port identifier | ||
"api": "null", | ||
"aggmode": "SUM" // aggregation mode: aggregate meter readings during <aggtime> interval | ||
}, { | ||
"uuid": "aaaaaaaa-bbbb-cccc-dddd-ffffffff", | ||
"identifier": "M2", // S0 Port identifier | ||
"api": "null", | ||
"aggmode": "SUM" // aggregation mode: aggregate meter readings during <aggtime> interval | ||
}, { | ||
"uuid": "aaaaaaaa-bbbb-cccc-dddd-11111111", | ||
"identifier": "M3", // S0 Port identifier | ||
"api": "null", | ||
"aggmode": "SUM" // aggregation mode: aggregate meter readings during <aggtime> interval | ||
}, { | ||
"uuid": "aaaaaaaa-bbbb-cccc-dddd-22222222", | ||
"identifier": "M4", // S0 Port identifier | ||
"api": "null", | ||
"aggmode": "SUM" // aggregation mode: aggregate meter readings during <aggtime> interval | ||
}, { | ||
"uuid": "aaaaaaaa-bbbb-cccc-dddd-33333333", | ||
"identifier": "M5", // S0 Port identifier | ||
"api": "null", | ||
"aggmode": "SUM" // aggregation mode: aggregate meter readings during <aggtime> interval | ||
} | ||
] | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* Plaintext protocol of S0 Pulse meter devices | ||
* --> https://www.sossolutions.nl/5-kanaals-s0-pulse-meter-op-usb | ||
* | ||
* The device is a USB s0 logger device. | ||
* | ||
* The protocol is defined as follows: | ||
* ‘ID:x:I:y:M1:a:b:M2:c:d:M3:e:f:M4:g:h:M5:i:j’’ | ||
* - x = ID des S0 pulse meter (unique) | ||
* - y = number of seconds since last message (default: 10 second) | ||
* - M1,M2,M3,M4,M5 = identifier name for corresponding S0 port on device | ||
* - a,c,e,g,i = number of pulses since last message | ||
* - b,d,f,h,j = total number of pulses since start of device | ||
* | ||
* @package vzlogger | ||
* @copyright Copyright (c) 2011 - 2023, The volkszaehler.org project | ||
* @license http://www.gnu.org/licenses/gpl.txt GNU Public License | ||
* @author Lurchi70 <https://github.com/Lurchi70/vzlogger> | ||
*/ | ||
/* | ||
* This file is part of volkzaehler.org | ||
* | ||
* volkzaehler.org is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* | ||
* volkzaehler.org is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with volkszaehler.org. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
// RW: added ack | ||
#ifndef _SOS_S0_H_ | ||
#define _SOS_S0_H_ | ||
|
||
#include <protocols/Protocol.hpp> | ||
#include <termios.h> | ||
|
||
class MeterSOS_S0 : public vz::protocol::Protocol { | ||
public: | ||
MeterSOS_S0(std::list<Option> &options); | ||
virtual ~MeterSOS_S0(); | ||
|
||
int open(); | ||
int close(); | ||
ssize_t read(std::vector<Reading> &rds, size_t n); | ||
virtual bool allowInterval() const { | ||
return false; | ||
} // only allow conf setting interval if pull is set (otherwise meter sends autom.) | ||
|
||
const char *device() const { return _device.c_str(); } | ||
|
||
private: | ||
std::string _device; | ||
std::string _dump_file; | ||
int _baudrate; | ||
parity_type_t _parity; | ||
size_t _read_timeout_s; | ||
bool _send_zero; | ||
|
||
int _fd; /* file descriptor of port */ | ||
struct termios _oldtio; /* required to reset port */ | ||
|
||
int _openDevice(struct termios *old_tio, speed_t baudrate); | ||
bool _is_valid_fd(); | ||
}; | ||
|
||
#endif /* _D0_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just a little bit more description of the communication, at least "sending a text-based protocol over a usb-connected uart interface"?
maybe the usb-IDs used by the device or a udev rule to identify it.