#!/bin/sh /etc/rc.common

START=90

USE_PROCD=1

PROG=/usr/bin/rtl_433

start_service() {
    config_load rtl_433

    local enabled
    config_get enabled rtl_433 enabled
    [ "$enabled" -gt 0 ] || return

    local flags
    config_get flags rtl_433 flags

    procd_open_instance
    config_list_foreach rtl_433 env "procd_append_param env"
    procd_set_param command $PROG $flags
    procd_set_param stdout 1
    procd_set_param stderr 1
    procd_close_instance
}

reload_service() {
    stop
    start
}

restart() {
    reload_service
}
