You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

18 lines
476 B

import { update } from "serializr";
import * as s from "@common/sprinklersRpc";
import * as schema from "@common/sprinklersRpc/schema";
export class MqttSection extends s.Section {
onMessage(payload: string, topic: string | undefined) {
if (topic === "state") {
this.state = payload === "true";
} else if (topic == null) {
this.updateFromJSON(JSON.parse(payload));
}
}
updateFromJSON(json: any) {
update(schema.section, this, json);
}
}