void arctechSrOldInit(void) { protocol_register(&arctech_screen_old); protocol_set_id(arctech_screen_old, "arctech_screens_old"); protocol_device_add(arctech_screen_old, "kaku_screen_old", "Old KlikAanKlikUit Screens"); protocol_conflict_add(arctech_screen_old, "arctech_switches_old"); protocol_plslen_add(arctech_screen_old, 336); arctech_screen_old->devtype = SCREEN; arctech_screen_old->hwtype = RF433; arctech_screen_old->pulse = 3; arctech_screen_old->rawlen = 50; arctech_screen_old->binlen = 12; arctech_screen_old->lsb = 2; options_add(&arctech_screen_old->options, 't', "up", OPTION_NO_VALUE, CONFIG_STATE, JSON_STRING, NULL, NULL); options_add(&arctech_screen_old->options, 'f', "down", OPTION_NO_VALUE, CONFIG_STATE, JSON_STRING, NULL, NULL); options_add(&arctech_screen_old->options, 'u', "unit", OPTION_HAS_VALUE, CONFIG_ID, JSON_NUMBER, NULL, "^([0-9]{1}|[1][0-5])$"); options_add(&arctech_screen_old->options, 'i', "id", OPTION_HAS_VALUE, CONFIG_ID, JSON_NUMBER, NULL, "^(3[012]?|[012][0-9]|[0-9]{1})$"); options_add(&arctech_screen_old->options, 0, "gui-readonly", OPTION_HAS_VALUE, CONFIG_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); arctech_screen_old->parseBinary=&arctechSrOldParseBinary; arctech_screen_old->createCode=&arctechSrOldCreateCode; arctech_screen_old->printHelp=&arctechSrOldPrintHelp; }
void arctechSwOldInit(void) { protocol_register(&arctech_switch_old); protocol_set_id(arctech_switch_old, "arctech_switch_old"); protocol_device_add(arctech_switch_old, "kaku_switch_old", "Old KlikAanKlikUit Switches"); protocol_device_add(arctech_switch_old, "cogex", "Cogex Switches"); protocol_device_add(arctech_switch_old, "intertechno_old", "Old Intertechno Switches"); protocol_device_add(arctech_switch_old, "byebyestandbye", "Bye Bye Standbye Switches"); protocol_device_add(arctech_switch_old, "duwi", "Düwi Terminal Switches"); protocol_device_add(arctech_switch_old, "eurodomest", "Eurodomest Switches"); protocol_plslen_add(arctech_switch_old, 336); protocol_plslen_add(arctech_switch_old, 326); protocol_plslen_add(arctech_switch_old, 390); protocol_plslen_add(arctech_switch_old, 400); protocol_plslen_add(arctech_switch_old, 330); arctech_switch_old->devtype = SWITCH; arctech_switch_old->hwtype = RF433; arctech_switch_old->pulse = 3; arctech_switch_old->rawlen = 50; arctech_switch_old->binlen = 12; arctech_switch_old->lsb = 2; options_add(&arctech_switch_old->options, 't', "on", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&arctech_switch_old->options, 'f', "off", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&arctech_switch_old->options, 'u', "unit", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([0-9]{1}|[1][0-5])$"); options_add(&arctech_switch_old->options, 'i', "id", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^(3[012]?|[012][0-9]|[0-9]{1})$"); options_add(&arctech_switch_old->options, 0, "readonly", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); arctech_switch_old->parseBinary=&arctechSwOldParseBinary; arctech_switch_old->createCode=&arctechSwOldCreateCode; arctech_switch_old->printHelp=&arctechSwOldPrintHelp; }
void impulsInit(void) { protocol_register(&impuls); impuls->id = malloc(7); strcpy(impuls->id, "impuls"); protocol_add_device(impuls, "impuls", "Impuls Switches"); protocol_add_device(impuls, "select-remote", "SelectRemote Switches"); impuls->type = SWITCH; impuls->pulse = 3; impuls->footer = 33; impuls->rawLength = 50; //impuls->binLength = 12; //impuls->lsb = 1; /*impuls->bit = 0; impuls->recording = 0;*/ options_add(&impuls->options, 's', "systemcode", has_value, config_id, "^(3[012]?|[012][0-9]|[0-9]{1})$"); options_add(&impuls->options, 'u', "programcode", has_value, config_id, "^(3[012]?|[012][0-9]|[0-9]{1})$"); options_add(&impuls->options, 't', "on", no_value, config_state, NULL); options_add(&impuls->options, 'f', "off", no_value, config_state, NULL); //impuls->parseCode=&impulsParseCode; impuls->createCode=&impulsCreateCode; impuls->printHelp=&impulsPrintHelp; }
void clarusSwInit(void) { protocol_register(&clarus_switch); protocol_set_id(clarus_switch, "clarus_switch"); protocol_device_add(clarus_switch, "clarus_switch", "Clarus Switches"); protocol_conflict_add(clarus_switch, "rev_switch"); protocol_plslen_add(clarus_switch, 190); protocol_plslen_add(clarus_switch, 180); clarus_switch->devtype = SWITCH; clarus_switch->hwtype = RF433; clarus_switch->pulse = 3; clarus_switch->rawlen = 50; clarus_switch->binlen = 12; options_add(&clarus_switch->options, 't', "on", OPTION_NO_VALUE, CONFIG_STATE, JSON_STRING, NULL, NULL); options_add(&clarus_switch->options, 'f', "off", OPTION_NO_VALUE, CONFIG_STATE, JSON_STRING, NULL, NULL); options_add(&clarus_switch->options, 'u', "unit", OPTION_HAS_VALUE, CONFIG_ID, JSON_NUMBER, NULL, "^([0-9]|[1-5][0-9]|6[0-3])$"); options_add(&clarus_switch->options, 'i', "id", OPTION_HAS_VALUE, CONFIG_ID, JSON_STRING, NULL, "^[ABCDEF](3[012]?|[012][0-9]|[0-9]{1})$"); options_add(&clarus_switch->options, 0, "gui-readonly", OPTION_HAS_VALUE, CONFIG_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); clarus_switch->parseCode=&clarusSwParseCode; clarus_switch->createCode=&clarusSwCreateCode; clarus_switch->printHelp=&clarusSwPrintHelp; }
void sartanoInit(void) { strcpy(sartano.id, "sartano"); protocol_add_device(&sartano, "elro", "Elro Switches"); protocol_add_conflict(&sartano, "arctech_old"); protocol_add_conflict(&sartano, "impuls"); sartano.type = SWITCH; sartano.pulse = 4; sartano.footer = 38; sartano.rawLength = 50; sartano.binLength = 12; sartano.message = malloc(sizeof(JsonNode)); sartano.bit = 0; sartano.recording = 0; options_add(&sartano.options, 't', "on", no_value, config_state, NULL); options_add(&sartano.options, 'f', "off", no_value, config_state, NULL); options_add(&sartano.options, 'u', "unit", has_value, config_id, "^(3[012]?|[012][0-9]|[0-9]{1})$"); options_add(&sartano.options, 'i', "id", has_value, config_id, "^(3[012]?|[012][0-9]|[0-9]{1})$"); sartano.parseBinary=&sartanoParseBinary; sartano.createCode=&sartanoCreateCode; sartano.printHelp=&sartanoPrintHelp; protocol_register(&sartano); }
void arctechSwInit(void) { protocol_register(&arctech_switch); arctech_switch->id = malloc(18); strcpy(arctech_switch->id, "archtech_switches"); protocol_add_device(arctech_switch, "kaku_switch", "KlikAanKlikUit Switches"); protocol_add_device(arctech_switch, "dio_switch", "D-IO (Chacon) Switches"); protocol_add_device(arctech_switch, "nexa_switch", "Nexa Switches"); protocol_add_device(arctech_switch, "coco_switch", "CoCo Technologies Switches"); protocol_add_device(arctech_switch, "intertechno_switch", "Intertechno Switches"); protocol_add_conflict(arctech_switch, "archtech_dimmers"); arctech_switch->type = SWITCH; arctech_switch->header = 9; arctech_switch->pulse = 5; arctech_switch->footer = 35; arctech_switch->rawLength = 132; arctech_switch->lsb = 3; arctech_switch->bit = 0; arctech_switch->recording = 0; options_add(&arctech_switch->options, 'a', "all", no_value, 0, NULL); options_add(&arctech_switch->options, 't', "on", no_value, config_state, NULL); options_add(&arctech_switch->options, 'f', "off", no_value, config_state, NULL); options_add(&arctech_switch->options, 'u', "unit", has_value, config_id, "^([0-9]{1}|[1][0-5])$"); options_add(&arctech_switch->options, 'i', "id", has_value, config_id, "^([0-9]{1,7}|[1-5][0-9]{7}|6([0-6][0-9]{6}|7(0[0-9]{5}|10([0-7][0-9]{3}|8([0-7][0-9]{2}|8([0-5][0-9]|6[0-3]))))))$"); arctech_switch->parseBinary=&arctechSwParseBinary; arctech_switch->createCode=&arctechSwCreateCode; arctech_switch->printHelp=&arctechSwPrintHelp; }
void homeEasyOldInit(void) { protocol_register(&home_easy_old); protocol_set_id(home_easy_old, "home_easy_old"); protocol_device_add(home_easy_old, "home_easy_old", "Old Home Easy Switches"); protocol_plslen_add(home_easy_old, 289); home_easy_old->devtype = SWITCH; home_easy_old->hwtype = RF433; home_easy_old->pulse = 3; home_easy_old->rawlen = 50; home_easy_old->binlen = 12; home_easy_old->lsb = 3; options_add(&home_easy_old->options, 's', "systemcode", has_value, config_id, "^(3[012]?|[012][0-9]|[0-9]{1})$"); options_add(&home_easy_old->options, 'u', "unitcode", has_value, config_id, "^(3[012]?|[012][0-9]|[0-9]{1})$"); options_add(&home_easy_old->options, 'a', "all", no_value, config_state, NULL); options_add(&home_easy_old->options, 't', "on", no_value, config_state, NULL); options_add(&home_easy_old->options, 'f', "off", no_value, config_state, NULL); protocol_setting_add_string(home_easy_old, "states", "on,off"); protocol_setting_add_number(home_easy_old, "readonly", 0); home_easy_old->parseBinary=&homeEasyOldParseBinary; home_easy_old->createCode=&homeEasyOldCreateCode; home_easy_old->printHelp=&homeEasyOldPrintHelp; }
void arctechSwInit(void) { protocol_register(&arctech_switch); protocol_set_id(arctech_switch, "archtech_switches"); protocol_device_add(arctech_switch, "kaku_switch", "KlikAanKlikUit Switches"); protocol_device_add(arctech_switch, "dio_switch", "D-IO (Chacon) Switches"); protocol_device_add(arctech_switch, "nexa_switch", "Nexa Switches"); protocol_device_add(arctech_switch, "coco_switch", "CoCo Technologies Switches"); protocol_device_add(arctech_switch, "intertechno_switch", "Intertechno Switches"); protocol_conflict_add(arctech_switch, "archtech_screens"); protocol_plslen_add(arctech_switch, 303); protocol_plslen_add(arctech_switch, 251); arctech_switch->devtype = SWITCH; arctech_switch->hwtype = RX433; arctech_switch->pulse = 5; arctech_switch->rawlen = 132; arctech_switch->lsb = 3; options_add(&arctech_switch->options, 'a', "all", no_value, 0, NULL); options_add(&arctech_switch->options, 't', "on", no_value, config_state, NULL); options_add(&arctech_switch->options, 'f', "off", no_value, config_state, NULL); options_add(&arctech_switch->options, 'u', "unit", has_value, config_id, "^([0-9]{1}|[1][0-5])$"); options_add(&arctech_switch->options, 'i', "id", has_value, config_id, "^([0-9]{1,7}|[1-5][0-9]{7}|6([0-6][0-9]{6}|7(0[0-9]{5}|10([0-7][0-9]{3}|8([0-7][0-9]{2}|8([0-5][0-9]|6[0-3]))))))$"); protocol_setting_add_string(arctech_switch, "states", "on,off"); protocol_setting_add_number(arctech_switch, "readonly", 0); arctech_switch->parseBinary=&arctechSwParseBinary; arctech_switch->createCode=&arctechSwCreateCode; arctech_switch->printHelp=&arctechSwPrintHelp; }
void impulsInit(void) { protocol_register(&impuls); protocol_set_id(impuls, "impuls"); protocol_device_add(impuls, "impuls", "Impuls Switches"); protocol_device_add(impuls, "select-remote", "SelectRemote Switches"); protocol_plslen_add(impuls, 133); impuls->devtype = SWITCH; impuls->hwtype = RX433; impuls->pulse = 3; impuls->rawlen = 50; impuls->binlen = 12; options_add(&impuls->options, 's', "systemcode", has_value, config_id, "^(3[012]?|[012][0-9]|[0-9]{1})$"); options_add(&impuls->options, 'u', "programcode", has_value, config_id, "^(3[012]?|[012][0-9]|[0-9]{1})$"); options_add(&impuls->options, 't', "on", no_value, config_state, NULL); options_add(&impuls->options, 'f', "off", no_value, config_state, NULL); protocol_setting_add_string(impuls, "states", "on,off"); protocol_setting_add_number(impuls, "readonly", 0); impuls->parseCode=&impulsParseCode; impuls->createCode=&impulsCreateCode; impuls->printHelp=&impulsPrintHelp; }
void actionDimInit(void) { event_action_register(&action_dim, "dim"); options_add(&action_dim->options, 'a', "DEVICE", OPTION_HAS_VALUE, DEVICES_VALUE, JSON_STRING, NULL, NULL); options_add(&action_dim->options, 'b', "TO", OPTION_HAS_VALUE, DEVICES_VALUE, JSON_NUMBER, NULL, NULL); action_dim->run = &actionDimRun; action_dim->checkArguments = &actionDimArguments; }
void dht22Init(void) { pthread_mutexattr_init(&dht22attr); pthread_mutexattr_settype(&dht22attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&dht22lock, &dht22attr); protocol_register(&dht22); protocol_set_id(dht22, "dht22"); protocol_device_add(dht22, "dht22", "1-wire Temperature and Humidity Sensor"); protocol_device_add(dht22, "am2302", "1-wire Temperature and Humidity Sensor"); dht22->devtype = WEATHER; dht22->hwtype = SENSOR; options_add(&dht22->options, 't', "temperature", OPTION_HAS_VALUE, DEVICES_VALUE, JSON_NUMBER, NULL, "^[0-9]{1,3}$"); options_add(&dht22->options, 'h', "humidity", OPTION_HAS_VALUE, DEVICES_VALUE, JSON_NUMBER, NULL, "^[0-9]{1,3}$"); options_add(&dht22->options, 'g', "gpio", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([0-9]{1}|1[0-9]|20)$"); // options_add(&dht22->options, 0, "decimals", OPTION_HAS_VALUE, DEVICES_SETTING, JSON_NUMBER, (void *)1, "[0-9]"); options_add(&dht22->options, 0, "temperature-offset", OPTION_HAS_VALUE, DEVICES_SETTING, JSON_NUMBER, (void *)0, "[0-9]"); options_add(&dht22->options, 0, "humidity-offset", OPTION_HAS_VALUE, DEVICES_SETTING, JSON_NUMBER, (void *)0, "[0-9]"); options_add(&dht22->options, 0, "decimals", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)1, "[0-9]"); options_add(&dht22->options, 0, "show-temperature", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)1, "^[10]{1}$"); options_add(&dht22->options, 0, "show-humidity", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)1, "^[10]{1}$"); options_add(&dht22->options, 0, "poll-interval", OPTION_HAS_VALUE, DEVICES_SETTING, JSON_NUMBER, (void *)10, "[0-9]"); dht22->initDev=&dht22InitDev; dht22->threadGC=&dht22ThreadGC; }
void ninjablocksWeatherInit(void) { protocol_register(&ninjablocks_weather); protocol_set_id(ninjablocks_weather, "ninjablocks_weather"); protocol_device_add(ninjablocks_weather, "ninjablocks_weather", "Ninjablocks Weather Sensors"); ninjablocks_weather->devtype = WEATHER; ninjablocks_weather->hwtype = RF433; ninjablocks_weather->minrawlen = MIN_RAW_LENGTH; ninjablocks_weather->maxrawlen = MAX_RAW_LENGTH; ninjablocks_weather->mingaplen = MIN_PULSE_LENGTH*PULSE_DIV; ninjablocks_weather->maxgaplen = MAX_PULSE_LENGTH*PULSE_DIV; // sync-id[4]; Homecode[4], Channel Code[2], Sync[3], Humidity[7], Temperature[15], Footer [1] options_add(&ninjablocks_weather->options, 'u', "unit", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([0-9]|1[0-5])$"); options_add(&ninjablocks_weather->options, 'i', "id", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([0-3])$"); options_add(&ninjablocks_weather->options, 't', "temperature", OPTION_HAS_VALUE, DEVICES_VALUE, JSON_NUMBER, NULL, "^[0-9]{1,5}$"); options_add(&ninjablocks_weather->options, 'h', "humidity", OPTION_HAS_VALUE, DEVICES_VALUE, JSON_NUMBER, NULL, "^[0-9]{1,5}$"); // options_add(&ninjablocks_weather->options, 0, "decimals", OPTION_HAS_VALUE, DEVICES_SETTING, JSON_NUMBER, (void *)2, "[0-9]"); options_add(&ninjablocks_weather->options, 0, "temperature-decimals", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)2, "[0-9]"); options_add(&ninjablocks_weather->options, 0, "humidity-decimals", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)2, "[0-9]"); options_add(&ninjablocks_weather->options, 0, "readonly", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); options_add(&ninjablocks_weather->options, 0, "show-humidity", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)1, "^[10]{1}$"); options_add(&ninjablocks_weather->options, 0, "show-temperature", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)1, "^[10]{1}$"); ninjablocks_weather->parseCode=&parseCode; ninjablocks_weather->checkValues=&checkValues; ninjablocks_weather->validate=&validate; ninjablocks_weather->gc=&gc; }
void tfa30Init(void) { protocol_register(&tfa30); protocol_set_id(tfa30, "tfa30"); protocol_device_add(tfa30, "tfa30", "TFA 30.X Temp Hum Sensor"); tfa30->devtype = WEATHER; tfa30->hwtype = RF433; tfa30->minrawlen = MIN_RAW_LENGTH; tfa30->maxrawlen = MAX_RAW_LENGTH; tfa30->maxgaplen = MAX_PULSE_LENGTH*PULSE_DIV; tfa30->mingaplen = MIN_PULSE_LENGTH*PULSE_DIV; options_add(&tfa30->options, "t", "temperature", OPTION_HAS_VALUE, DEVICES_VALUE, JSON_NUMBER, NULL, "^[0-9]{1,3}$"); options_add(&tfa30->options, "i", "id", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "[0-9]"); options_add(&tfa30->options, "h", "humidity", OPTION_HAS_VALUE, DEVICES_VALUE, JSON_NUMBER, NULL, "^[0-9]{1,3}$"); // options_add(&tfa30->options, "0", "decimals", OPTION_HAS_VALUE, DEVICES_SETTING, JSON_NUMBER, (void *)1, "[0-9]"); options_add(&tfa30->options, "0", "temperature-decimals", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)1, "[0-9]"); options_add(&tfa30->options, "0", "humidity-decimals", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)1, "[0-9]"); options_add(&tfa30->options, "0", "humidity-offset", OPTION_HAS_VALUE, DEVICES_SETTING, JSON_NUMBER, (void *)0, "[0-9]"); options_add(&tfa30->options, "0", "temperature-offset", OPTION_HAS_VALUE, DEVICES_SETTING, JSON_NUMBER, (void *)0, "[0-9]"); options_add(&tfa30->options, "0", "show-humidity", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)1, "^[10]{1}$"); options_add(&tfa30->options, "0", "show-temperature", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)1, "^[10]{1}$"); tfa30->parseCode=&parseCode; tfa30->checkValues=&checkValues; tfa30->validate=&validate; tfa30->gc=&gc; }
void threechanInit(void) { protocol_register(&threechan); protocol_set_id(threechan, "threechan"); protocol_device_add(threechan, "threechan", "3 Channel Weather Stations"); protocol_plslen_add(threechan, 266); protocol_conflict_add(threechan, "alecto"); protocol_conflict_add(threechan, "teknihall"); threechan->devtype = WEATHER; threechan->hwtype = RF433; threechan->pulse = 15; threechan->rawlen = 74; options_add(&threechan->options, 't', "temperature", OPTION_HAS_VALUE, CONFIG_VALUE, JSON_NUMBER, NULL, "^[0-9]{1,3}$"); options_add(&threechan->options, 'i', "id", OPTION_HAS_VALUE, CONFIG_ID, JSON_NUMBER, NULL, "[0-9]"); options_add(&threechan->options, 'h', "humidity", OPTION_HAS_VALUE, CONFIG_VALUE, JSON_NUMBER, NULL, "[0-9]"); options_add(&threechan->options, 'b', "battery", OPTION_HAS_VALUE, CONFIG_VALUE, JSON_NUMBER, NULL, "^[01]$"); options_add(&threechan->options, 0, "device-decimals", OPTION_HAS_VALUE, CONFIG_SETTING, JSON_NUMBER, (void *)1, "[0-9]"); options_add(&threechan->options, 0, "gui-decimals", OPTION_HAS_VALUE, CONFIG_SETTING, JSON_NUMBER, (void *)1, "[0-9]"); options_add(&threechan->options, 0, "gui-show-humidity", OPTION_HAS_VALUE, CONFIG_SETTING, JSON_NUMBER, (void *)1, "^[10]{1}$"); options_add(&threechan->options, 0, "gui-show-temperature", OPTION_HAS_VALUE, CONFIG_SETTING, JSON_NUMBER, (void *)1, "^[10]{1}$"); options_add(&threechan->options, 0, "gui-show-battery", OPTION_HAS_VALUE, CONFIG_SETTING, JSON_NUMBER, (void *)1, "^[10]{1}$"); threechan->parseCode=&threechanParseCode; }
int main(int argc, char **argv) { gc_attach(main_gc); /* Catch all exit signals for gc */ gc_catch(); log_shell_enable(); log_file_disable(); log_level_set(LOG_NOTICE); struct options_t *options = NULL; char *args = NULL; progname = malloc(13); strcpy(progname, "pilight-uuid"); options_add(&options, 'H', "help", no_value, 0, NULL); options_add(&options, 'V', "version", no_value, 0, NULL); while (1) { int c; c = options_parse(&options, argc, argv, 1, &args); if(c == -1) break; if(c == -2) c = 'H'; switch (c) { case 'H': printf("Usage: %s [options]\n", progname); printf("\t -H --help\t\tdisplay usage summary\n"); printf("\t -V --version\t\tdisplay version\n"); return (EXIT_SUCCESS); break; case 'V': printf("%s %s\n", progname, VERSION); return (EXIT_SUCCESS); break; default: printf("Usage: %s [options]\n", progname); return (EXIT_FAILURE); break; } } options_delete(options); printf("%s\n", ssdp_genuuid()); main_gc(); return (EXIT_FAILURE); }
void quiggGT7000Init(void) { protocol_register(&quigg_gt7000); protocol_set_id(quigg_gt7000, "quigg_gt7000"); protocol_device_add(quigg_gt7000, "quigg_gt7000", "Quigg GT-7000 Switches"); quigg_gt7000->devtype = SWITCH; quigg_gt7000->hwtype = RF433; quigg_gt7000->txrpt = NORMAL_REPEATS; // SHORT: GT-FSI-04a range: 620... 960 quigg_gt7000->minrawlen = RAW_LENGTH; quigg_gt7000->maxrawlen = RAW_LENGTH; quigg_gt7000->maxgaplen = (int)(PULSE_QUIGG_FOOTER*0.9); quigg_gt7000->mingaplen = (int)(PULSE_QUIGG_FOOTER*1.1); options_add(&quigg_gt7000->options, "t", "on", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&quigg_gt7000->options, "f", "off", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&quigg_gt7000->options, "u", "unit", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([0-3])$"); options_add(&quigg_gt7000->options, "i", "id", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-3][0-9][0-9][0-9]|40[0-8][0-9]|409[0-5])$"); options_add(&quigg_gt7000->options, "a", "all", OPTION_NO_VALUE, DEVICES_OPTIONAL, JSON_NUMBER, NULL, NULL); options_add(&quigg_gt7000->options, "l", "learn", OPTION_HAS_VALUE, DEVICES_OPTIONAL, JSON_NUMBER, NULL, NULL); options_add(&quigg_gt7000->options, "0", "readonly", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); options_add(&quigg_gt7000->options, "0", "confirm", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); quigg_gt7000->parseCode=&parseCode; quigg_gt7000->createCode=&createCode; quigg_gt7000->printHelp=&printHelp; quigg_gt7000->validate=&validate; }
void arctechSwitchInit(void) { protocol_register(&arctech_switch); protocol_set_id(arctech_switch, "arctech_switch"); protocol_device_add(arctech_switch, "kaku_switch", "KlikAanKlikUit Switches"); protocol_device_add(arctech_switch, "dio_switch", "D-IO Switches"); protocol_device_add(arctech_switch, "nexa_switch", "Nexa Switches"); protocol_device_add(arctech_switch, "coco_switch", "CoCo Technologies Switches"); protocol_device_add(arctech_switch, "intertechno_switch", "Intertechno Switches"); arctech_switch->devtype = SWITCH; arctech_switch->hwtype = RF433; arctech_switch->txrpt = NORMAL_REPEATS; arctech_switch->minrawlen = RAW_LENGTH; arctech_switch->maxrawlen = RAW_LENGTH; arctech_switch->maxgaplen = MAX_PULSE_LENGTH*PULSE_DIV; arctech_switch->mingaplen = MIN_PULSE_LENGTH*PULSE_DIV; options_add(&arctech_switch->options, "t", "on", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&arctech_switch->options, "f", "off", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&arctech_switch->options, "u", "unit", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([0-9]{1}|[1][0-5])$"); options_add(&arctech_switch->options, "i", "id", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([0-9]{1,7}|[1-5][0-9]{7}|6([0-6][0-9]{6}|7(0[0-9]{5}|10([0-7][0-9]{3}|8([0-7][0-9]{2}|8([0-5][0-9]|6[0-3]))))))$"); options_add(&arctech_switch->options, "a", "all", OPTION_OPT_VALUE, DEVICES_OPTIONAL, JSON_NUMBER, NULL, NULL); options_add(&arctech_switch->options, "l", "learn", OPTION_NO_VALUE, DEVICES_OPTIONAL, JSON_NUMBER, NULL, NULL); options_add(&arctech_switch->options, "0", "readonly", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); options_add(&arctech_switch->options, "0", "confirm", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); arctech_switch->parseCode=&parseCode; arctech_switch->createCode=&createCode; arctech_switch->printHelp=&printHelp; arctech_switch->validate=&validate; }
void genWeatherInit(void) { protocol_register(&generic_weather); generic_weather->id = malloc(16); strcpy(generic_weather->id, "generic_weather"); protocol_add_device(generic_weather, "generic_weather", "Generic weather stations"); generic_weather->type = WEATHER; options_add(&generic_weather->options, 'h', "humidity", has_value, config_value, "[0-9]"); options_add(&generic_weather->options, 't', "temperature", has_value, config_value, "[0-9]"); options_add(&generic_weather->options, 'i', "id", has_value, config_id, "[0-9]"); generic_weather->printHelp=&genWeatherPrintHelp; generic_weather->createCode=&genWeatherCreateCode; }
void genScreenInit(void) { protocol_register(&generic_screen); protocol_set_id(generic_screen, "generic_screen"); protocol_device_add(generic_screen, "generic_screen", "Generic Screens"); generic_screen->devtype = SCREEN; options_add(&generic_screen->options, 't', "up", OPTION_NO_VALUE, CONFIG_STATE, JSON_STRING, NULL, NULL); options_add(&generic_screen->options, 'f', "down", OPTION_NO_VALUE, CONFIG_STATE, JSON_STRING, NULL, NULL); options_add(&generic_screen->options, 'i', "id", OPTION_HAS_VALUE, CONFIG_ID, JSON_NUMBER, NULL, "^([0-9]{1,})$"); options_add(&generic_screen->options, 0, "gui-readonly", OPTION_HAS_VALUE, CONFIG_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); generic_screen->printHelp=&genScreenPrintHelp; generic_screen->createCode=&genScreenCreateCode; }
void genSwitchInit(void) { protocol_register(&generic_switch); protocol_set_id(generic_switch, "generic_switch"); protocol_device_add(generic_switch, "generic_switch", "Generic Switches"); generic_switch->devtype = SWITCH; options_add(&generic_switch->options, 't', "on", no_value, config_state, NULL); options_add(&generic_switch->options, 'f', "off", no_value, config_state, NULL); options_add(&generic_switch->options, 'i', "id", has_value, config_id, "^([0-9]{1,})$"); protocol_setting_add_string(generic_switch, "states", "on,off"); protocol_setting_add_number(generic_switch, "readonly", 1); generic_switch->printHelp=&genSwitchPrintHelp; generic_switch->createCode=&genSwitchCreateCode; }
void gpio433Init(void) { hardware_register(&gpio433); hardware_set_id(gpio433, "433gpio"); piHiPri(55); options_add(&gpio433->options, 'r', "receiver", has_value, config_value, "^[0-9]+$"); options_add(&gpio433->options, 's', "sender", has_value, config_value, "^[0-9]+$"); gpio433->type=RF433; gpio433->init=&gpio433HwInit; gpio433->deinit=&gpio433HwDeinit; gpio433->send=&gpio433Send; gpio433->receive=&gpio433Receive; gpio433->settings=&gpio433Settings; }
void beamishSwitchInit(void) { protocol_register(&beamish_switch); protocol_set_id(beamish_switch, "beamish_switch"); protocol_device_add(beamish_switch, "beamish_switch", "beamish_switch Switches"); beamish_switch->devtype = SWITCH; beamish_switch->hwtype = RF433; beamish_switch->txrpt = NORMAL_REPEATS; beamish_switch->minrawlen = RAW_LENGTH; beamish_switch->maxrawlen = RAW_LENGTH; beamish_switch->maxgaplen = MAX_PULSE_LENGTH*PULSE_DIV; beamish_switch->mingaplen = MIN_PULSE_LENGTH*PULSE_DIV; options_add(&beamish_switch->options, "t", "on", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&beamish_switch->options, "f", "off", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&beamish_switch->options, "u", "unit", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([1-4])$"); options_add(&beamish_switch->options, "i", "id", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$"); options_add(&beamish_switch->options, "a", "all", OPTION_NO_VALUE, 0, JSON_NUMBER, NULL, NULL); options_add(&beamish_switch->options, "0", "readonly", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); options_add(&beamish_switch->options, "0", "confirm", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); beamish_switch->parseCode=&parseCode; beamish_switch->createCode=&createCode; beamish_switch->printHelp=&printHelp; beamish_switch->validate=&validate; }
void pilightFirmwareV2Init(void) { protocol_register(&pilight_firmware_v2); protocol_set_id(pilight_firmware_v2, "pilight_firmware"); protocol_device_add(pilight_firmware_v2, "pilight_firmware", "pilight filter firmware"); pilight_firmware_v2->devtype = FIRMWARE; pilight_firmware_v2->hwtype = HWINTERNAL; pilight_firmware_v2->minrawlen = RAW_LENGTH; pilight_firmware_v2->maxrawlen = RAW_LENGTH; pilight_firmware_v2->maxgaplen = MAX_PULSE_LENGTH*PULSE_DIV; pilight_firmware_v2->mingaplen = MIN_PULSE_LENGTH*PULSE_DIV; options_add(&pilight_firmware_v2->options, 'v', "version", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^[0-9]+$"); options_add(&pilight_firmware_v2->options, 'l', "lpf", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^[0-9]+$"); options_add(&pilight_firmware_v2->options, 'h', "hpf", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^[0-9]+$"); pilight_firmware_v2->parseCode=&parseCode; pilight_firmware_v2->validate=&validate; }
void pilightFirmwareInit(void) { protocol_register(&pilight_firmware); protocol_set_id(pilight_firmware, "pilight_firmware"); protocol_device_add(pilight_firmware, "pilight_firmware", "pilight filter firmware"); protocol_plslen_add(pilight_firmware, 232); pilight_firmware->devtype = INTERNAL; pilight_firmware->hwtype = HWINTERNAL; pilight_firmware->pulse = 3; pilight_firmware->rawlen = 196; pilight_firmware->lsb = 3; options_add(&pilight_firmware->options, 'v', "version", has_value, config_id, "^[0-9]+$"); options_add(&pilight_firmware->options, 'l', "lpf", has_value, config_id, "^[0-9]+$"); options_add(&pilight_firmware->options, 'h', "hpf", has_value, config_id, "^[0-9]+$"); pilight_firmware->parseBinary=&pilightFirmwareParseBinary; }
void relayInit(void) { protocol_register(&relay); protocol_set_id(relay, "relay"); protocol_device_add(relay, "relay", "GPIO Connected Relays"); relay->devtype = RELAY; relay->hwtype = HWRELAY; options_add(&relay->options, 't', "on", no_value, config_state, NULL); options_add(&relay->options, 'f', "off", no_value, config_state, NULL); options_add(&relay->options, 'g', "gpio", has_value, config_id, "^([0-9]{1}|1[0-9]|20)$"); protocol_setting_add_string(relay, "default", "off"); protocol_setting_add_string(relay, "states", "on,off"); protocol_setting_add_number(relay, "readonly", 0); relay->createCode=&relayCreateCode; relay->printHelp=&relayPrintHelp; }
void x10Init(void) { protocol_register(&x10); protocol_set_id(x10, "x10"); protocol_device_add(x10, "x10", "x10 based devices"); protocol_plslen_add(x10, 150); x10->devtype = SWITCH; x10->hwtype = RF433; x10->pulse = 12; x10->rawlen = 68; options_add(&x10->options, 't', "on", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&x10->options, 'f', "off", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&x10->options, 'i', "id", OPTION_HAS_VALUE, DEVICES_ID, JSON_STRING, NULL, "^[ABCDEFGHIJKLMNOP]([1][0-6]{1}|[1-9]{1})$"); options_add(&x10->options, 0, "readonly", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$"); x10->parseCode=&x10ParseCode; x10->createCode=&x10CreateCode; x10->printHelp=&x10PrintHelp; }
void rawInit(void) { protocol_register(&raw); protocol_set_id(raw, "raw"); protocol_device_add(raw, "raw", "Raw Codes"); raw->devtype = RAW; options_add(&raw->options, 'c', "code", has_value, 0, NULL); raw->createCode=&rawCreateCode; raw->printHelp=&rawPrintHelp; }
void pilightFirmwareV2Init(void) { protocol_register(&pilight_firmware_v2); protocol_set_id(pilight_firmware_v2, "pilight_firmware"); protocol_device_add(pilight_firmware_v2, "pilight_firmware", "pilight filter firmware"); protocol_plslen_add(pilight_firmware_v2, 230); protocol_plslen_add(pilight_firmware_v2, 220); pilight_firmware_v2->devtype = INTERNAL; pilight_firmware_v2->hwtype = HWINTERNAL; pilight_firmware_v2->pulse = 3; pilight_firmware_v2->rawlen = 196; pilight_firmware_v2->lsb = 3; options_add(&pilight_firmware_v2->options, 'v', "version", OPTION_HAS_VALUE, CONFIG_ID, JSON_NUMBER, NULL, "^[0-9]+$"); options_add(&pilight_firmware_v2->options, 'l', "lpf", OPTION_HAS_VALUE, CONFIG_ID, JSON_NUMBER, NULL, "^[0-9]+$"); options_add(&pilight_firmware_v2->options, 'h', "hpf", OPTION_HAS_VALUE, CONFIG_ID, JSON_NUMBER, NULL, "^[0-9]+$"); pilight_firmware_v2->parseBinary=&pilightFirmwareV2ParseBinary; pilight_firmware_v2->parseRaw=&pilightFirmwareV2ParseRaw; }
void conradRSLCnInit(void) { protocol_register(&conrad_rsl_contact); protocol_set_id(conrad_rsl_contact, "conrad_rsl_contact"); protocol_device_add(conrad_rsl_contact, "conrad_rsl_contact", "Conrad RSL Contact Sensor"); protocol_plslen_add(conrad_rsl_contact, 190); conrad_rsl_contact->devtype = SWITCH; conrad_rsl_contact->hwtype = RF433; conrad_rsl_contact->pulse = 5; conrad_rsl_contact->rawlen = 66; conrad_rsl_contact->binlen = 33; options_add(&conrad_rsl_contact->options, 'i', "id", has_value, config_id, "^(([0-9]|([1-9][0-9])|([1-9][0-9]{2})|([1-9][0-9]{3})|([1-9][0-9]{4})|([1-9][0-9]{5})|([1-9][0-9]{6})|((6710886[0-3])|(671088[0-5][0-9])|(67108[0-7][0-9]{2})|(6710[0-7][0-9]{3})|(671[0--1][0-9]{4})|(670[0-9]{5})|(6[0-6][0-9]{6})|(0[0-5][0-9]{7}))))$"); options_add(&conrad_rsl_contact->options, 't', "opened", no_value, config_state, NULL); options_add(&conrad_rsl_contact->options, 'f', "closed", no_value, config_state, NULL); protocol_setting_add_string(conrad_rsl_contact, "states", "opened,closed"); protocol_setting_add_number(conrad_rsl_contact, "readonly", 1); conrad_rsl_contact->parseCode=&conradRSLCnParseCode; }
void gpioSwitchInit(void) { protocol_register(&gpio_switch); protocol_set_id(gpio_switch, "gpio_switch"); protocol_device_add(gpio_switch, "gpio_switch", "GPIO as a switch"); gpio_switch->devtype = SWITCH; gpio_switch->hwtype = SENSOR; options_add(&gpio_switch->options, "t", "on", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&gpio_switch->options, "f", "off", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL); options_add(&gpio_switch->options, "g", "gpio", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([0-9]{1}|1[0-9]|20)$"); options_add(&gpio_switch->options, "0", "readonly", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)1, "^[10]{1}$"); options_add(&gpio_switch->options, "0", "confirm", OPTION_HAS_VALUE, GUI_SETTING, JSON_NUMBER, (void *)1, "^[10]{1}$"); #if !defined(__FreeBSD__) && !defined(_WIN32) gpio_switch->initDev=&initDev; gpio_switch->threadGC=&threadGC; gpio_switch->checkValues=&checkValues; #endif }