gcgarner / IOTstack

docker stack for getting started on IOT on the Raspberry PI
GNU General Public License v3.0
1.5k stars 578 forks source link

Customisable rtl_433 Options #163

Closed JiriTywoniak closed 4 years ago

JiriTywoniak commented 4 years ago

I wish if rtl_433 (when running in Docker) would have customisable options. E.g. using additional ENV variable, like RTL_433_OPTIONS, that would be used in CMD, like CMD ["sh", "-c", "rtl_433 ${RTL_433_OPTIONS} -F ..."]

Three reasons:

  1. to limit "catch all" trafic by selecting only active protocols (and disabling others), e.g. -R 4 -R 141
  2. to enable protocols disabled by default, e.g. 14 is disabled by default
  3. to enable to add custom configuration files, like -c EV1527.conf. Such files could perhaps be in ~/IOTstack/services?

Many thanks in advance Jiri

JiriTywoniak commented 4 years ago

I apologize, putting simple options is easy. It is enough to modify the CMD in Dockerfile in rtl_433 service (~/IOTstack/services/rtl_433/Dockerfile) and run ./scripts/update.sh script in ~/IOTstack/. Like CMD ["sh", "-c", "rtl_433 -R 4 -R 14 -R 141 -F mqtt://${MQTT_ADDRESS}:${MQTT_PORT},events=${MQTT_TOPIC},user=${MQTT_USER},pass=${MQTT_PASSWORD}"]

Nevertheless, my attempt to add custom decoder ends up with: CMD ["sh", "-c", "rtl_433 -R 4 -R 14 -R 141 -X 'n=EV1527-Remote,m=OOK_PWM,s=369,l=1072,g=1400,r=12840,bits>=24,repeats>=3,invert,match={20}0x97F21,get=@0:{20}:code:[0x97F21:ATREA],get=@20:{4}:button:[1:A 2:B 3:AB 4:C 5:AC 6:BC 7:ABC 8:D 9:AD 10:BD 11:ABD 12:CD 13:ACD 14:BCD 15:ALL],unique' -F mqtt://${MQTT_ADDRESS}:${MQTT_PORT},events=${MQTT_TOPIC},user=${MQTT_USER},pass=${MQTT_PASSWORD}"]

Yes, it works, but I failed with my idea to make it more readable and maintainable using environment variable.

It coveres both my points 1 and 2. Now I have resigned on point 3. Jiri