Browse Source

Checking trailing slash in mqttTopic (#422)

softuart
Xose Pérez 7 years ago
parent
commit
fce0dbd8f6
4 changed files with 2414 additions and 2411 deletions
  1. BIN
      code/espurna/data/index.html.gz
  2. +1
    -0
      code/espurna/mqtt.ino
  3. +2408
    -2407
      code/espurna/static/index.html.gz.h
  4. +5
    -4
      code/html/index.html

BIN
code/espurna/data/index.html.gz View File


+ 1
- 0
code/espurna/mqtt.ino View File

@ -214,6 +214,7 @@ void _mqttConfigure() {
// Get base topic
_mqtt_topic = getSetting("mqttTopic", MQTT_TOPIC);
if (_mqtt_topic.endsWith("/")) _mqtt_topic.remove(_mqtt_topic.length()-1);
if (_mqtt_topic.indexOf("#") == -1) _mqtt_topic = _mqtt_topic + "/#";
// Placeholders


+ 2408
- 2407
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 5
- 4
code/html/index.html View File

@ -690,11 +690,12 @@
<input class="pure-u-1 pure-u-lg-3-4" name="mqttTopic" type="text" tabindex="31" />
<div class="pure-u-0 pure-u-lg-1-4"></div>
<div class="pure-u-1 pure-u-lg-3-4 hint">
This is the root topic for this device. A trailing slash will be added if not preset. The {hostname} and {mac} placeholders will be replaced by the device hostname and MAC address.<br />
This is the root topic for this device. The {hostname} and {mac} placeholders will be replaced by the device hostname and MAC address.<br />
- <strong>&lt;root&gt;/relay/#/set</strong> Send a 0 or a 1 as a payload to this topic to switch it on or off. You can also send a 2 to toggle its current state. Replace # with the switch ID (starting from 0). If the board has only one switch it will be 0.<br />
<span class="module module-color">- <strong>&lt;root&gt;/color/set</strong> Set the color using this topic, your can either send an "#RRGGBB" value or "RRR,GGG,BBB".<br /></span>
<span class="module module-color">- <strong>&lt;root&gt;/brightness/set</strong> Set the brighness using a value from 0 to 255.<br /></span>
<span class="module module-color">- <strong>&lt;root&gt;/channel/#/set</strong> Set the value for a single color channel (from 0 to 255). Replace # with the channel ID (starting from 0 and up to 4 for RGBWC lights).<br /></span>
<span class="module module-color">- <strong>&lt;root&gt;/rgb/set</strong> Set the color using this topic, your can either send an "#RRGGBB" value or "RRR,GGG,BBB" (0-255 each).<br /></span>
<span class="module module-color">- <strong>&lt;root&gt;/hsv/set</strong> Set the color using hue (0-360), saturation (0-100) and value (0-100) values, comma separated.<br /></span>
<span class="module module-color">- <strong>&lt;root&gt;/brightness/set</strong> Set the brighness (0-255).<br /></span>
<span class="module module-color">- <strong>&lt;root&gt;/channel/#/set</strong> Set the value for a single color channel (0-255). Replace # with the channel ID (starting from 0 and up to 4 for RGBWC lights).<br /></span>
<span class="module module-color">- <strong>&lt;root&gt;/mired/set</strong> Set the temperature color in mired.<br /></span>
- <strong>&lt;root&gt;/status</strong> The device will report a 1 to this topic every few minutes. Upon MQTT disconnecting this will be set to 0.<br />
- Other values reported (depending on the build) are: <strong>firmware</strong> and <strong>version</strong>, <strong>hostname</strong>, <strong>IP</strong>, <strong>MAC</strong>, signal strenth (<strong>RSSI</strong>), <strong>uptime</strong> (in seconds), <strong>free heap</strong> and <strong>power supply</strong>.


Loading…
Cancel
Save