- fprintf(stdout, "SENSOR:TYPE=MEBUS,");
- fprintf(stdout, "ID=%i,", bb[1][0] & 0b00011111);
- fprintf(stdout, "CHANNEL=%i,",((bb[1][1] & 0b00110000) >> 4)+1);
- fprintf(stdout, "BATTERY=%s,", bb[1][1] & 0b10000000?"OK":"LOW");
- fprintf(stdout, "TEMPERATURE=%s%d.%d,",temp<0?"-":"",temperature_before_dec, temperature_after_dec);
- fprintf(stdout, "HUMIDITY=%i\n", hum);
- fprintf(stderr, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[1][1],bb[1][2],bb[1][3],bb[1][4]);
+ data = data_make("time", "", DATA_STRING, time_str,
+ "model", "", DATA_STRING, "Mebus/433",
+ "id", "Address", DATA_INT, address,
+ "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW",
+ "channel", "Channel", DATA_INT, channel,
+ "unknown1", "Unknown 1", DATA_INT, unknown1,
+ "unknown2", "Unknown 2", DATA_INT, unknown2,
+ "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp / 10.0,
+ "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, hum,
+ NULL);
+ data_acquired_handler(data);