<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Home automation on BlocNotes</title>
    <link>https://notes.iopush.net/categories/home-automation/</link>
    <description>Recent content in Home automation on BlocNotes</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 30 Sep 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://notes.iopush.net/categories/home-automation/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Fix Home-Assistant statistics and energy erroneous values</title>
      <link>https://notes.iopush.net/blog/2025/09-hass-fix-statistics/</link>
      <pubDate>Tue, 30 Sep 2025 00:00:00 +0000</pubDate>
      
      <guid>https://notes.iopush.net/blog/2025/09-hass-fix-statistics/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;I have been experimenting with solar panels, &lt;a href=&#34;https://www.home-assistant.io/&#34;&gt;Home Assistant&lt;/a&gt; and my electricity meter lately. This French meter from the utility is called Linky. It provides a small power supply (130 mW) and a serial link hidden via amplitude modulation.&lt;br&gt;
To avoid using batteries, I built a prototype that harvests this power, demodulates the serial link, and feeds the data into an nRF52 development kit. It works well enough that I never bothered turning this messy setup into a proper PCB.&lt;/p&gt;
&lt;p&gt;However, every now and then—despite CRC checks—I get an erroneous reading that messes up the Home Assistant Energy panel. Here&amp;rsquo;s how to fix incorrect statistics in the Home Assistant database.&lt;/p&gt;
&lt;h4 id=&#34;preparation&#34;&gt;Preparation&lt;/h4&gt;
&lt;p&gt;Before editing the database, it is strongly recommended to stop Home Assistant to avoid concurrent access that could corrupt the database.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Connect to the system running Home Assistant&lt;/li&gt;
&lt;li&gt;Install SQLite3 if needed. For example, on Debian-based systems: &lt;code&gt;apt install sqlite3&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Locate the &lt;code&gt;home-assistant_v2.db&lt;/code&gt; database file in Home-Assistant data folder and create a backup&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&#34;open-the-database-for-editing&#34;&gt;Open the database for editing&lt;/h4&gt;
&lt;p&gt;Open the database using SQLite and set a more readable output mode:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;$ sqlite3 home-assistant_v2.db
&lt;span style=&#34;color:#75715e&#34;&gt;# Then enter the commands&lt;/span&gt;
sqlite&amp;gt; .header on
sqlite&amp;gt; .mode column
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;find-the-data-id&#34;&gt;Find the data id&lt;/h4&gt;
&lt;p&gt;Identify Home Assitant&amp;rsquo;s internal identifier, it is called &lt;code&gt;metadata_id&lt;/code&gt;. Replace &lt;code&gt;easf02&lt;/code&gt; with Home-Assistant&amp;rsquo;s Entity ID you are looking for.&lt;br&gt;
Using &lt;code&gt;LIKE &#39;%PARTIAL_ENTITY_STRING%&lt;/code&gt; allows for easier search by matching any string containing &lt;code&gt;PARTIAL_ENTITY_STRING&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-SQL&#34; data-lang=&#34;SQL&#34;&gt;sqlite&lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;SELECT&lt;/span&gt; id, statistic_id &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; statistics_meta &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; statistic_id &lt;span style=&#34;color:#66d9ef&#34;&gt;LIKE&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%easf01%&amp;#39;&lt;/span&gt;;
id  statistic_id            
&lt;span style=&#34;color:#75715e&#34;&gt;--  ------------------------
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;6&lt;/span&gt;   sensor.linky_easf01     
&lt;span style=&#34;color:#ae81ff&#34;&gt;15&lt;/span&gt;  sensor.linky_easf01_cost
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this case &lt;code&gt;id = 6&lt;/code&gt; is the one we want to fix, and &lt;code&gt;id = 15&lt;/code&gt; is the associated cost.&lt;/p&gt;
&lt;h4 id=&#34;search-for-erroneous-data&#34;&gt;Search for erroneous data&lt;/h4&gt;
&lt;p&gt;We let&amp;rsquo;s ask the database for any sudden jump in the data, e.g change greater than 10,000 Wh. Adjust &lt;code&gt;metadata_id = 6&lt;/code&gt; and the threshold (&lt;code&gt;&amp;gt; 10000&lt;/code&gt;) as needed.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-SQL&#34; data-lang=&#34;SQL&#34;&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;WITH&lt;/span&gt; ordered_stats &lt;span style=&#34;color:#66d9ef&#34;&gt;AS&lt;/span&gt; (
  &lt;span style=&#34;color:#66d9ef&#34;&gt;SELECT&lt;/span&gt;
    id,
    created_ts,
    &lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt;,
    metadata_id,
    LAG(&lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt;) OVER (PARTITION &lt;span style=&#34;color:#66d9ef&#34;&gt;BY&lt;/span&gt; metadata_id &lt;span style=&#34;color:#66d9ef&#34;&gt;ORDER&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;BY&lt;/span&gt; created_ts) &lt;span style=&#34;color:#66d9ef&#34;&gt;AS&lt;/span&gt; previous_sum,
    LAG(created_ts) OVER (PARTITION &lt;span style=&#34;color:#66d9ef&#34;&gt;BY&lt;/span&gt; metadata_id &lt;span style=&#34;color:#66d9ef&#34;&gt;ORDER&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;BY&lt;/span&gt; created_ts) &lt;span style=&#34;color:#66d9ef&#34;&gt;AS&lt;/span&gt; previous_created_ts
  &lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;statistics&lt;/span&gt;
  &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; metadata_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;6&lt;/span&gt;
)
&lt;span style=&#34;color:#66d9ef&#34;&gt;SELECT&lt;/span&gt;
  id,
  datetime(created_ts, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;unixepoch&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;localtime&amp;#39;&lt;/span&gt;) &lt;span style=&#34;color:#66d9ef&#34;&gt;as&lt;/span&gt; date,
  &lt;span style=&#34;color:#66d9ef&#34;&gt;ABS&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; previous_sum) &lt;span style=&#34;color:#66d9ef&#34;&gt;AS&lt;/span&gt; difference
&lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; ordered_stats
&lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;ABS&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; previous_sum) &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10000&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;ORDER&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;BY&lt;/span&gt; id &lt;span style=&#34;color:#66d9ef&#34;&gt;DESC&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;LIMIT&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In a nutshell, this query:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Selects statistics data for the entity and associates each value with the previous one.&lt;/li&gt;
&lt;li&gt;Displays the five most recent entries where the difference between consecutive values exceeds the threshold.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Example result:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-SQL&#34; data-lang=&#34;SQL&#34;&gt;id      date                 difference
&lt;span style=&#34;color:#75715e&#34;&gt;------  -------------------  ----------
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;229351&lt;/span&gt;  &lt;span style=&#34;color:#ae81ff&#34;&gt;2025&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;08&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;18&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;14&lt;/span&gt;:&lt;span style=&#34;color:#ae81ff&#34;&gt;00&lt;/span&gt;:&lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;  &lt;span style=&#34;color:#ae81ff&#34;&gt;20676793&lt;/span&gt;.&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;span style=&#34;color:#ae81ff&#34;&gt;38711&lt;/span&gt;   &lt;span style=&#34;color:#ae81ff&#34;&gt;2025&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;01&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;28&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;:&lt;span style=&#34;color:#ae81ff&#34;&gt;00&lt;/span&gt;:&lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;  &lt;span style=&#34;color:#ae81ff&#34;&gt;20020401&lt;/span&gt;.&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Looks like we found the 20.6 MWh spike reported in the Energy panel :-)&lt;/p&gt;
&lt;h4 id=&#34;update-the-value&#34;&gt;Update the value&lt;/h4&gt;
&lt;p&gt;Since Home Assistant records cumulative sums, we need to subtract the erroneous difference from all entries starting from the anomaly. Use the following query:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-SQL&#34; data-lang=&#34;SQL&#34;&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;UPDATE&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;statistics&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;SET&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;20676793&lt;/span&gt;.&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; metadata_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;6&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;and&lt;/span&gt; id &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;229351&lt;/span&gt;;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Replace &lt;code&gt;20676793.0&lt;/code&gt; and &lt;code&gt;229351&lt;/code&gt; with your actual values.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;statistics_short_term&lt;/code&gt; sum should also be adjusted by the same value:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-SQL&#34; data-lang=&#34;SQL&#34;&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;UPDATE&lt;/span&gt; statistics_short_term &lt;span style=&#34;color:#66d9ef&#34;&gt;SET&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;sum&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;20676793&lt;/span&gt;.&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; metadata_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;6&lt;/span&gt;;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once done, exit SQLite by pressing &lt;code&gt;Ctrl + D&lt;/code&gt;. The database is now fixed, and the energy panel displays accurate values!&lt;/p&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/blog/2025/09-hass-fix-statistics/hass_panel_after.png&#34; alt=&#34;Fixed Home-Assistant energy panel&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Fixed Home-Assistant energy panel
        &lt;/div&gt;&lt;/p&gt;
    


</description>
    </item>
    
    <item>
      <title>Automate shutters with an ESP and Home Assistant</title>
      <link>https://notes.iopush.net/blog/2020/automate-shutters-with-an-esp-and-home-assistant/</link>
      <pubDate>Sun, 12 Jul 2020 18:50:41 +0000</pubDate>
      
      <guid>https://notes.iopush.net/blog/2020/automate-shutters-with-an-esp-and-home-assistant/</guid>
      <description>&lt;p&gt;I recently did a proof of concept on shutters automation by hacking the remote
control: the idea is to wire the ESP in parallel with the remote control
buttons.&lt;br&gt;
My remotes are Bubendorff 41677 but it should work with a lot of other remote
controls.&lt;/p&gt;
    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/blog/2020/automate-shutters-with-an-esp-and-home-assistant/remote-esp-photo.jpg&#34; alt=&#34;Wemos &amp;amp; the remote control&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Wemos &amp;amp; the remote control
        &lt;/div&gt;&lt;/p&gt;
    


&lt;p&gt;After poking with a multi-meter it appears that two test points are connected to
the right signals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;TP103: Up&lt;/li&gt;
&lt;li&gt;TP102: Down&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The signal is active low: there is a pull-up resistor and it must be grounded to
simulate the activation. A 680 Ohm resistor is used in series with each button
of the remote to prevent current overshoot and maybe reduce power consumption,
so I also used them:&lt;/p&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/blog/2020/automate-shutters-with-an-esp-and-home-assistant/schematic.png&#34; alt=&#34;Schematic&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Schematic
        &lt;/div&gt;&lt;/p&gt;
    


&lt;p&gt;You might not see the resistors on the top picture as I only had SMD 0603 on
hand; look carefully :)&lt;/p&gt;
&lt;p&gt;On the first attempt, I used the great &lt;a href=&#34;https://esphome.io/&#34;&gt;ESPHome&lt;/a&gt; project to
simulate pressing the pushbuttons. I just created 3 virtual switches as a proof
of concept but for correct integration, a
&lt;a href=&#34;https://esphome.io/components/cover/template.html&#34;&gt;cover component&lt;/a&gt; can be
used.&lt;br&gt;
I split the configuration into two files: one generic and the other only
specifying the shutter name (room) and timings.&lt;/p&gt;
&lt;p&gt;Per device file, called &lt;code&gt;shutters-office.yaml&lt;/code&gt; in this example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;color:#f92672&#34;&gt;substitutions&lt;/span&gt;:
  &lt;span style=&#34;color:#75715e&#34;&gt;# Used for HASS identifier&lt;/span&gt;
  &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;office&lt;/span&gt;
  &lt;span style=&#34;color:#75715e&#34;&gt;# Used for friendly name&lt;/span&gt;
  &lt;span style=&#34;color:#f92672&#34;&gt;switch_name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bureau&amp;#34;&lt;/span&gt;
  &lt;span style=&#34;color:#75715e&#34;&gt;# Time from fully closed to fully opened&lt;/span&gt;
  &lt;span style=&#34;color:#f92672&#34;&gt;full_time&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;16s&amp;#34;&lt;/span&gt;
  &lt;span style=&#34;color:#75715e&#34;&gt;# Time from fully closed to slightly opened&lt;/span&gt;
  &lt;span style=&#34;color:#f92672&#34;&gt;partially_open_time&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;5s&amp;#34;&lt;/span&gt;
  &lt;span style=&#34;color:#75715e&#34;&gt;# Time for the &amp;#34;button pressed&amp;#34; event&lt;/span&gt;
  &lt;span style=&#34;color:#f92672&#34;&gt;on_time&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;150ms&amp;#34;&lt;/span&gt;

&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt;: !&lt;span style=&#34;color:#ae81ff&#34;&gt;include shutters-common.yaml&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then the generic file called &lt;code&gt;shutters-common.yaml&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;color:#f92672&#34;&gt;esphome&lt;/span&gt;:
  &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;shutters_${name}&lt;/span&gt;
  &lt;span style=&#34;color:#f92672&#34;&gt;platform&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;ESP8266&lt;/span&gt;
  &lt;span style=&#34;color:#f92672&#34;&gt;board&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;d1_mini&lt;/span&gt;

&lt;span style=&#34;color:#f92672&#34;&gt;wifi&lt;/span&gt;:
  &lt;span style=&#34;color:#f92672&#34;&gt;ssid&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;MY SSID&amp;#34;&lt;/span&gt;
  &lt;span style=&#34;color:#f92672&#34;&gt;password&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;MY PASSWORD&amp;#34;&lt;/span&gt;

  &lt;span style=&#34;color:#75715e&#34;&gt;# Enable fallback hotspot (captive portal) in case wifi connection fails&lt;/span&gt;
  &lt;span style=&#34;color:#f92672&#34;&gt;ap&lt;/span&gt;:
    &lt;span style=&#34;color:#f92672&#34;&gt;ssid&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Shutter fallback hotspot&amp;#34;&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;password&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;12345678ABCDEF&amp;#34;&lt;/span&gt;

&lt;span style=&#34;color:#f92672&#34;&gt;captive_portal&lt;/span&gt;:

&lt;span style=&#34;color:#75715e&#34;&gt;# Enable logging&lt;/span&gt;
&lt;span style=&#34;color:#f92672&#34;&gt;logger&lt;/span&gt;:

&lt;span style=&#34;color:#75715e&#34;&gt;# Enable Home Assistant API&lt;/span&gt;
&lt;span style=&#34;color:#f92672&#34;&gt;api&lt;/span&gt;:

&lt;span style=&#34;color:#f92672&#34;&gt;ota&lt;/span&gt;:

&lt;span style=&#34;color:#f92672&#34;&gt;switch&lt;/span&gt;:
  &lt;span style=&#34;color:#75715e&#34;&gt;# Define with GPIOs are used&lt;/span&gt;
  - &lt;span style=&#34;color:#f92672&#34;&gt;platform&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;gpio&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;id&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;up&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;pin&lt;/span&gt;:
      &lt;span style=&#34;color:#f92672&#34;&gt;number&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;
      &lt;span style=&#34;color:#f92672&#34;&gt;inverted&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;yes&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;restore_mode&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;ALWAYS_OFF&lt;/span&gt;
  - &lt;span style=&#34;color:#f92672&#34;&gt;platform&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;gpio&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;id&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;down&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;pin&lt;/span&gt;:
      &lt;span style=&#34;color:#f92672&#34;&gt;number&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;14&lt;/span&gt;
      &lt;span style=&#34;color:#f92672&#34;&gt;inverted&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;yes&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;restore_mode&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;ALWAYS_OFF&lt;/span&gt;

  &lt;span style=&#34;color:#75715e&#34;&gt;# Define template simulating the push on the button&lt;/span&gt;
  - &lt;span style=&#34;color:#f92672&#34;&gt;platform&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;template&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Shutter ${switch_name} open&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;turn_on_action&lt;/span&gt;:
      - &lt;span style=&#34;color:#f92672&#34;&gt;switch.turn_on&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;up&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;delay&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${on_time}&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;switch.turn_off&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;up&lt;/span&gt;

  - &lt;span style=&#34;color:#f92672&#34;&gt;platform&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;template&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Shutter ${switch_name} close&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;turn_on_action&lt;/span&gt;:
      - &lt;span style=&#34;color:#f92672&#34;&gt;switch.turn_on&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;down&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;delay&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${on_time}&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;switch.turn_off&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;down&lt;/span&gt;

  &lt;span style=&#34;color:#75715e&#34;&gt;# Define template for slightly opening the shutter&lt;/span&gt;
  - &lt;span style=&#34;color:#f92672&#34;&gt;platform&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;template&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Shutter ${switch_name} slightly open&lt;/span&gt;
    &lt;span style=&#34;color:#f92672&#34;&gt;turn_on_action&lt;/span&gt;:
      - &lt;span style=&#34;color:#f92672&#34;&gt;switch.turn_on&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;down&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;delay&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${on_time}&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;switch.turn_off&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;down&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;delay&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${full_time}&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;switch.turn_on&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;up&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;delay&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${on_time}&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;switch.turn_off&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;up&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;delay&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${partially_open_time}&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;switch.turn_on&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;up&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;delay&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${on_time}&lt;/span&gt;
      - &lt;span style=&#34;color:#f92672&#34;&gt;switch.turn_off&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;up&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As there is no feedback information on the shutter state the &amp;ldquo;&lt;em&gt;slightly opened&lt;/em&gt;&amp;rdquo;
state is achieved by fully closing the shutter then opening it for a small
amount of time.&lt;br&gt;
Once the ESP8266 or ESP32 is flashed the only thing remaining is to add it to
&lt;a href=&#34;https://www.home-assistant.io/&#34;&gt;Home-Assistant&lt;/a&gt;, thanks to &lt;code&gt;Configuration&lt;/code&gt; =&amp;gt;
&lt;code&gt;Integrations&lt;/code&gt; =&amp;gt; &lt;code&gt;Set up a new integration&lt;/code&gt; =&amp;gt; Search for &lt;code&gt;ESPHome&lt;/code&gt; =&amp;gt; enter
the ESP IP address. Et voilà, you are good to go and create powerful automations
in Home-Assistant.&lt;/p&gt;
&lt;p&gt;On the next version, I used a more clever strategy to command shutters from 0 to
100%, and a LoRaWAN board to allow battery-powered operation - to be published
soon.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>How to monitor pellet stove&#39;s tank</title>
      <link>https://notes.iopush.net/blog/2019/how-to-monitor-pellet/</link>
      <pubDate>Tue, 26 Nov 2019 12:53:50 +0000</pubDate>
      
      <guid>https://notes.iopush.net/blog/2019/how-to-monitor-pellet/</guid>
      <description>&lt;p&gt;I have a great &lt;a href=&#34;https://www.rika.eu&#34;&gt;Rika&lt;/a&gt; pellet stove, but despite all the
embedded electronics, it is unable to warn me just before the pellets tank is
empty. As I already have my own low-power wireless devices and home automation
tools, I just added a distance sensor and designed some enclosures.&lt;/p&gt;
    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/blog/2019/how-to-monitor-pellet/stove.png&#34; alt=&#34;Pellet stove&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Pellet stove
        &lt;/div&gt;&lt;/p&gt;
    


&lt;h1 id=&#34;sensor-selection&#34;&gt;Sensor selection&lt;/h1&gt;
&lt;h2 id=&#34;ir-sensor&#34;&gt;IR sensor&lt;/h2&gt;
&lt;p&gt;Cheap usual
&lt;a href=&#34;https://global.sharp/products/device/lineup/data/pdf/datasheet/gp2y0a21yk_e.pdf&#34;&gt;Sharp sensor&lt;/a&gt;
needs to be at least 10 cm away from the pellets. It is a no go for this use
case as pellets are close to the lid when the tank is full&lt;/p&gt;
&lt;h2 id=&#34;ultrasonic-sensors&#34;&gt;Ultrasonic sensors&lt;/h2&gt;
&lt;p&gt;As common as the Sharp IR sensor, the
&lt;a href=&#34;https://www.mouser.com/datasheet/2/813/HCSR04-1022824.pdf&#34;&gt;HC-SR04&lt;/a&gt; was an
option but I discarded it for two reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Dust generated by pellets: sensor difficult to clean&lt;/li&gt;
&lt;li&gt;Not working well with a power supply of 3.3 Vdc&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;stmicroelectronics-time-of-flight-sensor&#34;&gt;STMicroelectronics time of flight sensor&lt;/h2&gt;
&lt;p&gt;So I went with
&lt;a href=&#34;https://www.st.com/resource/en/datasheet/vl53l0x.pdf&#34;&gt;ST VL53L0X&lt;/a&gt;: range
adapted to my needs, low power, and it is easy to the clean sensor. Regarding
dust, I used it for several months without having to clean it but summer was
included, so let&amp;rsquo;s wait a full winter for feedback.&lt;/p&gt;
&lt;h1 id=&#34;hardware&#34;&gt;Hardware&lt;/h1&gt;
&lt;p&gt;I bought a cheap breakout board from eBay and plug the I2C lines into my
&lt;a href=&#34;https://notes.iopush.net/projects/noterf/&#34;&gt;NoteRF&lt;/a&gt; boards&lt;/p&gt;
&lt;h1 id=&#34;software&#34;&gt;Software&lt;/h1&gt;
&lt;p&gt;I just added the library from
&lt;a href=&#34;https://github.com/pololu/vl53l0x-arduino&#34;&gt;Pololu&lt;/a&gt; to my project then
translated the data in &lt;a href=&#34;https://nodered.org/&#34;&gt;Node-Red&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-Javascript&#34; data-lang=&#34;Javascript&#34;&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// VL53L0X
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; ( &lt;span style=&#34;color:#a6e22e&#34;&gt;sensorType&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;7&lt;/span&gt; ) {
    &lt;span style=&#34;color:#a6e22e&#34;&gt;msg&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;topic&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;`data/sensor/noterf_distance_&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;sensorName&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/state`&lt;/span&gt;;

	&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;distance&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;msg&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;payload&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;split&lt;/span&gt;( &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;|&amp;#34;&lt;/span&gt; )[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;];
	&lt;span style=&#34;color:#a6e22e&#34;&gt;distance_percent&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;distance&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;590&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;;

	&lt;span style=&#34;color:#a6e22e&#34;&gt;msg&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;payload&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {
	    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;rssi&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;rssi&lt;/span&gt;,
	    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;battery&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;battery&lt;/span&gt;,
	};

	&lt;span style=&#34;color:#75715e&#34;&gt;// Filter abnormal values
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;	&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; ( ( &lt;span style=&#34;color:#a6e22e&#34;&gt;distance&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; ) &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; ( &lt;span style=&#34;color:#a6e22e&#34;&gt;distance&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;8000&lt;/span&gt; ) ) {
	    &lt;span style=&#34;color:#a6e22e&#34;&gt;msg&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;payload&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;distance&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;distance&lt;/span&gt;;
	    &lt;span style=&#34;color:#a6e22e&#34;&gt;msg&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;payload&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;distance_percent&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;distance_percent&lt;/span&gt;;
	}
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id=&#34;home-assistant&#34;&gt;Home assistant&lt;/h1&gt;
&lt;p&gt;As for all other connected things in my house it reports to
&lt;a href=&#34;https://www.home-assistant.io/&#34;&gt;Home Assistant&lt;/a&gt;, which allows a nice interface,
that I rarely use thanks to the automation: I am notified on my phone (through
&lt;a href=&#34;https://www.pushbullet.com/&#34;&gt;pushbullet&lt;/a&gt;) when tank level or device battery
cross a threshold: the purpose of that device is achieved! Anyway, some fancy
displays can be setup in a few seconds:&lt;/p&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/blog/2019/how-to-monitor-pellet/stove-percent.png&#34; alt=&#34;Tank status gauge - color changes according to the value&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Tank status gauge - color changes according to the value
        &lt;/div&gt;&lt;/p&gt;
    





    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/blog/2019/how-to-monitor-pellet/stove-distance.png&#34; alt=&#34;Tank status in millimeters - useless as percentage is more descriptive&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Tank status in millimeters - useless as percentage is more descriptive
        &lt;/div&gt;&lt;/p&gt;
    





    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/blog/2019/how-to-monitor-pellet/stove-icons.png&#34; alt=&#34;Icons &amp;#43; values - I have view with it for all my devices&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Icons &amp;#43; values - I have view with it for all my devices
        &lt;/div&gt;&lt;/p&gt;
    


&lt;p&gt;Device battery needs calibration :-)&lt;/p&gt;
&lt;h1 id=&#34;mechanics&#34;&gt;Mechanics&lt;/h1&gt;
&lt;p&gt;I designed with OnShape two 3D printed boxes for the sensor and the
electronics/battery, both are using magnets to stick in place The sensor is on
the tank lid, while electronics and batteries are outside, hidden on the back of
the stove.&lt;/p&gt;
&lt;p&gt;Design files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://cad.onshape.com/documents/45d755613314d24a302a4f9d/w/8c3fbb3859e3d10773ac6731/e/be84d8417991516e8ee8feaf&#34;&gt;Time of flight forGYUL53 breakout board&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://cad.onshape.com/documents/d18d8afd3ce6d5f171c0023e/w/541ec7d59e81f47be7c5d1c0/e/212bd88d468242fcb15d3269&#34;&gt;NoteRF box&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/blog/2019/how-to-monitor-pellet/sensor-tof.jpg&#34; alt=&#34;Time of flight sensor - Hot glued into 3D printed box&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Time of flight sensor - Hot glued into 3D printed box
        &lt;/div&gt;&lt;/p&gt;
    





    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/blog/2019/how-to-monitor-pellet/sensor-enclosure.jpg&#34; alt=&#34;Enclosure for the electronics and the battery&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Enclosure for the electronics and the battery
        &lt;/div&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>NoteRF - Home automation</title>
      <link>https://notes.iopush.net/projects/noterf/</link>
      <pubDate>Sun, 28 Feb 2016 00:00:00 +0000</pubDate>
      
      <guid>https://notes.iopush.net/projects/noterf/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Here is the status of the project, right now it is not a real home automation as I only monitor things, but control will be added soon.&lt;/strong&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h1 id=&#34;system-architecture&#34;&gt;System architecture&lt;/h1&gt;
&lt;p&gt;All sensors emits to the gateway, which is just a sensor with the radio chip in reception mode. I use a &lt;a href=&#34;https://www.raspberrypi.org/&#34;&gt;Raspberry PI&lt;/a&gt; to collect and parse data from the gateway, then store it in the rPI and online.
All data are displayed on &lt;a href=&#34;http://grafana.org/&#34;&gt;Grafana&lt;/a&gt; for now and some are send to my phone by push messages.&lt;/p&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/projects/noterf/noterf.png&#34; alt=&#34;NoteRF network architecture&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            NoteRF network architecture
        &lt;/div&gt;&lt;/p&gt;
    


&lt;h1 id=&#34;sensors-pcb&#34;&gt;Sensors PCB&lt;/h1&gt;
&lt;p&gt;I made custom PCB with ATmega328+HopeRF &lt;a href=&#34;http://www.hoperf.com/upload/rf/RFM69HW-V1.3.pdf&#34;&gt;RFM69&lt;/a&gt; radio transmitter, the &lt;a href=&#34;https://www.arduino.cc/&#34;&gt;Arduino&lt;/a&gt; bootloader is used in order to have easy access to thousands of libraries.&lt;/p&gt;
&lt;p&gt;First batch had three minor errors which are hopefully corrected in the second batch. I should receive them soon, for reference there were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ISP reset signal was on the wrong side of the DTR capacitor so a strap must be used when loading bootloader.&lt;/li&gt;
&lt;li&gt;I forgot a capacitor in parallel of the tension divider to sense battery level, workaround is to stack it on the resistor. This capacitor is required because the divider has high resistor in order to decrease power consumption, so the capacitor helps to feed ATmega’s ADC capacitor&lt;/li&gt;
&lt;li&gt;Some silkscreen text where on a layer not printed by the fab house.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Following batchs where corrected, see &lt;a href=&#34;https://notes.iopush.net/noterf-sensors-schematic-and-layout/&#34;&gt;this page&lt;/a&gt; for schematics and layout.&lt;/p&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/projects/noterf/sensors.png&#34; alt=&#34;NoteRF v0.1 sensors&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            NoteRF v0.1 sensors
        &lt;/div&gt;&lt;/p&gt;
    


&lt;h1 id=&#34;sensors&#34;&gt;Sensors&lt;/h1&gt;
&lt;p&gt;Currently I implemented those sensors:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Luminosity (Maxim MAX44009)&lt;/li&gt;
&lt;li&gt;Temperature/Humidity (DHT11/DHT22 or HTU21D)&lt;/li&gt;
&lt;li&gt;Pressure/Temperature (Bosh BMP180)&lt;/li&gt;
&lt;li&gt;Temperature (Dallas DS18B20)&lt;/li&gt;
&lt;li&gt;TIC: TéléInformation Client - French power meter’s output&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://notes.iopush.net/how-to-monitor-pellet/&#34;&gt;Distance sensor&lt;/a&gt; (ST VL053L0) - Useful to monitor pellet&amp;rsquo;s stove tank&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://notes.iopush.net/noterf-add-a-new-sensor-moisture-sensor/&#34;&gt;Soil moisture sensor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Currently testing the most essential : vibration sensor for mailbox !&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;data-parsing&#34;&gt;Data parsing&lt;/h1&gt;
&lt;p&gt;I use &lt;a href=&#34;http://nodered.org/&#34;&gt;Node-Red&lt;/a&gt; to receive serial data from the gateway on the rPi and parse it, check data integrity, gather data from web services (like air pollution), get the “end of print” data from my 3D printer… It is a great tool to quickly add new functionalities.&lt;/p&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/projects/noterf/nodered.png&#34; alt=&#34;Node-RED&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Node-RED
        &lt;/div&gt;&lt;/p&gt;
    


&lt;h1 id=&#34;iopush&#34;&gt;ioPush&lt;/h1&gt;
&lt;p&gt;I am currently writing &lt;a href=&#34;https://iopush.net/app/&#34;&gt;ioPush&lt;/a&gt;, a logbook for error/warning/informations like Twitter but dedicated to the IoT (Internet of Things), with a phone application to receive push notifications.
I was using Twitter but push notifications are not reliables and it does not fit my needs.&lt;/p&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/projects/iopush-app/push-notification.png&#34; alt=&#34;ioPush Android notification&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            ioPush Android notification
        &lt;/div&gt;&lt;/p&gt;
    


&lt;h1 id=&#34;data-storage&#34;&gt;Data storage&lt;/h1&gt;
&lt;p&gt;I use &lt;a href=&#34;http://influxdb.com/&#34;&gt;InfluxDB&lt;/a&gt;, a new noSQL database dedicated for time series data. Even if it still a bit buggy, it is now usable and the team reacts fast to issues. Data are stored in local on the rPi and send to a server on the internet in order to have a backup.&lt;/p&gt;
&lt;h1 id=&#34;ihm&#34;&gt;IHM&lt;/h1&gt;
&lt;p&gt;I did not find the ideal tool yet and do to want to write it for now, so I am using Grafana to display and graph data.
I might move to something else later if I find, &lt;a href=&#34;http://www.openhab.org/&#34;&gt;OpenHAB&lt;/a&gt; 2.0 is a good candidate but nothing is defined.&lt;/p&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/projects/noterf/grafana.png&#34; alt=&#34;Grafana&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Grafana
        &lt;/div&gt;&lt;/p&gt;
    


&lt;h1 id=&#34;enclosure&#34;&gt;Enclosure&lt;/h1&gt;
&lt;p&gt;I quickly designed a 3D printed box but I am not happy with it because it is way too big, so I might try another design. Algouth I might change the batteries because 18650 elements are free, but big.&lt;/p&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/projects/noterf/noterf-enclosure.png&#34; alt=&#34;NoteRF 3D printed enclosure&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            NoteRF 3D printed enclosure
        &lt;/div&gt;&lt;/p&gt;
    


&lt;h1 id=&#34;power-consumption&#34;&gt;Power consumption&lt;/h1&gt;
&lt;p&gt;I power several sensors on upcycled 18650 batteries from old laptops since one year. So I optimised power consumption in design and code, but never measured it because sensors consumed only few percentage of the 2 400 mAh batteries.&lt;/p&gt;
&lt;h1 id=&#34;sources&#34;&gt;Sources&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/Oliv4945/NoteRF-Elec&#34;&gt;Sensor and gateway code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/Oliv4945/NoteRF-Elec/tree/master/Hardware&#34;&gt;PCB design files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/Oliv4945/NoteRF-Soft&#34;&gt;Software&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://gist.github.com/Oliv4945/031d487ad3dcbf56ac7a&#34;&gt;Installation notes&lt;/a&gt; (A friend of mine is currently writing an Ansible script to ease the process)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ioPush/ioPush-server&#34;&gt;ioPush&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;a href=&#34;https://notes.iopush.net/tags/noterf/&#34;&gt;All blog posts associated to NoteRF&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>ioPush-App</title>
      <link>https://notes.iopush.net/projects/iopush-app/</link>
      <pubDate>Wed, 27 Jan 2016 00:00:00 +0000</pubDate>
      
      <guid>https://notes.iopush.net/projects/iopush-app/</guid>
      <description>&lt;p&gt;This web service is an IoT logbook and Android push notification server, it can
be considered like Twitter but for the Internet of Things. It is a part of my
&lt;a href=&#34;https://notes.iopush.net/projects/noterf/&#34;&gt;home automation system&lt;/a&gt;: I previously used
Twitter as a logbook of warning/errors but it lacks some functionalities, and
for few months notifications did not work well on my phone.&lt;/p&gt;
&lt;h1 id=&#34;website-screenshot&#34;&gt;Website screenshot&lt;/h1&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/projects/iopush-app/iopush-messages.png&#34; alt=&#34;ioPush messages&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            ioPush messages
        &lt;/div&gt;&lt;/p&gt;
    


&lt;h1 id=&#34;android-notification&#34;&gt;Android notification&lt;/h1&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/projects/iopush-app/push-notification.png&#34; alt=&#34;ioPush Android notification&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            ioPush Android notification
        &lt;/div&gt;&lt;/p&gt;
    


&lt;h1 id=&#34;so-it-should-be-able-to&#34;&gt;So it should be able to&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Keep record of events - Done&lt;/li&gt;
&lt;li&gt;Send event to push message if asked - Done&lt;/li&gt;
&lt;li&gt;Manage users - Done&lt;/li&gt;
&lt;li&gt;Send push notifications to Android, maybe other OS - Done, Android app to be
published&lt;/li&gt;
&lt;li&gt;Android application -&amp;gt; receive notifications - Tested in the 1st version&lt;/li&gt;
&lt;li&gt;Android application -&amp;gt; display user&amp;rsquo;s events&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;what-can-be-logged&#34;&gt;What can be logged?&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Sensors out of battery warning&lt;/li&gt;
&lt;li&gt;Pollution data over a threshold&lt;/li&gt;
&lt;li&gt;Your 3D printer has finished its job&lt;/li&gt;
&lt;li&gt;Server down&lt;/li&gt;
&lt;li&gt;Motion sensor triggered&lt;/li&gt;
&lt;li&gt;A new mail is inside your mailbox&lt;/li&gt;
&lt;li&gt;Hoarfrost alert&lt;/li&gt;
&lt;li&gt;Whatever you want to be written :)&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;useful-links&#34;&gt;Useful links&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://iopush.net/app/&#34;&gt;Find it here&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ioPush&#34;&gt;Source code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Dashing - Job to get data from InfluxDB v0.8 database</title>
      <link>https://notes.iopush.net/blog/2015/dashing-job-to-get-data-from-influxdb-v0-8-database/</link>
      <pubDate>Tue, 14 Apr 2015 09:29:00 +0000</pubDate>
      
      <guid>https://notes.iopush.net/blog/2015/dashing-job-to-get-data-from-influxdb-v0-8-database/</guid>
      <description>&lt;p&gt;To use my dashboard, I wrote some &lt;a href=&#34;http://dashing.io/&#34;&gt;Dashing&lt;/a&gt; jobs to be able
to query some values from my &lt;a href=&#34;http://influxdb.com/&#34;&gt;InfluxDB&lt;/a&gt; database.&lt;/p&gt;
&lt;p&gt;There are thre versions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Ruby&lt;/li&gt;
&lt;li&gt;In node.js (javascript) after my switch to Dashing-js&lt;/li&gt;
&lt;li&gt;A way to update a &amp;lsquo;list&amp;rsquo; widget&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The third code also changes the background color of a list widget, to set it
regarding data values. I will share the widget&amp;rsquo;s code soon, I just need some
time to clean a bit the code&lt;/p&gt;
&lt;h3 id=&#34;1-ruby-code&#34;&gt;1. Ruby code&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-ruby&#34; data-lang=&#34;ruby&#34;&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Insert required components&lt;/span&gt;
require &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;json&amp;#39;&lt;/span&gt;
require &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;net/http&amp;#39;&lt;/span&gt;

&lt;span style=&#34;color:#75715e&#34;&gt;# Parameter&lt;/span&gt;
serverAddr &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;http://localhost:8086&amp;#39;&lt;/span&gt;

&lt;span style=&#34;color:#75715e&#34;&gt;# :first_in sets how long it takes before the job is first run. In this case, it is run immediately&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;SCHEDULER&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;every &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;1m&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;:first_in&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt;job&lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt;

  &lt;span style=&#34;color:#75715e&#34;&gt;# Url to get data&lt;/span&gt;
  url &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;URI&lt;/span&gt;( &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;#{&lt;/span&gt;serverAddr&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/db/db_name/series?u=xxxx&amp;amp;p=xxxx&amp;amp;q=SELECT%20*%20FROM%20%22/data/Conservatory/Humidity%22%20LIMIT%201&amp;#34;&lt;/span&gt; )
  &lt;span style=&#34;color:#75715e&#34;&gt;# Query server&lt;/span&gt;
  res &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Net&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;HTTP&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;get( url )
  &lt;span style=&#34;color:#75715e&#34;&gt;# Transforms JSON in object&lt;/span&gt;
  j &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;JSON&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;parse(res)
  send_event(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;welcome&amp;#39;&lt;/span&gt;, { &lt;span style=&#34;color:#e6db74&#34;&gt;text&lt;/span&gt;: j&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;][&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;points&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;][&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;][&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; })
  send_event(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;synergy&amp;#39;&lt;/span&gt;, { &lt;span style=&#34;color:#e6db74&#34;&gt;value&lt;/span&gt;: j&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;][&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;points&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;][&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;][&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; })

&lt;span style=&#34;color:#66d9ef&#34;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;2-in-nodejs-easier-to-modify&#34;&gt;2. In node.js, easier to modify&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Includes
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;request&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;require&lt;/span&gt;( &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;request&amp;#39;&lt;/span&gt; )

&lt;span style=&#34;color:#75715e&#34;&gt;// Configuration
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dbAddress&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;localhost&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dbPort&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;8086&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dbName&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;XXXX&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dbUser&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;XXXX&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dbPwd&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;XXXX&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;refreshTime&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;60&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;// in ms
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;getData&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;parameterToRefresh&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;widgetId&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;unit&lt;/span&gt; ) {
  &lt;span style=&#34;color:#75715e&#34;&gt;// URL creation
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;urlToGet&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;http://&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dbAddress&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;:&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dbPort&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/db/&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dbName&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/series?u=&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dbUser&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;amp;p=&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dbPwd&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;amp;q=SELECT%20*%20FROM%20%22/data/&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;parameterToRefresh&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%22%20LIMIT%201&amp;#39;&lt;/span&gt;
  &lt;span style=&#34;color:#75715e&#34;&gt;// Request
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;request&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;urlToGet&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;error&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;response&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;body&lt;/span&gt;) {
    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;error&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;response&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;statusCode&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;200&lt;/span&gt;) {
      &lt;span style=&#34;color:#75715e&#34;&gt;// No error, send the value to the dashboard
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;   	  &lt;span style=&#34;color:#a6e22e&#34;&gt;send_event&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;widgetId&lt;/span&gt;, { &lt;span style=&#34;color:#a6e22e&#34;&gt;value&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; Math.&lt;span style=&#34;color:#a6e22e&#34;&gt;round&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;JSON&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;parse&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;body&lt;/span&gt;)[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;points&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;]&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt; })
    }
  })
}

&lt;span style=&#34;color:#a6e22e&#34;&gt;setInterval&lt;/span&gt;( &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt;() { &lt;span style=&#34;color:#a6e22e&#34;&gt;getData&lt;/span&gt;( &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Outside/Pressure&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;outsideText&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; mbara&amp;#39;&lt;/span&gt; ) }, &lt;span style=&#34;color:#a6e22e&#34;&gt;refreshTime&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;3-and-a-way-to-fill-a-list-widget&#34;&gt;3. And a way to fill a &amp;lsquo;list&amp;rsquo; widget&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;pre&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Includes
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;http&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;require&lt;/span&gt;( &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;http&amp;#39;&lt;/span&gt; )
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;async&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;require&lt;/span&gt;( &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;async&amp;#39;&lt;/span&gt; )
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;request&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;require&lt;/span&gt;( &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;request&amp;#39;&lt;/span&gt; )

&lt;span style=&#34;color:#75715e&#34;&gt;// Configuration
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dbAddress&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;localhost&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dbPort&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;8086&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dbName&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;XXXX&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dbUser&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;XXXX&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dbPwd&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;XXXX&amp;#39;&lt;/span&gt;
&lt;span style=&#34;color:#75715e&#34;&gt;// itemsToQuery [ dataNameInInflux, NameToDisplayInWidget ]
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;itemsToQuery&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; [ [ &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Conservatory&amp;#39;&lt;/span&gt;,  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;PLA&amp;#39;&lt;/span&gt; ],
                     [ &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;SensorTest_1&amp;#39;&lt;/span&gt;,  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Citrus&amp;#39;&lt;/span&gt; ],
                     [ &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;LivingRoom&amp;#39;&lt;/span&gt;,    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Salon&amp;#39;&lt;/span&gt; ],
                     [ &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Office&amp;#39;&lt;/span&gt;,        &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Bureau&amp;#39;&lt;/span&gt; ]
                    ]
&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;refreshTime&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;60&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;// in ms
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;
&lt;span style=&#34;color:#75715e&#34;&gt;// Function to fetch data
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;getDataList&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;url&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;callback&lt;/span&gt;) {
  &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;data&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;

  &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;req&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;http&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;request&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;url&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt;) {
    &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;on&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;data&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;chunk&lt;/span&gt;) {
        &lt;span style=&#34;color:#a6e22e&#34;&gt;data&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;chunk&lt;/span&gt;
    })
    &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;on&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;end&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;e&lt;/span&gt;) {
        &lt;span style=&#34;color:#a6e22e&#34;&gt;callback&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;e&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;data&lt;/span&gt;)
    })
  }).&lt;span style=&#34;color:#a6e22e&#34;&gt;end&lt;/span&gt;()
}

&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;refreshDataList&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;parameterToRefresh&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;widgetId&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;unit&lt;/span&gt; ) {
  &lt;span style=&#34;color:#75715e&#34;&gt;// Variables declaration
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;urls&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; []
  &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;itemarray&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; []
  &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;average&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;

  &lt;span style=&#34;color:#75715e&#34;&gt;// Set url regarding unit
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;switch&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;unit&lt;/span&gt; ) {
    &lt;span style=&#34;color:#66d9ef&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; %&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;urlPrefix&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;data/&amp;#39;&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;urlSuffix&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;parameterToRefresh&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;break&lt;/span&gt;
    &lt;span style=&#34;color:#66d9ef&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;°C&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;urlPrefix&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;data/&amp;#39;&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;urlSuffix&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;parameterToRefresh&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;break&lt;/span&gt;
    &lt;span style=&#34;color:#66d9ef&#34;&gt;default&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;   &lt;span style=&#34;color:#a6e22e&#34;&gt;urlPrefix&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;parameterToRefresh&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/&amp;#39;&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;urlSuffix&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;break&lt;/span&gt;
  }
  &lt;span style=&#34;color:#75715e&#34;&gt;// Table construction regarding the items ot query
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;( &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;itemsToQuery&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt; ) {
    &lt;span style=&#34;color:#a6e22e&#34;&gt;urls&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;push&lt;/span&gt;( &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;http://&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dbAddress&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;:&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dbPort&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/db/&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dbName&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/series?u=&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dbUser&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;amp;p=&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;dbPwd&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;amp;q=SELECT%20*%20FROM%20%22/&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;urlPrefix&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; encodeURIComponent(&lt;span style=&#34;color:#a6e22e&#34;&gt;itemsToQuery&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;])&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;urlSuffix&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;%22%20LIMIT%201&amp;#39;&lt;/span&gt;)
  }

  &lt;span style=&#34;color:#75715e&#34;&gt;// Asynchronous call to get the data
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;async&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;map&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;urls&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;getDataList&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;err&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;result&lt;/span&gt; ) {
    &lt;span style=&#34;color:#75715e&#34;&gt;// Parse results
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;( &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;result&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt; ) {
      &lt;span style=&#34;color:#a6e22e&#34;&gt;itemarray&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {&lt;span style=&#34;color:#a6e22e&#34;&gt;label&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;itemsToQuery&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], &lt;span style=&#34;color:#a6e22e&#34;&gt;value&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;JSON&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;parse&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;result&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;])[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;points&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;unit&lt;/span&gt;)}
      &lt;span style=&#34;color:#a6e22e&#34;&gt;average&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;average&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;JSON&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;parse&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;result&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;])[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;points&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;]
    }
    &lt;span style=&#34;color:#a6e22e&#34;&gt;average&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Math.&lt;span style=&#34;color:#a6e22e&#34;&gt;round&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;average&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;result&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt; )&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;

    &lt;span style=&#34;color:#75715e&#34;&gt;// Select color and &amp;#39;moreinfo&amp;#39; message regarding data type and average value
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;switch&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;unit&lt;/span&gt; ) {
      &lt;span style=&#34;color:#66d9ef&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; %&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
        &lt;span style=&#34;color:#a6e22e&#34;&gt;backGroundColor&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;humidityColor&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;average&lt;/span&gt; )
        &lt;span style=&#34;color:#a6e22e&#34;&gt;moreinfo&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Moyenne : &amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;average&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;unit&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;break&lt;/span&gt;
      &lt;span style=&#34;color:#66d9ef&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;°C&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
        &lt;span style=&#34;color:#a6e22e&#34;&gt;backGroundColor&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;insideTemperatureColor&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;average&lt;/span&gt; );
        &lt;span style=&#34;color:#a6e22e&#34;&gt;moreinfo&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Moyenne : &amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;average&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;unit&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;break&lt;/span&gt;
      &lt;span style=&#34;color:#66d9ef&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; V&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
        &lt;span style=&#34;color:#a6e22e&#34;&gt;mini&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Math.&lt;span style=&#34;color:#a6e22e&#34;&gt;min&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;apply&lt;/span&gt;(Math, &lt;span style=&#34;color:#a6e22e&#34;&gt;result&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;map&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;table&lt;/span&gt;) { &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;JSON&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;parse&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;table&lt;/span&gt;)[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;points&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;] }))
        &lt;span style=&#34;color:#a6e22e&#34;&gt;backGroundColor&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;batteryLevelColor&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;mini&lt;/span&gt; )
        &lt;span style=&#34;color:#a6e22e&#34;&gt;moreinfo&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Minimum : &amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;mini&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;unit&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;break&lt;/span&gt;
      &lt;span style=&#34;color:#66d9ef&#34;&gt;case&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; dB&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
        &lt;span style=&#34;color:#a6e22e&#34;&gt;mini&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Math.&lt;span style=&#34;color:#a6e22e&#34;&gt;min&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;apply&lt;/span&gt;(Math, &lt;span style=&#34;color:#a6e22e&#34;&gt;result&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;map&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;table&lt;/span&gt;) { &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;JSON&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;parse&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;table&lt;/span&gt;)[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;points&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;] }))
        &lt;span style=&#34;color:#a6e22e&#34;&gt;backGroundColor&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;rssiColor&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;mini&lt;/span&gt; )
        &lt;span style=&#34;color:#a6e22e&#34;&gt;moreinfo&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Minimum : &amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;mini&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;unit&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;break&lt;/span&gt;
      &lt;span style=&#34;color:#66d9ef&#34;&gt;default&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
        &lt;span style=&#34;color:#a6e22e&#34;&gt;backGroundColor&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;55555&amp;#39;&lt;/span&gt;
    }

    &lt;span style=&#34;color:#75715e&#34;&gt;// Prepare structure to send
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;datastruct&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {
      &lt;span style=&#34;color:#a6e22e&#34;&gt;items&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;itemarray&lt;/span&gt;,
      &lt;span style=&#34;color:#a6e22e&#34;&gt;backGroundColor&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;backGroundColor&lt;/span&gt;,
      &lt;span style=&#34;color:#a6e22e&#34;&gt;moreinfo&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;moreinfo&lt;/span&gt;
    }
    &lt;span style=&#34;color:#a6e22e&#34;&gt;send_event&lt;/span&gt;( &lt;span style=&#34;color:#a6e22e&#34;&gt;widgetId&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;datastruct&lt;/span&gt; )
  })
}

&lt;span style=&#34;color:#75715e&#34;&gt;// Set job call every refreshTime
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;setInterval&lt;/span&gt;( &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt;() { &lt;span style=&#34;color:#a6e22e&#34;&gt;refreshDataList&lt;/span&gt;( &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Humidity&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;humidityList&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; %&amp;#39;&lt;/span&gt; ) }, &lt;span style=&#34;color:#a6e22e&#34;&gt;refreshTime&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>From Dashing.io to Dashing-js</title>
      <link>https://notes.iopush.net/blog/2015/from-dashing-io-to-dashing-js/</link>
      <pubDate>Fri, 10 Apr 2015 09:15:00 +0000</pubDate>
      
      <guid>https://notes.iopush.net/blog/2015/from-dashing-io-to-dashing-js/</guid>
      <description>&lt;p&gt;I recently discovered &lt;a href=&#34;http://dashing.io/&#34;&gt;Dashing.io&lt;/a&gt;, which is an easy to use
dashboard, which seems to fit my needs :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Easy to install&lt;/li&gt;
&lt;li&gt;Useful widgets available, easy to add new ones&lt;/li&gt;
&lt;li&gt;Generation of templates for dashboards, jobs, widgets&lt;/li&gt;
&lt;li&gt;Great design (subjective), some friends find it too close to Windows 8, but I
don&amp;rsquo;t use it, so&amp;hellip;&lt;/li&gt;
&lt;li&gt;New data can be pushed via internal jobs or external API, by calling an URL&lt;/li&gt;
&lt;li&gt;Tile based interface with drag&amp;amp;drop re-arranging (based on Gridster)&lt;/li&gt;
&lt;li&gt;Auto-adaptation to smartphone/tablets (Responsive)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;From my point of view, the major drawback is that it uses Ruby language. I have
nothing about it, I just did not want to add another &amp;lsquo;technology&amp;rsquo; to this
project, which uses already lots of things. So I tried it, and then discovered
&lt;a href=&#34;https://github.com/fabiocaseri/dashing-js&#34;&gt;Dashing-js&lt;/a&gt;: a Node.js port.&lt;/p&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/blog/2015/from-dashing-io-to-dashing-js/dashboard.png&#34; alt=&#34;Dashing dashboard&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Dashing dashboard
        &lt;/div&gt;&lt;/p&gt;
    


&lt;p&gt;The port is not as well documented as the Ruby version, so I will share my
experience:&lt;/p&gt;
&lt;h3 id=&#34;run-on-a-sub-directory-helpful-for-reverse-proxy&#34;&gt;Run on a sub-directory (helpful for reverse proxy)&lt;/h3&gt;
&lt;p&gt;The easiest way to add it on &lt;code&gt;/dashing&lt;/code&gt; is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In file &lt;code&gt;node_modules/dashing-js/lib/dashing.js&lt;/code&gt;&lt;br&gt;
Add &lt;code&gt;app.use(&#39;/dashing&#39;, app.router);&lt;/code&gt; (L75) inside
&lt;code&gt;app.configure(function() { }&lt;/code&gt; block&lt;/li&gt;
&lt;li&gt;In file &lt;code&gt;assets/javascripts/application.coffee&lt;/code&gt;&lt;br&gt;
Add &lt;code&gt;Batman.config.viewPrefix = &#39;dashing/views&#39;&lt;/code&gt; after
&lt;code&gt;#= require_tree ../../widgets&lt;/code&gt;,&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;stop-a-dashboard-launch-as-daemon&#34;&gt;Stop a dashboard launch as daemon&lt;/h3&gt;
&lt;p&gt;If you start your dashboard in background with &lt;code&gt;dashing-js start&lt;/code&gt;,
&lt;code&gt;dashing-js stop&lt;/code&gt; will not work, you must use &lt;code&gt;kill PID&lt;/code&gt; command. I hope to have
some time to explore the code and correct the bug/implement it soon.&lt;/p&gt;
&lt;h3 id=&#34;set-default-dashboard&#34;&gt;Set default dashboard&lt;/h3&gt;
&lt;p&gt;Edit the file &lt;code&gt;server.js&lt;/code&gt;, then line
&lt;code&gt;dashing.default_dashboard = &#39;subPathIfNeeded/sample&#39;;&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;save-the-current-tile-layout&#34;&gt;Save the current tile layout&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Drag the tiles&lt;/li&gt;
&lt;li&gt;Click on the &amp;lsquo;Save this layout&amp;rsquo; button&lt;/li&gt;
&lt;li&gt;Copy the code&lt;/li&gt;
&lt;li&gt;Paste it in &lt;code&gt;dashboard/yourDashboard.jade&lt;/code&gt; respecting the following example
indentation, and the &lt;code&gt;.&lt;/code&gt; (dot) after &lt;code&gt;script(type=&amp;quot;text/javascript&amp;quot;).&lt;/code&gt; Done !&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;extends layout

block title
  | Dashboard&#39;s title

block content
  div.gridster
    ul
      li(data-row=&#39;1&#39;, data-col=&#39;1&#39;, data-sizex=&#39;4&#39;, data-sizey=&#39;2&#39;)
        div(data-id=&#39;welcome&#39;, data-view=&#39;Text&#39;, data-title=&#39;Hello&#39;, data-text=&#39;This is your shiny new dashboard.&#39;, data-moreinfo=&#39;Protip: You can drag the widgets around!&#39;)
    center
      div(style=&#39;font-size: 12px&#39;) Try this: curl -d &#39;{ &amp;quot;auth_token&amp;quot;: &amp;quot;YOUR_AUTH_TOKEN&amp;quot;, &amp;quot;text&amp;quot;: &amp;quot;Hey, Look what I can do!&amp;quot; }&#39; -H &amp;quot;Content-Type: application/json&amp;quot; http://#{request.header(&#39;host&#39;)}/widgets/we$


  script(type=&amp;quot;text/javascript&amp;quot;).
    $(function() { Dashing.gridsterLayout(&#39;[{&amp;quot;col&amp;quot;:1,&amp;quot;row&amp;quot;:1,&amp;quot;size_x&amp;quot;:4,&amp;quot;size_y&amp;quot;:2} [...] }]&#39;) })
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Node-RED - Grab pollution data from local services</title>
      <link>https://notes.iopush.net/blog/2015/node-red-grab-pollution-data-from-local-services/</link>
      <pubDate>Thu, 29 Jan 2015 14:13:00 +0000</pubDate>
      
      <guid>https://notes.iopush.net/blog/2015/node-red-grab-pollution-data-from-local-services/</guid>
      <description>&lt;p&gt;I am currently evaluating some solutions to build my
&lt;a href=&#34;https://notes.iopush.net/projects/noterf/&#34;&gt;home automation&lt;/a&gt; system. As a part of this
system I want to monitor air quality, but, I do not have any sensor yet, so I
use a public service and parse its data with Node-RED.&lt;/p&gt;
&lt;p&gt;I built the following flow which gets the data from
&lt;a href=&#34;http://www.air-rhonealpes.fr&#34;&gt;Air Rhone-Alpes&lt;/a&gt;, a local service. After grabbing
the web page, it extracts the pollution level, parses it, publishes it to my
MQTT broker. I added a filter to avoid any update if there is no change in the
pollution level value. Another flow subscribed to the MQTT topic and send
&lt;a href=&#34;https://notes.iopush.net/projects/iopush-app/&#34;&gt;ioPush-App&lt;/a&gt; notifications depending on the
pollution level.&lt;/p&gt;



    
    
        
        
        
        
    

    
    
    

    
    







  


    

    
        &lt;p&gt;&lt;span class=&#34;image center&#34;&gt;
            &lt;img src=&#34;https://notes.iopush.net/blog/2015/node-red-grab-pollution-data-from-local-services/NodeRedflowpollution.png&#34; alt=&#34;Node-RED screenshot&#34;&gt;
        &lt;/span&gt;&lt;/p&gt;
        &lt;p&gt;&lt;div class=&#34;align-center&#34; style=&#34;font-weight: bold;&#34;&gt;
            Node-RED screenshot
        &lt;/div&gt;&lt;/p&gt;
    


&lt;p&gt;The flow may be useful to somebody else to understand how to parse an HTML page,
but mainly people from the Rhône-Alpes area, France will use it :)&lt;/p&gt;
&lt;p&gt;So copy the following flow, and insert it in your Node-RED page
(Import-&amp;gt;Clipboard-&amp;gt;Paste). It can be tested by clicking on the &lt;code&gt;Start flow&lt;/code&gt;
button.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;[
  {
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;b82a5ab2.47d5a8&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;mqtt-broker&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;broker&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;localhost&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;port&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;1883&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;clientid&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Node-RED&amp;#34;&lt;/span&gt;
  },
  {
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;9f2c1b12.60d3e8&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;inject&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;z&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;d99ce1.ff26632&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Start flow&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;topic&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;payload&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;payloadType&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;date&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;repeat&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;3600&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;crontab&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;once&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;x&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;138.99993896484375&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;y&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;102.55555311838782&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;wires&amp;#34;&lt;/span&gt;: [[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;e9f3befe.160c4&amp;#34;&lt;/span&gt;]]
  },
  {
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;e9f3befe.160c4&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;http request&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;z&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;d99ce1.ff26632&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;method&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;GET&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;ret&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;txt&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;url&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;http://www.air-rhonealpes.fr/indice/atmo&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;x&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;218.99993896484375&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;y&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;159.55555311838782&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;wires&amp;#34;&lt;/span&gt;: [[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;30106e06.cfef92&amp;#34;&lt;/span&gt;]]
  },
  {
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;30106e06.cfef92&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;switch&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;z&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;d99ce1.ff26632&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Check HTTP status&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;property&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;statusCode&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;rules&amp;#34;&lt;/span&gt;: [
      { &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;t&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;eq&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;v&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;200&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;v2&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; },
      { &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;t&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;neq&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;v&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;200&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;v2&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; }
    ],
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;checkall&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;true&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;outputs&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;x&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;319.49993896484375&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;y&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;208.8888966242472&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;wires&amp;#34;&lt;/span&gt;: [[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;473dec33.b8c214&amp;#34;&lt;/span&gt;], [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;4c47b272.b3b84c&amp;#34;&lt;/span&gt;]]
  },
  {
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;473dec33.b8c214&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;function&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;z&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;d99ce1.ff26632&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Extract data&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;func&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;var msg = { payload:msg.payload.split(\&amp;#34;&amp;lt;tr class=\\\&amp;#34;odd\\\&amp;#34;&amp;gt;\&amp;#34;)[3].split(\&amp;#34;span\&amp;#34;)[3].substr(24, 1) };\n\nreturn msg;&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;outputs&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;1&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;noerr&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;x&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;526.4999771118164&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;y&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;176.66666507720947&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;wires&amp;#34;&lt;/span&gt;: [[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;4dfde937.b20218&amp;#34;&lt;/span&gt;]]
  },
  {
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;576fcefb.a8903&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;mqtt out&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;z&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;d99ce1.ff26632&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;topic&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/raw/Outside/AirQuality&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;qos&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;0&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;retain&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;false&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;broker&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;b82a5ab2.47d5a8&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;x&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;975.4999771118164&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;y&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;176.66666507720947&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;wires&amp;#34;&lt;/span&gt;: []
  },
  {
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;4c47b272.b3b84c&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;function&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;z&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;d99ce1.ff26632&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Add error message&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;func&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;msg.payload = \&amp;#34;Erreur - Impossible de récupérer la polution de Grenoble @\&amp;#34; + msg.url\nreturn msg;&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;outputs&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;noerr&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;x&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;549.4999771118164&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;y&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;236.66666507720947&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;wires&amp;#34;&lt;/span&gt;: [[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;76bea7bc.894158&amp;#34;&lt;/span&gt;]]
  },
  {
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;1319a2fc.ece65d&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;comment&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;z&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;d99ce1.ff26632&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Get the data from http://www.air-rhonealpes.fr&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;info&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;1. Every hour, get the RSS feed from \&amp;#34;Air rhone alpes\&amp;#34;\n2. Parse it to find last report URL\n3. Get the report and extract the data&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;x&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;190.5&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;y&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;40&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;wires&amp;#34;&lt;/span&gt;: []
  },
  {
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;4dfde937.b20218&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;rbe&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;z&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;d99ce1.ff26632&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Block unless value change&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;func&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;rbe&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;gap&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;x&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;731.5&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;y&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;180&lt;/span&gt;,
    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;wires&amp;#34;&lt;/span&gt;: [[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;576fcefb.a8903&amp;#34;&lt;/span&gt;]]
  }
]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Install eMonCMS on OVH shared hosting</title>
      <link>https://notes.iopush.net/blog/2015/install-emoncms-on-ovh-shared-hosting/</link>
      <pubDate>Fri, 16 Jan 2015 12:48:00 +0000</pubDate>
      
      <guid>https://notes.iopush.net/blog/2015/install-emoncms-on-ovh-shared-hosting/</guid>
      <description>&lt;p&gt;First, post :)&lt;/p&gt;
&lt;p&gt;I am currently testing &lt;a href=&#34;http://emoncms.org/&#34;&gt;Emoncms&lt;/a&gt; as a part of my home
automation system, it is a tool to store house’s data and which should allow us
to analyze it from an “energetically point of view”. It is a part of the
&lt;a href=&#34;http://openenergymonitor.org/&#34;&gt;OpenEnergyMonitor&lt;/a&gt; project.&lt;/p&gt;
&lt;p&gt;Emoncms’s servers seem to be quite overloaded so I decided to host it myself. It
should have been easy as good documentation is provided, but, it was not!&lt;/p&gt;
&lt;p&gt;First, follow the instructions on the website. Then change the root’s
“.htaccess” file to add the following lines&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Set PHP version, otherwise OVH use version 4.3
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;SetEnv&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;PHP_VER&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_4&lt;/span&gt;
&lt;span style=&#34;color:#75715e&#34;&gt;# Disable magic quotes
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;SetEnv&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;MAGIC_QUOTES&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then try to create an account. If it does not work, but you have just a red box
displayed, it could be good to have a look at your MySQL database: on my
installation, the script did not create the tables. So I commented the &lt;code&gt;if&lt;/code&gt;
condition in the file index.php:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;L57&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;and&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;L59&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;in&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;the&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;current&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;version&lt;/span&gt;)
&lt;span style=&#34;color:#75715e&#34;&gt;// if (!db_check($mysqli,$database)) {
&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;db_schema_setup&lt;/span&gt;($mysqli,&lt;span style=&#34;color:#a6e22e&#34;&gt;load_db_schema&lt;/span&gt;(),&lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;);
&lt;span style=&#34;color:#75715e&#34;&gt;// }
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally reload the page, check if the tables are created and uncomment.&lt;/p&gt;
&lt;p&gt;Now, it should work! If you are wondering what address you must use for the data
folder, it is “/home/yourID/yourEmoncmsData” if you put the data folder at the
same level as “www” to hide it from the internet. No need to change permissions.&lt;/p&gt;
&lt;p&gt;Thanks to Olivier for the
‘&lt;a href=&#34;http://play.with.free.fr/index.php/installation-emoncms-sur-serveur-mutualise-ovh/&#34;&gt;magic quotes tip&lt;/a&gt;’.&lt;/p&gt;
&lt;p&gt;I used Emoncms V8.4.0&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
