<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Text-Node as Temperature-Display]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">I use MySensors with Domoticz for tracking indoor and outdoor temperatures. In summer it is important  for me to know the temperatures, so I don't open the windows before it is cooler outside than inside.<br />
On the hottest summer nights the time to open the windows can be in the middle of the night. At this time it isn't very handy to check the Domoticz-page with a Laptop or Phone.<br />
For this application I found a good solution with the V_TEXT-node.</p>
<p dir="auto">Currently it is still a breadboard-design, but I will make something more permanent soon.<br />
I plan to power it with a battery and switch it off after reading.<br />
<img src="/uploads/files/1452093829020-dsc_0030a.jpg" alt="DSC_0030a.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">The arduino-sketch requests 5 texts (for 5 display lines) and goes to sleep afterwards. It can be woken up again with a button on pin 3. In this case, the texts are requested again.</p>
<pre><code>/*
 * Text-Node:
 * this node requests five texts and goes to sleep afterwards
 *
 */

#define MY_RADIO_NRF24
#define MY_RF24_CE_PIN 5
#define MY_RF24_CS_PIN 6
#define MY_NODE_ID 51

#include "U8glib.h"
#include &lt;MySensor.h&gt;
#include &lt;SPI.h&gt;

U8GLIB_SSD1306_128X64 u8g(7, 8, 9); //u8g constructor cs=7, dc=8, res=9

char lastLCD[5][21] = {"Booting", "MySens up", "", "", ""};                  //array of strings
unsigned long lastUpdate = 0;
boolean received[5] = {false, false, false, false, false};

void setup() {
  pinMode(3, INPUT_PULLUP); //interrupt pin
  updateDisplay();

  sendSketchInfo("Temperature Text", "1.0");

  strcpy(lastLCD[2], "Info sent");
  updateDisplay();

  for ( uint8_t i = 0; i &lt; 5; i++) {
    present(i, S_INFO);
    request(i, V_TEXT);
  }
  
  strcpy(lastLCD[3], "First requ");
  updateDisplay();
}

void loop() {
  while (received[0] == false || received[1] == false || received[2] == false || received[3] == false || received[4] == false ) {
    unsigned long now = millis();
    transportProcess();
    if (now - lastUpdate &gt; 1000) {//repeat request every second until every string is received.
      for ( uint8_t i = 0; i &lt; 5; i++) {
        if ( !received[i]) request(i, V_TEXT);
      }
      lastUpdate = now;
    }
    updateDisplay();
  }

  sleep(1, FALLING); //sleep forever, interrupt pin 3

  for (uint8_t i = 0; i &lt; 5; i++) received[i] = false; //after wake up reset received status
}

void updateDisplay() {
  u8g.setFont(u8g_font_courB12);
  u8g.setFontPosTop();

  u8g.firstPage();
  do {
    for (uint8_t i = 0; i &lt; 5; i++) {
      u8g.drawStr(0, i * 13, lastLCD[i]);
    }
  } while (u8g.nextPage());
}

void receive(const MyMessage &amp; message) {
  if (message.type == V_TEXT) {                 // Text messages only
#ifdef MY_DEBUG    // Write some debug info
    Serial.print("Sensor: "); Serial.print(message.sensor); Serial.print(", Message: "); Serial.println(message.getString());
#endif
    if (message.sensor &lt; 5) {
      strcpy(lastLCD[message.sensor], message.getString());
      received[message.sensor] = true;
    }
  }
}
</code></pre>
<p dir="auto">On the Domoticz-side is a lua script, which updates the texts whenever the corresponding temperature is updated:</p>
<pre><code>-- script_device_text.lua
local line1 = 'Textline1'
local line1idx = '25'
local line1text = 'Innen:  '
local line1temp = 'Wohnzimmer'
local line2 = 'Textline2'
local line2idx = '26'
local line2text = 'Aussen: '
local line2temp = 'großer Hof'
local line3 = 'Textline3'
local line3idx = '27'
local line3text = 'kl.Hof: '
local line3temp = 'kleiner Hof'
local line4 = 'Textline4'
local line4idx = '28'
local line4text = 'Kizi:   '
local line4temp = 'Kinderzimmer'
local line5 = 'Textline5'
local line5idx = '29'
local line5text = 'Gang:   '
local line5temp = 'Gang aussen'

commandArray = {}


if devicechanged[line1temp] then
	commandArray['UpdateDevice']=line1idx..'|0|'..line1text..otherdevices_svalues[line1temp]
end

if devicechanged[line2temp] then
	commandArray['UpdateDevice']=line2idx..'|0|'..line2text..otherdevices_svalues[line2temp]
end

if devicechanged[line3temp] then
    commandArray['UpdateDevice']=line3idx..'|0|'..line3text..otherdevices_svalues[line3temp]
end

if devicechanged[line4temp] then
    commandArray['UpdateDevice']=line4idx..'|0|'..line4text..otherdevices_svalues[line4temp]
end

if devicechanged[line5temp] then
    commandArray['UpdateDevice']=line5idx..'|0|'..line5text..otherdevices_svalues[line5temp]
end

return commandArray
</code></pre>
<p dir="auto">I also made a sketch for a continuous-update display. As Domoticz doesn't push the texts, the sketch contains a switch. Every time the switch is switched on, the sketch requests the text:</p>
<pre><code>#define MY_RADIO_NRF24
#define MY_RF24_CE_PIN 5
#define MY_RF24_CS_PIN 6
#define MY_NODE_ID 50

#include "U8glib.h"
#include &lt;MySensor.h&gt;
#include &lt;SPI.h&gt;


U8GLIB_SSD1306_128X64 u8g(7, 8, 9); //u8g constructor

const byte LCD_CHILD = 1;
const byte LCD_NEW_SWITCH = 0;
char lastLCD[21] = "";
unsigned long lastUpdate = 0, lastDisplay = 0;
boolean incoming = false;

MyMessage swMsg(LCD_NEW_SWITCH, V_LIGHT);

void setup() {
  sendSketchInfo("text-push-node", "1.0");
  present(LCD_CHILD, S_INFO);
  present(LCD_NEW_SWITCH, S_LIGHT);

  request(LCD_CHILD, V_TEXT);
  request(LCD_NEW_SWITCH, V_LIGHT);
}

void loop() {
  // put your main code here, to run repeatedly:
  unsigned long now = millis();

  if (incoming) { //request text, if there is a new one available
    send(swMsg.set(false)); //reset the switch (not needed, but serves as ack)
    request(LCD_CHILD, V_TEXT);
    incoming = false;
  }

  if (now - lastDisplay &gt; 1000) { //update every 1 s
    lastDisplay = now;

    u8g.setFont(u8g_font_helvB10);
    u8g.setFontPosTop();

    //update the Display:
    u8g.firstPage();
    do {
      u8g.drawStr(0, 0, lastLCD);
    } while (u8g.nextPage());
  }
}


void receive(const MyMessage &amp; message) {
  if (message.type == V_TEXT) {                       // Text messages only
    // Write some debug info
#ifdef MY_DEBUG
    Serial.print("Message: "); Serial.print(message.sensor); Serial.print(", Message: "); Serial.println(message.getString());
#endif
    if (message.sensor == LCD_CHILD ) {
      strcpy(lastLCD, message.getString());
    }
  }
  else if (message.type == V_LIGHT &amp;&amp; message.sensor == LCD_NEW_SWITCH) {
#ifdef MY_DEBUG
    Serial.print("New status: "); Serial.println(message.getBool());
#endif
    incoming = true;
  }
}
</code></pre>
<p dir="auto">In this case you need to set the switch in the lua-script with <code> 	commandArray[switch]='On'</code> after every update of the text.</p>
<p dir="auto">EDIT: The sketches first published were based on an old version (ca. september '15) of the development branch, which is no longer available. Updated the sketches to Version 1.6</p>
]]></description><link>https://forum.mysensors.org/topic/2719/text-node-as-temperature-display</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Jul 2026 11:39:49 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/2719.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 06 Jan 2016 15:24:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Text-Node as Temperature-Display on Thu, 07 Jan 2016 10:35:28 GMT]]></title><description><![CDATA[<p dir="auto">I built something similar <a href="http://forum.mysensors.org/topic/2360/temperature-humidity-node-with-oled-display" rel="nofollow ugc">here</a>, but it just displays its 'own' values rather than getting them from Domoticz with V_TEXT.</p>
]]></description><link>https://forum.mysensors.org/post/27846</link><guid isPermaLink="true">https://forum.mysensors.org/post/27846</guid><dc:creator><![CDATA[MikeF]]></dc:creator><pubDate>Thu, 07 Jan 2016 10:35:28 GMT</pubDate></item><item><title><![CDATA[Reply to Text-Node as Temperature-Display on Thu, 07 Jan 2016 02:25:07 GMT]]></title><description><![CDATA[<p dir="auto">Great work, I tried to get the other v_text example working to do the same, but gave up, will give this a go! Thanks for sharing :-)</p>
]]></description><link>https://forum.mysensors.org/post/27828</link><guid isPermaLink="true">https://forum.mysensors.org/post/27828</guid><dc:creator><![CDATA[Lawrence Helm]]></dc:creator><pubDate>Thu, 07 Jan 2016 02:25:07 GMT</pubDate></item></channel></rss>