# Helpful criticism requested

**URL:** <https://discourse.nodered.org/t/helpful-criticism-requested/1435>\
**Category:** General\
**Created:** [7 July 2018 19:08 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435 "2018-07-07T19:08:19Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 July 2018 19:11 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/22 "2018-07-08T19:11:40Z")

</div>

> [@Backup](#):
>
> Your suggestion is what I ended up with after looking over Colin's sample flows.

Are you sure they were my flows?

---

<div class="post-metadata">

**Author:** ![Backup](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/backup/32/862_2.png) [@Backup](https://discourse.nodered.org/u/Backup)\
**Post date:** [8 July 2018 19:26 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/23 "2018-07-08T19:26:45Z")

</div>

You spoke of your influxdb node so I assumed this one was yours.

> **[node-red-contrib-influxdb](https://flows.nodered.org/node/node-red-contrib-influxdb)**
>
> Node-RED nodes to save and query data from an influxdb time series database

Wrong?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 July 2018 20:41 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/24 "2018-07-08T20:41:02Z")

</div>

> [@Backup](#):
>
> You spoke of your influxdb node

Are you sure I did? If so it was a slip of the finger.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [8 July 2018 21:32 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/25 "2018-07-08T21:32:29Z")

</div>

> [@cflurin](#):
>
> It's always a good start point evolving a new task using a function node. In a second step you might try to use the build in or contrib nodes.

I'd argue the complete opposite 🙂

I only write a function node if the standard nodes (or an existing contrib node) can't handle the job

Each to their own of course

But I see the main strength of Node-RED as a way of avoiding coding in javascript in the 1st place 🙂

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 July 2018 21:46 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/26 "2018-07-08T21:46:45Z")

</div>

The correct answer is of course both ways are right. It's whatever gets the job done for you 🚀

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [8 July 2018 22:01 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/27 "2018-07-08T22:01:58Z")

</div>

> [@cymplecy](#):
>
> But I see the main strength of Node-RED as a way of avoiding coding in javascript in the 1st place 🙂

The modular structure of node-red encourages learning.  
I started just using the 'stock' nodes, but very quickly found that I could replace some nodes more efficiently with a few lines of JavaScript in a function node, and suddenly found that I was coding.

That's got to be a good thing? why avoid it?

Paul

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [8 July 2018 22:44 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/28 "2018-07-08T22:44:03Z")

</div>

> [@Paul-Reed](#):
>
> why avoid it?

I've never really learnt javascript properly 🙂

I always try and use blocks programmed by someone else before rolling my sleeves up 🙂

(And only then if I can't use a 1 line JSONata expression)

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [9 July 2018 01:46 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/29 "2018-07-09T01:46:07Z")

</div>

> [@cymplecy](#):
>
> I'd argue the complete opposite 🙂
> 
> I only write a function node if the standard nodes (or an existing contrib node) can't handle the job
> 
> Each to their own of course
> 
> But I see the main strength of Node-RED as a way of avoiding coding in javascript in the 1st place 🙂

You are obviously an advanced node-red user.

I saw most of the beginners starting with coding functions probably because this is the easiest way when you don't know the potential of the build-in or contrib nodes.  
It also depends on your background and programming experience.

At the beginning I used much more function nodes, the most of them have been replaced by build-in or contrib nodes and now sometime I prefer to develop contrib-nodes with the goal of simplify flows.

And there are use cases where it's better to use e.g. MQTT to exchange data with external applications.

Anyway this's only my opinion.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 July 2018 08:39 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/30 "2018-07-09T08:39:17Z")

</div>

> [@Paul-Reed](#):
>
> I started just using the 'stock' nodes, but very quickly found that I could replace some nodes more efficiently with a few lines of JavaScript in a function node, and suddenly found that I was coding.

It all depends on what you mean by efficiency. If you are interested in processor resources then a function node takes up a lot more than a regular node, if that is your goal then better to use a handful of regular nodes rather than one function node. However if several nodes are required where a few lines of js will do the job then that route may well be preferable from the point of view of tidiness and making the flow more understandable. In practice very few systems run out of processor resources anyway.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [9 July 2018 08:44 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/31 "2018-07-09T08:44:51Z")

</div>

> [@cflurin](#):
>
> You are obviously an advanced node-red user.

Not at all - just really started with it a few months ago

I'm just a very poor javascript programmer

---

<div class="post-metadata">

**Author:** ![Backup](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/backup/32/862_2.png) [@Backup](https://discourse.nodered.org/u/Backup)\
**Post date:** [9 July 2018 15:23 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/32 "2018-07-09T15:23:27Z")

</div>

I rarely use more than 3% of my Raspberry Pi3 cpu power. If I install updates or do a full deploy of my flow it may reach 30%. I remember the days of strict data type when I could save 3 bytes of space by using type byte rather than word and I thought I'd never fill up my 10Mbyte hard drive.

---

<div class="post-metadata">

**Author:** ![Backup](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/backup/32/862_2.png) [@Backup](https://discourse.nodered.org/u/Backup)\
**Post date:** [12 July 2018 03:03 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/33 "2018-07-12T03:03:05Z")

</div>

Back on topic. I found that if I want to 'tag' a measurement I need my java script. I don't see how to build an object using dceejay's delay and join nodes. Using a 'tag' requires a complex object that I don't see delay and join accomplishing.

This is what is required to add a tag,

```auto
if (context.get('enable') === true){
            msg.payload=[{
               AMBIENT:context.get('ambient')||0,
               BREWBOX:context.get('brewbox')||0,
            BREWBUCKET:context.get('brewbucket')||0,
              SETPOINT:context.get('setpoint')||0,
                  HEAT:context.get('heat')||0,
                  COOL:context.get('cool')||0},{
               'batch':'Trial' // tag added here
                }]

```

I also discovered that using 'tag' as a tag field identifier really fouls things up.

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [12 July 2018 07:10 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/34 "2018-07-12T07:10:35Z")

</div>

If the tag is always "Trial", you can add a change node after the join node:

![change1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/584996bb34bfd00ae9d968dee6c88f39fa5de20a.jpeg)

---

<div class="post-metadata">

**Author:** ![Backup](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/backup/32/862_2.png) [@Backup](https://discourse.nodered.org/u/Backup)\
**Post date:** [12 July 2018 16:04 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/35 "2018-07-12T16:04:42Z")

</div>

OK, but the idea of the tag is so that a specific batch can be identified more easily than by a date range. This is assuming that Grafana can be taught to select by tag.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [12 July 2018 16:28 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/36 "2018-07-12T16:28:48Z")

</div>

ok, since you want some criticism, howabout fixint the title 'requested' not 'requ`r`ested' 😛

---

<div class="post-metadata">

**Author:** ![Backup](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/backup/32/862_2.png) [@Backup](https://discourse.nodered.org/u/Backup)\
**Post date:** [12 July 2018 16:38 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/37 "2018-07-12T16:38:59Z")

</div>

Fixint(g) criticism happily received. 😄

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [12 July 2018 17:07 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/38 "2018-07-12T17:07:26Z")

</div>

> [@Backup](#):
>
> OK, but the idea of the tag is so that a specific batch can be identified more easily than by a date range. This is assuming that Grafana can be taught to select by tag.

Does it mean you need a different batch name for every record?

---

<div class="post-metadata">

**Author:** ![Backup](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/backup/32/862_2.png) [@Backup](https://discourse.nodered.org/u/Backup)\
**Post date:** [12 July 2018 17:10 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/39 "2018-07-12T17:10:26Z")

</div>

Not every record but a measurement for a batch of say, Corona Extra clone. I'm not sure it will even work. I'm still experimenting during reset times.

---

<div class="post-metadata">

**Author:** ![Backup](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/backup/32/862_2.png) [@Backup](https://discourse.nodered.org/u/Backup)\
**Post date:** [12 July 2018 17:16 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/40 "2018-07-12T17:16:44Z")

</div>

I'm still working on the logic. I can filter data in Grafana by adding a field to the WHERE clause but with 6 series in a graph I really don't want to have to change every query to see a past batch.  
Work in progress.

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [12 July 2018 17:17 UTC](https://discourse.nodered.org/t/helpful-criticism-requested/1435/41 "2018-07-12T17:17:00Z")

</div>

Ok, then you have to set the batch name for a measurement depending on your criteria before the delay node.

Aha, the best will be if you can at the end post a working flow.

[Previous page](https://discourse.nodered.org/t/helpful-criticism-requested/1435.md?page=1)

[Next page](https://discourse.nodered.org/t/helpful-criticism-requested/1435.md?page=3)
