Skip to content

Commit

Permalink
Merge branch 'master' into tfa-14-1504
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-bourquard authored Jan 21, 2023
2 parents d145440 + e37fc5d commit 7e49f26
Show file tree
Hide file tree
Showing 17 changed files with 923 additions and 52 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
[-w <filename> | help] Save data stream to output file (a '-' dumps samples to stdout)
[-W <filename> | help] Save data stream to output file, overwrite existing file
= Data output options =
[-F kv | json | csv | mqtt | influx | syslog | trigger | null | help] Produce decoded output in given format.
[-F log | kv | json | csv | mqtt | influx | syslog | trigger | null | help] Produce decoded output in given format.
Append output to file with :<filename> (e.g. -F csv:log.csv), defaults to stdout.
Specify host/port for syslog with e.g. -F syslog:127.0.0.1:1514
[-M time[:<options>] | protocol | level | noise[:<secs>] | stats | bits | help] Add various meta data to each output.
Expand Down Expand Up @@ -306,7 +306,10 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
[221] Fine Offset Electronics WN34 temperature sensor
[222] Rubicson Pool Thermometer 48942
[223] Badger ORION water meter, 100kbps (-f 916450000 -s 1200000)
[224] TFA Dostmann 14.1504.V2 Radio-controlled grill and meat thermometer
[224] GEO minim+ energy monitor
[225] TyreGuard 400 TPMS
[226] Kia TPMS (-s 1M)
[227] TFA Dostmann 14.1504.V2 Radio-controlled grill and meat thermometer
* Disabled by default, use -R n or a conf file to enable
Expand Down Expand Up @@ -393,8 +396,8 @@ E.g. -X "n=doorbell,m=OOK_PWM,s=400,l=800,r=7000,g=1000,match={24}0xa9878c,repea
= Output format option =
[-F kv|json|csv|mqtt|influx|syslog|trigger|null] Produce decoded output in given format.
Without this option the default is KV output. Use "-F null" to remove the default.
[-F log|kv|json|csv|mqtt|influx|syslog|trigger|null] Produce decoded output in given format.
Without this option the default is LOG and KV output. Use "-F null" to remove the default.
Append output to file with :<filename> (e.g. -F csv:log.csv), defaults to stdout.
Specify MQTT server with e.g. -F mqtt://localhost:1883
Add MQTT options with e.g. -F "mqtt://host:1883,opt=arg"
Expand Down
39 changes: 39 additions & 0 deletions conf/elro_ab440r.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# ELRO AB440R remote control.

# Remote switch to turn on or off power sockets.
# The remote control has 8 buttons to control 4 sockets (on and off button)
# and 5 dip switches to dial in a unique local channel (0-31)
#
# User manual: https://www.libble.eu/elro-ab440-series/online-manual-313854/
#
# Payload format:
#
# 1C1C1C1C1C 1B1B1B1B 10 1S1S 10000000
#
# CCCCC: 5 bit channel number (reversed)
# BBBB: 1000 = button A
# 0100 = button B
# 0010 = button C
# 0001 = button D
# SS: 10 = ON
# 01 = OFF
#
# Test:
# rtl_433 -c conf/elro_ab440r.conf -y '{25}bbabae8'
#

decoder {
name=ELRO-AB440R,
modulation=OOK_PWM,
short=330,
long=970,
gap=1200,
reset=9000,
bits=25,
symbol_zero={2}8,
symbol_one={2}c,
get=@0:{5}:channel,
get=@5:{4}:button:[8:A 4:B 2:C 1:D],
get=@10:{2}:toggle:[2:ON 1:OFF],
unique
}
5 changes: 4 additions & 1 deletion conf/rtl_433.example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,10 @@ stop_after_successful_events false
protocol 221 # Fine Offset Electronics WN34 temperature sensor
protocol 222 # Rubicson Pool Thermometer 48942
protocol 223 # Badger ORION water meter, 100kbps (-f 916450000 -s 1200000)
protocol 224 # TFA Dostmann 14.1504.V2 Radio-controlled grill and meat thermometer
protocol 224 # GEO minim+ energy monitor
protocol 225 # TyreGuard 400 TPMS
protocol 226 # Kia TPMS (-s 1M)
protocol 227 # TFA Dostmann 14.1504.V2 Radio-controlled grill and meat thermometer

## Flex devices (command line option "-X")

Expand Down
52 changes: 52 additions & 0 deletions conf/tyreguard400.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# TYREGUARD400 from DAVIES CRAIG
#
# https://daviescraig.com.au/product/tyreguard-400-tpms-4-sensors-kit-1015
#
# - Type : TPMS
# - Freq : 434.1 MHz
# - Modulation : ASK -> OOK_MC_ZEROBIT (Manchester Code with fixed leading zero bit)
# - Sambol duration : 100us (same for l or 0)
# - Length : 22 bytes long
#
# Packet layout:
#
# bytes : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# coded : S/P S/P S/P S/P S/P S/P S/P ID ID ID ID ID ID ID Pr Pr Temp Temp Flg Flg CRC CRC
#
# - S/P : preamble/sync "0xfd5fd5f" << always fixed
# - ID : 6 bytes long start with 0x6b????? ex 0x6b20d21
# - Pr : Last 2 bytes of pressure in psi ex : 0xe8 means XX232 psi (for XX see flags bytes)
# - Temp : Temperature in °C offset by +40 ex : 0x2f means (47-40)=+7°C
# - Flg : Flags bytes => should be read in binary format :
# - Bit 73 : Unknown ; maybe the 20th MSB pressure bit? The sensor is not capable to reach this so high pressure
# - Bit 74 : add 1024 psi (19th MSB pressure bit)
# - Bit 75 : add 512 psi (18th MSB pressure bit)
# - Bit 76 : add 256 psi (17th MSB pressure bit)
# - Bit 77 : Acknoldge pressure leaking 1=Ack 0=No_ack (nothing to report)
# - Bit 78 : Unknown
# - Bit 79 : Leaking pressure detected 1=Leak 0=No leak (nothing to report)
# - Bit 80 : Leaking pressure detected 1=Leak 0=No leak (nothing to report)
# - CRC : CRC poly 0x31 start value 0xdd final 0x00 from 1st bit 80th bits
#
# To peer a new sensor to the unit, bit 79 and 80 has to be both to 1.
#
# NOTE: In the datasheet, it is said that the sensor can report low batterie. During my tests/reseach i'm not able to see this behavior. I have fuzzed all bits nothing was reported to the reader.
#

decoder {
name = TPMS-TYREGUARD400,
modulation = OOK_MC_ZEROBIT,
short = 100,
long = 100,
gap = 0,
reset = 500,
preamble = fd5fd5f,
get = id:@0:{28},
get = pression:@57:{8},
get = temp:@65:{8},
get = flags:@73:{8},
get = add_psi:@74:{3}:[0:no 1:256 2:512 3:768 4:1024 5:1280 6:1536 7:1792],
get = AckLeaking:@77:{1}:[1: yes 0:no],
get = Leaking_detected:@79:{2}:[0:no 1:yes 2:yes],
get = CRC:@81:{8},
}
46 changes: 46 additions & 0 deletions examples/rtl_433_mqtt_hass.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,42 @@
"state_class": "measurement"
}
},

"energy_kWh": {
"device_type": "sensor",
"object_suffix": "kwh",
"config": {
"device_class": "power",
"name": "Energy",
"unit_of_measurement": "kWh",
"value_template": "{{ value|float }}",
"state_class": "measurement"
}
},

"current_A": {
"device_type": "sensor",
"object_suffix": "A",
"config": {
"device_class": "power",
"name": "Current",
"unit_of_measurement": "A",
"value_template": "{{ value|float }}",
"state_class": "measurement"
}
},

"voltage_V": {
"device_type": "sensor",
"object_suffix": "V",
"config": {
"device_class": "power",
"name": "Voltage",
"unit_of_measurement": "V",
"value_template": "{{ value|float }}",
"state_class": "measurement"
}
},

"light_lux": {
"device_type": "sensor",
Expand Down Expand Up @@ -556,6 +592,16 @@
"state_class": "total_increasing",
}
},

"consumption": {
"device_type": "sensor",
"object_suffix": "consumption",
"config": {
"name": "SCMplus Consumption Value",
"value_template": "{{ value|int }}",
"state_class": "total_increasing",
}
},

"channel": {
"device_type": "device_automation",
Expand Down
2 changes: 2 additions & 0 deletions include/mongoose.h
Original file line number Diff line number Diff line change
Expand Up @@ -4657,7 +4657,9 @@ size_t mg_fwrite(const void *ptr, size_t size, size_t count, FILE *f);
#endif /* MG_ENABLE_FILESYSTEM */

#if MG_ENABLE_THREADS
#if CS_PLATFORM == CS_P_UNIX
#include <pthread.h>
#endif
/*
* Starts a new detached thread.
* Arguments and semantics are the same as pthead's `pthread_create()`.
Expand Down
3 changes: 3 additions & 0 deletions include/rtl_433_devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@
DECL(fineoffset_wn34) \
DECL(rubicson_pool_48942) \
DECL(badger_orion) \
DECL(geo_minim) \
DECL(tpms_tyreguard400) \
DECL(tpms_kia) \
DECL(tfa_14_1504_v2) \

/* Add new decoders here. */
Expand Down
6 changes: 3 additions & 3 deletions man/man1/rtl_433.1
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Save data stream to output file (a '\-' dumps samples to stdout)
Save data stream to output file, overwrite existing file
.SS "Data output options"
.TP
[ \fB\-F\fI kv | json | csv | mqtt | influx | syslog | trigger | null | help\fP ]
[ \fB\-F\fI log | kv | json | csv | mqtt | influx | syslog | trigger | null | help\fP ]
Produce decoded output in given format.
Append output to file with :<filename> (e.g. \-F csv:log.csv), defaults to stdout.
Specify host/port for syslog with e.g. \-F syslog:127.0.0.1:1514
Expand Down Expand Up @@ -321,10 +321,10 @@ countonly : suppress detailed row output
E.g. \-X "n=doorbell,m=OOK_PWM,s=400,l=800,r=7000,g=1000,match={24}0xa9878c,repeats>=3"
.SS "Output format option"
.TP
[ \fB\-F\fI kv|json|csv|mqtt|influx|syslog|trigger|null\fP ]
[ \fB\-F\fI log|kv|json|csv|mqtt|influx|syslog|trigger|null\fP ]
Produce decoded output in given format.
.RS
Without this option the default is KV output. Use "\-F null" to remove the default.
Without this option the default is LOG and KV output. Use "\-F null" to remove the default.
.RE
.RS
Append output to file with :<filename> (e.g. \-F csv:log.csv), defaults to stdout.
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ add_library(r_433 STATIC
devices/generic_motion.c
devices/generic_remote.c
devices/generic_temperature_sensor.c
devices/geo_minim.c
devices/govee.c
devices/gt_tmbbq05.c
devices/gt_wt_02.c
Expand Down Expand Up @@ -221,12 +222,14 @@ add_library(r_433 STATIC
devices/tpms_hyundai_vdo.c
devices/tpms_jansite.c
devices/tpms_jansite_solar.c
devices/tpms_kia.c
devices/tpms_pmv107j.c
devices/tpms_porsche.c
devices/tpms_renault.c
devices/tpms_renault_0435r.c
devices/tpms_toyota.c
devices/tpms_truck.c
devices/tpms_tyreguard400.c
devices/ts_ft002.c
devices/ttx201.c
devices/vaillant_vrt340f.c
Expand Down
6 changes: 3 additions & 3 deletions src/devices/bresser_5in1.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Packet payload without preamble (203 bits):
ef a1 ff ff 1f ff ef dc ff de df ff 7f 10 5e 00 00 e0 00 10 23 00 21 20 00 80 00 00 (low batt +ve temp)
ed a1 ff ff 1f ff ef 8f ff d6 df ff 77 12 5e 00 00 e0 00 10 70 00 29 20 00 88 00 00 (low batt -ve temp -7.0C)
ec 91 ff ff 1f fb ef e7 fe ad ed ff f7 13 6e 00 00 e0 04 10 18 01 52 12 00 08 00 00 (good batt -ve temp)
CC CC CC CC CC CC CC CC CC CC CC CC CC uu II SS GG DG WW W TT T HH RR R Bt
CC CC CC CC CC CC CC CC CC CC CC CC CC uu II SS GG DG WW W TT T HH RR RR Bt
G-MSB ^ ^ W-MSB (strange but consistent order)
- C = Check, inverted data of 13 byte further
Expand All @@ -54,7 +54,7 @@ Packet payload without preamble (203 bits):
- T = temperature in 1/10 °C, BCD coded, TTxT = 1203 => 31.2 °C
- t = temperature sign, minus if unequal 0
- H = humidity in percent, BCD coded, HH = 23 => 23 %
- R = rain in mm, BCD coded, RRxR = 1203 => 31.2 mm
- R = rain in mm, BCD coded, RRRR = 1203 => 031.2 mm
- B = Battery. 0=Ok, 8=Low.
- S = sensor type, only low nibble used, 0x9 for Bresser Professional Rain Gauge
*/
Expand Down Expand Up @@ -120,7 +120,7 @@ static int bresser_5in1_decode(r_device *decoder, bitbuffer_t *bitbuffer)
int wind_raw = (msg[18] & 0x0f) + ((msg[18] & 0xf0) >> 4) * 10 + (msg[19] & 0x0f) * 100; //fix merbanan/rtl_433#1315
float wind_avg = wind_raw * 0.1f;

int rain_raw = (msg[23] & 0x0f) + ((msg[23] & 0xf0) >> 4) * 10 + (msg[24] & 0x0f) * 100;
int rain_raw = (msg[23] & 0x0f) + ((msg[23] & 0xf0) >> 4) * 10 + (msg[24] & 0x0f) * 100 + ((msg[24] & 0xf0) >> 4) * 1000;
float rain = rain_raw * 0.1f;

int battery_low = (msg[25] & 0x80);
Expand Down
9 changes: 7 additions & 2 deletions src/devices/cotech_36_7959.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Also: SwitchDoc Labs Weather FT020T.
Also: Sainlogic Weather Station WS019T
Also: Sainlogic Weather Station FT0300
Also: Ragova WiFi Weather Station FT-0310
Also: NicetyMeter Weather Station 0366 (without Lux or UV index)
OOK modulated with Manchester encoding, halfbit-width 500 us.
Message length is 112 bit, every second time it will transmit two identical messages, packet gap 5400 us.
Expand Down Expand Up @@ -46,6 +47,7 @@ Message layout
- X : 8 bit: CRC, poly 0x31, init 0xc0
*/

#include <stdbool.h>
#include "decoder.h"

static int cotech_36_7959_decode(r_device *decoder, bitbuffer_t *bitbuffer)
Expand Down Expand Up @@ -106,6 +108,9 @@ static int cotech_36_7959_decode(r_device *decoder, bitbuffer_t *bitbuffer)

float temp_c = (temp_raw - 400) * 0.1f;

// On models without a light sensor, the value read for UV index is out of bounds with its top bits set
bool light_is_valid = ((uv & 0xf0) == 0);

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, "Cotech-367959",
Expand All @@ -118,8 +123,8 @@ static int cotech_36_7959_decode(r_device *decoder, bitbuffer_t *bitbuffer)
"wind_dir_deg", "Wind direction", DATA_INT, wind_dir,
"wind_avg_m_s", "Wind", DATA_FORMAT, "%.1f m/s", DATA_DOUBLE, wind * 0.1f,
"wind_max_m_s", "Gust", DATA_FORMAT, "%.1f m/s", DATA_DOUBLE, gust * 0.1f,
"light_lux", "Light Intensity", DATA_FORMAT, "%u lux", DATA_INT, light_lux,
"uv", "UV Index", DATA_FORMAT, "%u", DATA_INT, uv,
"light_lux", "Light Intensity", DATA_COND, light_is_valid, DATA_FORMAT, "%u lux", DATA_INT, light_lux,
"uv", "UV Index", DATA_COND, light_is_valid, DATA_FORMAT, "%u", DATA_INT, uv,
"mic", "Integrity", DATA_STRING, "CRC",
NULL);
/* clang-format on */
Expand Down
Loading

0 comments on commit 7e49f26

Please sign in to comment.