File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -36,9 +36,28 @@ String TOKEN = "your_token_goes_here";
3636Databox databox = new Databox (TOKEN );
3737try {
3838 SimpleDateFormat sdf = new SimpleDateFormat (" yyyy-MM-dd HH:mm:ss" , Locale . getDefault());
39- databox. send (" kitchen_light" , 341d , sdf. parse(" 2015-12-25 00:00:00" ));
39+ databox. push (" kitchen_light" , 341d , sdf. parse(" 2015-12-25 00:00:00" ));
4040} catch (Exception e) {
41- System . err. println(e. getLocalizedMessage());
41+ logger. error(e. getLocalizedMessage(), e);
42+ }
43+ ```
44+
45+ ## Usage (with attributes)
46+
47+ ``` java
48+ String TOKEN = " your_token_goes_here" ;
49+ Databox databox = new Databox (TOKEN );
50+ try {
51+ SimpleDateFormat sdf = new SimpleDateFormat (" yyyy-MM-dd HH:mm:ss" , Locale . getDefault());
52+ Databox . KPI kpi = new Databox .KPI ()
53+ .setKey(" switch" )
54+ .setValue(0d )
55+ .addAttribute(" kitchen" , 125 )
56+ .addAttribute(" living_room" , 412 );
57+
58+ databox. push(kpi);
59+ } catch (Exception e) {
60+ logger. error(e. getLocalizedMessage(), e);
4261}
4362```
4463
You can’t perform that action at this time.
0 commit comments