kopia lustrzana https://github.com/weetmuts/wmbusmeters
Add ppm support for rtlsdr.
rodzic
76c6b6faa9
commit
dd39fe55f7
12
README.md
12
README.md
|
@ -214,13 +214,19 @@ rtlsdr dongle like this `rtlwmbus[1234]`.
|
|||
/dev/ttyUSB0:38400, to have wmbusmeters set the baud rate to 38400 and listen for raw wmbus telegrams.
|
||||
These telegrams are expected to have the data link layer crc bytes removed already!
|
||||
|
||||
rtlwmbus, to spawn the background process: "rtl_sdr -f 868.95M -s 1600000 - 2>/dev/null | rtl_wmbus"
|
||||
for each attached rtlsdr dongle.
|
||||
rtlwmbus, to spawn the background process: "rtl_sdr -f 868.625M -s 1600000 - 2>/dev/null | rtl_wmbus -s"
|
||||
for each attached rtlsdr dongle. This will listen to S1,T1 and C1 meters in parallel.
|
||||
|
||||
rtlwmbus:868.9M, to tune to this fq instead.
|
||||
rtlwmbus(ppm=17), to tune your rtlsdr dongle accordingly. Use this to tune your dongle and at
|
||||
the same time listen to S1,T1 and C1.
|
||||
|
||||
rtlwmbus:868.9M, to tune to this fq instead. This will listen to exactly to what is on this frequency,
|
||||
ie no more S1,T1 and C1 at the same time since they are on different frequencies.
|
||||
|
||||
rtl433, to spawn the background process: "rtl_433 -F csv -f 868.95M"
|
||||
|
||||
rtl433(ppm=17), to tune your rtlsdr dongle accordingly.
|
||||
|
||||
rtl433:868.9M, to tune to this fq instead.
|
||||
|
||||
rtlwmbus:CMD(<commandline>), to specify the entire background process command line that is expected to produce rtlwbus compatible output.
|
||||
|
|
|
@ -735,6 +735,8 @@ void open_bus_device_and_potentially_set_linkmodes(Configuration *config, string
|
|||
|
||||
string id = detected->found_device_id.c_str();
|
||||
if (id != "") id = "["+id+"]";
|
||||
string extras = detected->specified_device.extras.c_str();
|
||||
if (extras != "") extras = "("+extras+")";
|
||||
string fq = detected->specified_device.fq;
|
||||
if (fq != "") fq = " using fq "+fq;
|
||||
string file = detected->found_file.c_str();
|
||||
|
@ -753,10 +755,11 @@ void open_bus_device_and_potentially_set_linkmodes(Configuration *config, string
|
|||
fq.c_str(),
|
||||
cmd.c_str());
|
||||
}
|
||||
string started = tostrprintf("Started %s %s%s%s%s\n",
|
||||
string started = tostrprintf("Started %s %s%s%s%s%s\n",
|
||||
how.c_str(),
|
||||
toLowerCaseString(detected->found_type),
|
||||
id.c_str(),
|
||||
extras.c_str(),
|
||||
file.c_str(),
|
||||
listening.c_str());
|
||||
|
||||
|
|
13
src/util.cc
13
src/util.cc
|
@ -1852,3 +1852,16 @@ string lookForExecutable(string prog, string bin_dir, string default_dir)
|
|||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
bool parseExtras(string s, map<string,string> *extras)
|
||||
{
|
||||
vector<string> parts = splitString(s, ' ');
|
||||
|
||||
for (auto &p : parts)
|
||||
{
|
||||
vector<string> kv = splitString(p, '=');
|
||||
if (kv.size() != 2) return false;
|
||||
(*extras)[kv[0]] = kv[1];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include<stdint.h>
|
||||
#include<string>
|
||||
#include<functional>
|
||||
#include<map>
|
||||
#include<vector>
|
||||
|
||||
enum class MeterType;
|
||||
|
@ -202,4 +203,7 @@ std::string dirname(std::string p);
|
|||
|
||||
std::string lookForExecutable(std::string prog, std::string bin_dir, std::string default_dir);
|
||||
|
||||
// Extract from "ppm=5 radix=7" and put key values into map.
|
||||
bool parseExtras(std::string s, std::map<std::string,std::string> *extras);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -85,6 +85,21 @@ shared_ptr<WMBus> openRTL433(Detected detected, string bin_dir, bool daemon,
|
|||
SpecifiedDevice &device = detected.specified_device;
|
||||
string command;
|
||||
int id = 0;
|
||||
map<string,string> extras;
|
||||
|
||||
bool ok = parseExtras(detected.specified_device.extras, &extras);
|
||||
if (!ok)
|
||||
{
|
||||
error("(rtlwmbus) invalid extra parameters to rtlwmbus (%s)\n", detected.specified_device.extras.c_str());
|
||||
}
|
||||
string ppm = "";
|
||||
if (extras.size() > 0)
|
||||
{
|
||||
if (extras.count("ppm") > 0)
|
||||
{
|
||||
ppm = string("-p ")+extras["ppm"];
|
||||
}
|
||||
}
|
||||
|
||||
if (!serial_override)
|
||||
{
|
||||
|
@ -117,7 +132,7 @@ shared_ptr<WMBus> openRTL433(Detected detected, string bin_dir, bool daemon,
|
|||
}
|
||||
if (command == "")
|
||||
{
|
||||
command = rtl_433+" -d "+to_string(id)+" -F csv -f "+freq;
|
||||
command = rtl_433+" "+ppm+" -d "+to_string(id)+" -F csv -f "+freq;
|
||||
}
|
||||
verbose("(rtl433) using command: %s\n", command.c_str());
|
||||
}
|
||||
|
|
|
@ -45,9 +45,10 @@ struct WMBusRTLWMBUS : public virtual WMBusCommonImplementation
|
|||
LinkModeSet supportedLinkModes() {
|
||||
return
|
||||
C1_bit |
|
||||
S1_bit |
|
||||
T1_bit;
|
||||
}
|
||||
int numConcurrentLinkModes() { return 2; }
|
||||
int numConcurrentLinkModes() { return 3; }
|
||||
bool canSetLinkModes(LinkModeSet lms)
|
||||
{
|
||||
//if (!supportedLinkModes().supports(lms)) return false;
|
||||
|
@ -90,7 +91,21 @@ shared_ptr<WMBus> openRTLWMBUS(Detected detected,
|
|||
SpecifiedDevice &device = detected.specified_device;
|
||||
string command;
|
||||
int id = 0;
|
||||
map<string,string> extras;
|
||||
|
||||
bool ok = parseExtras(detected.specified_device.extras, &extras);
|
||||
if (!ok)
|
||||
{
|
||||
error("(rtlwmbus) invalid extra parameters to rtlwmbus (%s)\n", detected.specified_device.extras.c_str());
|
||||
}
|
||||
string ppm = "";
|
||||
if (extras.size() > 0)
|
||||
{
|
||||
if (extras.count("ppm") > 0)
|
||||
{
|
||||
ppm = string("-p ")+extras["ppm"];
|
||||
}
|
||||
}
|
||||
if (!serial_override)
|
||||
{
|
||||
id = indexFromRtlSdrSerial(identifier);
|
||||
|
@ -101,10 +116,13 @@ shared_ptr<WMBus> openRTLWMBUS(Detected detected,
|
|||
command = device.command;
|
||||
identifier = "cmd_"+to_string(device.index);
|
||||
}
|
||||
string freq = "868.95M";
|
||||
string freq = "868.625M";
|
||||
bool force_freq = false;
|
||||
if (device.fq != "")
|
||||
{
|
||||
freq = device.fq;
|
||||
// This will disable the listen to s1,t1 and c1 at the same time setting.
|
||||
force_freq = true;
|
||||
}
|
||||
string rtl_sdr;
|
||||
string rtl_wmbus;
|
||||
|
@ -138,7 +156,14 @@ shared_ptr<WMBus> openRTLWMBUS(Detected detected,
|
|||
}
|
||||
if (command == "")
|
||||
{
|
||||
command = rtl_sdr+" -d "+to_string(id)+" -f "+freq+" -s 1.6e6 - 2>/dev/null | "+rtl_wmbus;
|
||||
if (!force_freq)
|
||||
{
|
||||
command = rtl_sdr+" "+ppm+" -d "+to_string(id)+" -f "+freq+" -s 1.6e6 - 2>/dev/null | "+rtl_wmbus+" -s";
|
||||
}
|
||||
else
|
||||
{
|
||||
command = rtl_sdr+" "+ppm+" -d "+to_string(id)+" -f "+freq+" -s 1.6e6 - 2>/dev/null | "+rtl_wmbus;
|
||||
}
|
||||
}
|
||||
verbose("(rtlwmbus) using command: %s\n", command.c_str());
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue