matthewwall / weewx-sdr

weewx driver for software-defined radio
GNU General Public License v3.0
115 stars 74 forks source link

Parser for TS-FT002 433 mhz water level gauge for WeeWx #70

Closed splobsterman closed 4 years ago

splobsterman commented 4 years ago

This gadget uses ultrasound to provide liquid level data but needs a parser to use with WeeWx.

rtl_433 sees it using: rtl_433 -R 125

Any pointers about how to do this? I took a look at sdr.py and it's well above my pay grade.

rtl_433 output:

time : 2019-12-22 16:57:58 model : TS-FT002 Id : 127 Depth : 186 Temperature: 20.9 C Transmit Interval: 180 Battery Flag?: 8 MIC : CHECKSUM

matthewwall commented 4 years ago

please run rtl_433 but with the JSON output. something like this:

rtl_433 -M utc -R 125 -F json

then post some of the resulting output. 5 or 10 samples should be enough.

splobsterman commented 4 years ago

Matthew,

With thanks:

{"time" : "2019-12-22 22:54:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 22:54:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 22:57:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 22:57:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:00:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:00:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:03:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:03:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:06:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:06:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:09:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:09:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:12:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:12:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:15:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:15:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:18:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:18:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:21:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:21:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:24:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"} {"time" : "2019-12-22 23:24:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 186, "temperature_C" : 20.700, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"}

On 22Dec, 2019, at 17:29, Matthew Wall notifications@github.com wrote:

please run rtl_433 but with the JSON output. something like this:

rtl_433 -M utc -R 125 -F JSON then post some of the resulting output. 5 or 10 samples should be enough.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/matthewwall/weewx-sdr/issues/70?email_source=notifications&email_token=AHGMYVHP5MEUZI5QEZZ5TZDQZ7S4JA5CNFSM4J6NWHFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHP3EUA#issuecomment-568308304, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHGMYVDT7K557REDXDQMCR3QZ7S4JANCNFSM4J6NWHFA.

matthewwall commented 4 years ago

please try weewx-sdr as of commit fe08ccc

splobsterman commented 4 years ago

Matthew,

The parser works but with an odd result:

Running sudo PYTHONPATH=bin python bin/user/sdr.py --cmd="rtl_433 -M utc -F json -G”:

out:[u'{"time" : "2019-12-23 17:25:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 62, "temperature_C" : 26.400, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"}\n', u'{"time" : "2019-12-23 17:25:58", "model" : "TS-FT002", "id" : 127, "depth_cm" : 62, "temperature_C" : 26.400, "transmit_s" : 180, "flags" : 8, "mic" : "CHECKSUM"}\n'] parsed: {'transmit.0000.TSFT002Packet': 180.0, 'dateTime': 1577121958, 'flags.0000.TSFT002Packet': 180, 'temperature.0000.TSFT002Packet': 26.4, 'depth.0000.TSFT002Packet': 62.0, 'usUnits': 16}

So I added 'depth.0000.TSFT002Packet’ to my SDR sensor map:

[SDR]

This section is for the software-defined radio driver.

# The driver to use
driver = user.sdr
log_unknown_sensors = True
log_unmapped_sensors = True
[[sensor_map]]
    extraTemp2 = temperature.1:215.AmbientF007THPacket          # pool temperature
    extraTemp3 = temperature.001A.AcuriteLightningPacket            # temp at lightning detector
    soilTemp1 = strikes_total.001A.AcuriteLightningPacket           # total strikes
    soilTemp2 = distance.001A.AcuriteLightningPacket                # strike distance
    leafTemp1 = depth.0000.TSFT002Packet                    # depth in cm tank level

and when I run sir.conf, it transmits this to the sdr.sdb:

LOOP: 2019-12-23 13:49:58 EST (1577126998) dateTime: 1577126998, leafTemp1: 147.2, maxSolarRad: 574.533540052, rainRate: 0, usUnits: 1

I am unsure how the 62 CM (I’ve checked it with my metric tape) gets transformed to 147.2. Have I mis-configured something?

Regards, and best wishes for the holidays.

On 22Dec, 2019, at 20:30, Matthew Wall notifications@github.com wrote:

please try weewx-sdr as of commit fe08ccc https://github.com/matthewwall/weewx-sdr/commit/fe08ccc2f281567bdfa14ae3e01859aebc67ded0 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/matthewwall/weewx-sdr/issues/70?email_source=notifications&email_token=AHGMYVATT4IYH5PPCNOWUFLQ2AIDBA5CNFSM4J6NWHFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHP7COY#issuecomment-568324411, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHGMYVGCNWUT2S2543Z3R2LQ2AIDBANCNFSM4J6NWHFA.

matthewwall commented 4 years ago

you need to tell weewx what units to use. in its default configuration, leaftTemp1 is temperature, not length.

put this into the file user/extensions.py then restart weewx. also, be sure to clear the old data.

import weewx.units
weewx.units.USUnits['group_range'] = 'inch'
weewx.units.MetricUnits['group_range'] = 'cm'
weewx.units.MetricWXUnits['group_range'] = 'cm'
weewx.units.obs_group_dict['leafTemp1'] = 'group_range’
splobsterman commented 4 years ago

Thank you Matthew, most helpful.

On 24Dec, 2019, at 20:23, Matthew Wall notifications@github.com wrote:

you need to tell weewx what units to use. in its default configuration, leaftTemp1 is temperature, not length.

put this into the file user/extensions.py then restart weewx. also, be sure to clear the old data.

import weewx.units weewx.units.USUnits['group_range'] = 'inch' weewx.units.MetricUnits['group_range'] = 'cm' weewx.units.MetricWXUnits['group_range'] = 'cm' weewx.units.obs_group_dict['leafTemp1'] = 'group_range’ — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/matthewwall/weewx-sdr/issues/70?email_source=notifications&email_token=AHGMYVG37OIENYDR2MIVSCDQ2KYXLA5CNFSM4J6NWHFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHTXPTA#issuecomment-568817612, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHGMYVDTX3YXRH7E4UGEWCTQ2KYXLANCNFSM4J6NWHFA.