37 /* |
38 /* |
38 * topic: mbv1.0/fermenters/DCMD/$node/$alias |
39 * topic: mbv1.0/fermenters/DCMD/$node/$alias |
39 * payload: {"timestamp":1546956819,"seq":688,"metric":$payload} |
40 * payload: {"timestamp":1546956819,"seq":688,"metric":$payload} |
40 * $payload: {"product":{"code":"HUP001","name":"Hop Hup"}} |
41 * $payload: {"product":{"code":"HUP001","name":"Hop Hup"}} |
41 * {"stage":"PRIMARY","mode":"FRIDGE","setpoint":{"low":17.8,"high":18.2}} |
42 * {"stage":"PRIMARY","mode":"FRIDGE","setpoint":{"low":17.8,"high":18.2}} |
42 * {"heater":{"state":0},"cooler":{"state":0},"fan":{"state":0}} |
43 * {"heater":{"state":0},"cooler":{"state":0},"fan":{"state":0},"light":{"state":0}} |
43 * {"profile":{"uuid":"...","name":"profielnaam","inittemp":{"low":18.2,"high":20.5},"fridgemode":0, |
44 * {"profile":{"uuid":"...","name":"profielnaam","inittemp":{"low":18.2,"high":20.5},"fridgemode":0, |
44 * "steps":[{"resttime":12,"steptime":36,"target":{"low":20.8,"high":23.1},"fridgemode":0}, |
45 * "steps":[{"resttime":12,"steptime":36,"target":{"low":20.8,"high":23.1},"fridgemode":0}, |
45 * {"resttime":48,"steptime":48,"target":{"low":27.5,"high":28.0},"fridgemode":0}]}} |
46 * {"resttime":48,"steptime":48,"target":{"low":27.5,"high":28.0},"fridgemode":0}]}} |
46 */ |
47 */ |
47 $topic = "mbv1.0/fermenters/DCMD/" . $node . "/" . $alias; |
48 $topic = "mbv1.0/fermenters/DCMD/" . $node . "/" . $alias; |
48 $payload = '\'{"timestamp":' . time() . ',"seq":' . $nr . ',"metric":' . $payload . '}\''; |
49 $payload = '\'{"timestamp":' . time() . ',"seq":' . $nr . ',"metric":' . $payload . '}\''; |
49 |
50 |
50 syslog(LOG_NOTICE, $topic . ' ' . $payload); |
51 syslog(LOG_NOTICE, $topic . ' ' . $payload); |
51 shell_exec('mosquitto_pub -h seaport -q 0 -t '.$topic.' -m '.$payload); |
52 shell_exec('mosquitto_pub -h '.MQTT_HOST.' -q 0 -t '.$topic.' -m '.$payload); |
52 |
53 |
53 ?> |
54 ?> |