# Mac address Raspberry pi 4

**URL:** <https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649>\
**Category:** Dashboard\
**Created:** [26 March 2020 03:54 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649 "2020-03-26T03:54:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ezequiel\_barros](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ezequiel\_barros](https://discourse.nodered.org/u/ezequiel_barros)\
**Post date:** [26 March 2020 03:54 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/1 "2020-03-26T03:54:01Z")

</div>

I would like to present on a dashboard the mac adress of the network adapter in use (wifi or network cable) on the Raspberry Pi 4

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [26 March 2020 04:11 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/2 "2020-03-26T04:11:40Z")

</div>

First question is, do you know how to get that information from the command line in Raspbian?

If you do then take a look at the "Exec" node, as it can emulate the command line. Next, you may need to sanitise the output so you can use a "Function" node to do that. Then send the output to a dashboard text node.

---

<div class="post-metadata">

**Author:** ![ezequiel\_barros](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ezequiel\_barros](https://discourse.nodered.org/u/ezequiel_barros)\
**Post date:** [26 March 2020 04:30 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/3 "2020-03-26T04:30:17Z")

</div>

I can list this information through the ifconfig command through LXteminal, but my question is how to filter on Function only the mac adress .. thanks for the help

Below is the code I am testing

ifconfig = msg.payload;  
wlan0 = ifconfig.indexOf ("wlan0");  
start = ifconfig.indexOf ("ether", wlan0) + 7;  
addr = ifconfig.substring (start, ifconfig.indexOf ('', start));  
return {payload: addr};

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [26 March 2020 04:43 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/4 "2020-03-26T04:43:06Z")

</div>

The other option in this case for the Function node (which makes things easier to visualise) is to use something like `node-red-contrib-string`. It has many options making extraction very easy.

---

<div class="post-metadata">

**Author:** ![ezequiel\_barros](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ezequiel\_barros](https://discourse.nodered.org/u/ezequiel_barros)\
**Post date:** [26 March 2020 05:05 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/5 "2020-03-26T05:05:22Z")

</div>

ok, i found and installed the node-red-contrib-string through the manager pallet menu as your guidance .. can you tell me if you are going to present a new node in the list? that I can use for this situation?

thanks again for your attention

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [26 March 2020 05:08 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/6 "2020-03-26T05:08:44Z")

</div>

> [@ezequiel\_barros](#):
>
> can you tell me if you are going to present a new node in the list?

Sorry, not sure I understand your meaning here. Do you mean, should there be a new node in your palette after installation? The answer is yes. Restart NR and refresh your browser. It should be there.

---

<div class="post-metadata">

**Author:** ![ezequiel\_barros](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ezequiel\_barros](https://discourse.nodered.org/u/ezequiel_barros)\
**Post date:** [26 March 2020 05:24 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/7 "2020-03-26T05:24:02Z")

</div>

Yes. It was exactly what I say ... I already restarted NR..Do you know if this new node will enter an existing category such as network? and what would be the description so that I can find it in the filter?

 ![Screenshot_2020-03-26 Node-RED](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f8b883dc439801379c16028c570e18cce0dc1b85.png)

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [26 March 2020 05:25 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/8 "2020-03-26T05:25:53Z")

</div>

> [@ezequiel\_barros](#):
>
> Do you know if this new node will enter an existing category such as network?

It should be in the Function section, coloured grey, called string.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [26 March 2020 05:26 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/9 "2020-03-26T05:26:15Z")

</div>

Why do you need the value to be _dynamic_? It is a fixed value/number.

In a _terminal_ of the RasPi, enter `ifconfig` and get the MAC address.

Then you enter that in a `text` node, or what ever it is you are going to use to display it.

What you are doing is not impossible, but I fail to see why you are making it complicated.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [26 March 2020 05:27 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/10 "2020-03-26T05:27:56Z")

</div>

At the top of the list of nodes you have there is a `search` box.

Enter `string` in there and you will see the `string` node.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [26 March 2020 05:37 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/11 "2020-03-26T05:37:39Z")

</div>

This is a link on how to get your MAC address and what it looks like.

As there are three ways of doing it, the first is the easiest.

[How to get MAC address](https://raspberrytips.com/mac-address-on-raspberry-pi/)

---

<div class="post-metadata">

**Author:** ![meeki007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/meeki007/32/12499_2.png) [@meeki007](https://discourse.nodered.org/u/meeki007)\
**Post date:** [26 March 2020 06:00 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/12 "2020-03-26T06:00:37Z")

</div>

I pulled this out of one of my projects.

You will need [node-red-contrib-string](https://flows.nodered.org/node/node-red-contrib-string)

 ![wifi_ethernet](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/c/ecf13548e07ca5256a17aa20afb31db49edac601.png)

```auto
[{"id":"ac5f3bc2.7af238","type":"string","z":"5d144921.4c8e28","name":"WiFi_MAC","methods":[{"name":"between","params":[{"type":"str","value":"wlan0"},{"type":"str","value":"brd"}]},{"name":"between","params":[{"type":"str","value":"ether "},{"type":"str","value":" "}]}],"prop":"payload","propout":"WiFi_MAC","object":"msg","objectout":"msg","x":490,"y":220,"wires":[["2a97d89b.a82a6"]]},{"id":"2a97d89b.a82a6","type":"string","z":"5d144921.4c8e28","name":"Ethernet_MAC","methods":[{"name":"between","params":[{"type":"str","value":"eth0"},{"type":"str","value":"brd"}]},{"name":"between","params":[{"type":"str","value":"ether "},{"type":"str","value":" "}]}],"prop":"payload","propout":"Ethernet_MAC","object":"msg","objectout":"msg","x":660,"y":220,"wires":[["c55f98b7.d57e28"]]},{"id":"dd05af2c.827798","type":"exec","z":"5d144921.4c8e28","command":"ip link show","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"MAC address","x":300,"y":220,"wires":[["ac5f3bc2.7af238"],[],[]]},{"id":"a2372238.3b939","type":"inject","z":"5d144921.4c8e28","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":220,"wires":[["dd05af2c.827798"]]},{"id":"2b46f305.e479d4","type":"debug","z":"5d144921.4c8e28","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1010,"y":220,"wires":[]},{"id":"c55f98b7.d57e28","type":"change","z":"5d144921.4c8e28","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":220,"wires":[["2b46f305.e479d4"]]}]

```

---

<div class="post-metadata">

**Author:** ![ezequiel\_barros](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ezequiel\_barros](https://discourse.nodered.org/u/ezequiel_barros)\
**Post date:** [26 March 2020 06:03 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/13 "2020-03-26T06:03:16Z")

</div>

Ok, I found the new node string, answering your question I don't need anything very complex ... just that I list in my dashbord the mac address of the network adapter being used, which may be the wired card or wifi card, about the link you sent me would like to use the easiest option that would be the first

follow the image for illustration I made the change as directed .. this is presenting a number for the mac address but not the one corresponding to the card used at the moment .. analyzing through the node-red console I found that this number is the error cod

 ![Screenshot_2020-03-26 Node-RED(1)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/f/9f477ba979185e41c30644f3434764221bb2952a.png) ![Screenshot_2020-03-26 Fluxbeer Dashboard](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e7c23ffd4b03365ff1c38f8dde185af97a975040.png)

---

<div class="post-metadata">

**Author:** ![meeki007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/meeki007/32/12499_2.png) [@meeki007](https://discourse.nodered.org/u/meeki007)\
**Post date:** [26 March 2020 06:15 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/14 "2020-03-26T06:15:20Z")

</div>

@ezequiel_barros Don't leave us hanging if you get it working post a screen shot 😛

also don't stop there you can do some real cool stuff with the dashboard and a Raspberry PI

 ![static](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/5/159313b95282dfd2e6c71ee4484dd442e84b3ff3.png)

---

<div class="post-metadata">

**Author:** ![ezequiel\_barros](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ezequiel\_barros](https://discourse.nodered.org/u/ezequiel_barros)\
**Post date:** [26 March 2020 06:22 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/15 "2020-03-26T06:22:47Z")

</div>

@meeki007  
thank you so much for your help ... the information you posted now would help me a lot on my raspberry monitoring panel too 🙂

---

<div class="post-metadata">

**Author:** ![meeki007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/meeki007/32/12499_2.png) [@meeki007](https://discourse.nodered.org/u/meeki007)\
**Post date:** [26 March 2020 06:32 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/16 "2020-03-26T06:32:20Z")

</div>

@ezequiel_barros

For a monitoring panel I use RPI-Monitor as it has a JSON output section.  
so you can do things like this.

 ![monitor](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/b/db5dfb0dee732fc182e6a6314b5714b443427da0.png)

Here is just the CPU load section so you can start somewhere.... the rest is up to you.

```auto
[{"id":"6e9cdd8e.c16c2c","type":"http request","z":"5d144921.4c8e28","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"http://127.0.0.1:8888/dynamic.json","tls":"","persist":false,"proxy":"","authType":"","x":610,"y":380,"wires":[["7e214f58.385e8"]]},{"id":"246d5f06.0e518","type":"ui_gauge","z":"5d144921.4c8e28","name":"","group":"df127116.d46ea","order":2,"width":3,"height":3,"gtype":"gage","title":"CPU Load","label":"","format":"{{value | number:2}}%","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"50","seg2":"75","x":730,"y":420,"wires":[]},{"id":"7e214f58.385e8","type":"function","z":"5d144921.4c8e28","name":"","func":"\n// CPU Load into Percentage\nmsg.CPU_Load_percentage = (msg.payload.load1 / 4) * 100;\n\n\nreturn msg;","outputs":1,"noerr":0,"x":750,"y":380,"wires":[["fec91f99.b2dc38"]]},{"id":"cda96494.3e1828","type":"change","z":"5d144921.4c8e28","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload2","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":380,"wires":[["6e9cdd8e.c16c2c"]]},{"id":"fec91f99.b2dc38","type":"change","z":"5d144921.4c8e28","name":"","rules":[{"t":"move","p":"CPU_Load_percentage","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":420,"wires":[["246d5f06.0e518"]]},{"id":"e99c3ca8.262b18","type":"http request","z":"5d144921.4c8e28","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"http://127.0.0.1:8888/static.json","tls":"","persist":false,"proxy":"","authType":"","x":250,"y":380,"wires":[["cda96494.3e1828"]]},{"id":"727b29a7.61c48","type":"inject","z":"5d144921.4c8e28","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":380,"wires":[["e99c3ca8.262b18"]]},{"id":"df127116.d46ea","type":"ui_group","z":"","name":"System_Status","tab":"9587580.e6ae3a8","order":1,"disp":false,"width":8,"collapse":false},{"id":"9587580.e6ae3a8","type":"ui_tab","z":"","name":"System","icon":"dashboard","order":4,"disabled":false,"hidden":false}]

```

Link to RPI-monitor  
[https://xavierberger.github.io/RPi-Monitor-docs/11\_installation.html](https://xavierberger.github.io/RPi-Monitor-docs/11_installation.html)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [26 March 2020 08:25 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/17 "2020-03-26T08:25:56Z")

</div>

Its nice to see I am not the only _data nut_ out here.

This is my pride - well, one of them.

 ![Screenshot from 2020-03-26 19-20-00](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/4/e48c123a8fdbf8501ee42f178d12cd2249e222af.png)

That is the _main_ machine and this is what the remote ones have:

 ![Screenshot from 2020-03-26 19-21-27](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/b/9b0aa645bcfb69f92c02d5614284ac6676e2b503.png)

I could show you more, but I think that is just showing off.  
I have been messing around a few years with Node-Red.

The big one shows the device states, WAP states and the two main machine's CPU load.  
Then you have the row of temperatures and history. And at the bottom - just visible - are all the CPU loads for the machines.

The second one shows you the temperature and CPU load, the state of a couple of important links. A list of events for the **uplink** and the error control panel.

I have a whole screen for machine health. (Sorry, starting to brag too much.)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [26 March 2020 08:30 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/18 "2020-03-26T08:30:07Z")

</div>

> [@meeki007](#):
>
> RPI-Monitor as it has a JSON output section.

~~Could you elaborate on what `RPI-Monitor` is? I searched the library and couldn't find a `RPI-monitor` listed.~~

SORRY!

I didn't read the bit at the bottom.

---

<div class="post-metadata">

**Author:** ![ezequiel\_barros](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ezequiel\_barros](https://discourse.nodered.org/u/ezequiel_barros)\
**Post date:** [26 March 2020 13:28 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/19 "2020-03-26T13:28:17Z")

</div>

I still haven't been able to present the mac address of my raspberry. can someone post json in a very simple way

thank you for your help so far

---

<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:** [26 March 2020 15:57 UTC](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649/20 "2020-03-26T15:57:06Z")

</div>

in an `exec` node use eithor  
`cat /sys/class/net/eth0/address`  
`cat /sys/class/net/lo/address` or  
`cat /sys/class/net/wlan0/address`  
depending on which one you want.

[Next page](https://discourse.nodered.org/t/mac-address-raspberry-pi-4/23649.md?page=2)
