10 cfg = config.services.prometheus.exporters.rtl_433;
24 description = "Name to match.";
26 "${field}" = lib.mkOption {
28 description = description;
30 location = lib.mkOption {
32 description = "Location to match.";
38 rtl433Flags = lib.mkOption {
41 example = "-C si -R 19";
43 Flags passed verbatim to rtl_433 binary.
44 Having `-C si` (the default) is recommended since only Celsius temperatures are parsed.
47 channels = lib.mkOption {
48 type = mkMatcherOptionType "channel" "Channel to match.";
58 List of channel matchers to export.
62 type = mkMatcherOptionType "id" "ID to match.";
72 List of ID matchers to export.
79 # rtl-sdr udev rules make supported USB devices +rw by plugdev.
80 SupplementaryGroups = "plugdev";
81 # rtl_433 needs rw access to the USB radio.
82 PrivateDevices = lib.mkForce false;
83 DeviceAllow = lib.mkForce "char-usb_device rw";
84 RestrictAddressFamilies = [ "AF_NETLINK" ];
89 (map (m: "--channel_matcher '${m.name},${toString m.channel},${m.location}'") cfg.channels)
90 ++ (map (m: "--id_matcher '${m.name},${toString m.id},${m.location}'") cfg.ids);
93 ${pkgs.prometheus-rtl_433-exporter}/bin/rtl_433_prometheus \
94 -listen ${cfg.listenAddress}:${toString cfg.port} \
95 -subprocess "${pkgs.rtl_433}/bin/rtl_433 -F json ${cfg.rtl433Flags}" \
96 ${lib.concatStringsSep " \\\n " matchers} \
97 ${lib.concatStringsSep " \\\n " cfg.extraFlags}