|
|
@ -11,15 +11,13 @@ const mqttClient = new mqtt.MqttApiClient("mqtt://localhost:1883"); |
|
|
|
|
|
|
|
|
|
|
|
mqttClient.start(); |
|
|
|
mqttClient.start(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import * as sjson from "@common/sprinklers/json"; |
|
|
|
import { autorun } from "mobx"; |
|
|
|
import { autorun } from "mobx"; |
|
|
|
const device = mqttClient.getDevice("grinklers"); |
|
|
|
const device = mqttClient.getDevice("grinklers"); |
|
|
|
autorun(() => log.info("device: ", device.toString())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import * as json from "@common/sprinklers/json"; |
|
|
|
app.get("/api/grinklers", (req, res) => { |
|
|
|
|
|
|
|
const j = sjson.sprinklersDeviceToJSON(device); |
|
|
|
app.get("/grinklers", (req, res) => { |
|
|
|
log.trace(j); |
|
|
|
const j = json.sprinklersDeviceToJSON(device); |
|
|
|
|
|
|
|
console.dir(device); |
|
|
|
|
|
|
|
res.send(j); |
|
|
|
res.send(j); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|