node-red-contrib-mysensors
Version:
Mysensors related nodes, for decoding / encoding mysensors serial protocol and MQTT topic, and wrapping arbitrary messages into mysensors compatible messages
48 lines (45 loc) • 1.8 kB
HTML
<script type="text/html" data-template-name="mysensorsdb">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name" />
</div>
<div class="form-row" id="node-config-input-store-row">
<label for="node-config-input-store"><i class="fa fa-file"></i> Store</label>
<input type="text" id="node-config-input-store" />
</div>
</script>
<script type="text/html" data-help-name="mysensorsdb">
<p>
Storage for mysensors ID table, enter which context variable you want to store in,
it should probably be global and setup a persistent context store, so you do not
loose data between reboots of nodered
</p>
<p>
check node-red configuration guide for <a href="https://nodered.org/docs/user-guide/context">Working with context</a>,
to learn how to setup persistent context.
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('mysensorsdb',{
category: 'config',
defaults: {
name: {value: ""},
store: {value: "mysensor-controller", required: true},
contextType: {value: 'global'}
},
label: function() {
return this.name || this.prefix
},
oneditprepare: function() {
$('#node-config-input-store').typedInput({
default: this.contextType || 'global',
types: ['flow', 'global']
})
},
oneditsave: function() {
var node = this
node.contextType = $('#node-config-input-store').typedInput('type')
node.store = $('#node-config-input-store').typedInput('value')
}
})
</script>