@irusland/homebridge-mqttthing
Version:
Homebridge plugin supporting various services over MQTT (with TLS fixes)
27 lines (24 loc) • 572 B
JavaScript
/**
* Test 'toggle' codec - toggles switch on receipt of any message
* toggle.js
*/
module.exports = {
init: function() {
let state = false;
return {
properties: {
on: {
decode: function() {
state = ! state;
return state;
},
encode: function( msg ) {
state = msg;
return msg;
}
}
}
};
}
};