Sent data to Mqqt Display with blocky

Moderator: leecollings

Post Reply
spike318
Posts: 20
Joined: Saturday 09 January 2021 18:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Sent data to Mqqt Display with blocky

Post by spike318 »

i've built this https://www.instructables.com/MAX7219-L ... g-Esp8266/ and now i wonder how can i sent some data to this display, i want to see the power from my P1 device, how can i siply made this with blocky, or another language, i want do display realtime, use or export energy ?

Can somenone please help me, i did'nt find it on google

Gtz Spike
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Sent data to Mqqt Display with blocky

Post by FireWizard »

Hi, @spike318,

About Blocky I do not know. dZvents may work very well.

As you have already installed a Mosquitto MQTT broker (otherwise your display will not work) also Node Red is a very nice and easy solution.

Regards
spike318
Posts: 20
Joined: Saturday 09 January 2021 18:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sent data to Mqqt Display with blocky

Post by spike318 »

I have a broker and on my rapherry pi is also node red installed. I just need a simple example to start with
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Sent data to Mqqt Display with blocky

Post by FireWizard »

Hello @spike318

Okay, I will show an example.

If I´m correct and as I saw on the link you provided, we have to send a message to the MQTT server as follows:
{
topic: "leddisplay/text",
payload: "your message here"
}
You can also set the intensity and scroll speed..
{
topic: "leddisplay/intensity",
payload: "2" // max is 15 and min 0
}
{
topic: "leddisplay/scroll",
payload: "100" // max is 255 and min 0
}
As an example we will send the Current Power Consumption of the P1 Smart Meter Device.

Step 1.

Drag and drop a MQTT input node and configure it in such a way that it communicates with Domoticz and the topic domoticz/out.

Screenshot_Display kWh2.png
Screenshot_Display kWh2.png (19.75 KiB) Viewed 1140 times
The output of this node will present all Domoticz devices. This is not what we want, as we only want the P1 Smart meter.
So go to Domoticz and search in the Setup ==> Devices for your Smart Meter and note its IDX number.

The next node we need is a "Switch" node in order to filter only the Smart Meter Device.

Screenshot_Display kWh3.png
Screenshot_Display kWh3.png (13.98 KiB) Viewed 1140 times
In my case the Smart Meter has IDX 17. Replace this number with the IDX of your Smart Meter.

The next node we will use is a "Function" node.

The contents of this node is as follows:

Code: Select all

msg.payload = "Power Consumption: " + msg.payload.svalue5 + " Watt";
return msg;
This will give a text as "Power Consumption: 123 Watt" on your display.

The final node is a MQTT Output node which publishes the value to the MQTT server (broker).
Configure this with the topic "leddisplay/text".

The result is then as follows:

Screenshot_Display kWh1.png
Screenshot_Display kWh1.png (60.52 KiB) Viewed 1140 times
Please find the complete flow below:

Code: Select all

[{"id":"a73572f2.89ada8","type":"tab","label":"Display","disabled":false,"info":""},{"id":"f2f584b1.fdc038","type":"mqtt in","z":"a73572f2.89ada8","name":"MQTT from Domoticz","topic":"domoticz/out","qos":"2","datatype":"json","broker":"8591549f.77809","nl":false,"rap":true,"rh":0,"x":620,"y":120,"wires":[["d5cf83b.84a41"]]},{"id":"d5cf83b.84a41","type":"switch","z":"a73572f2.89ada8","name":"Filter Smart Meter","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"17","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":870,"y":120,"wires":[["212d3b58.1abc14","73a88cc5.8188f4"]]},{"id":"212d3b58.1abc14","type":"debug","z":"a73572f2.89ada8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1090,"y":60,"wires":[]},{"id":"73a88cc5.8188f4","type":"function","z":"a73572f2.89ada8","name":"","func":"//var power_consumption = msg.payload\nmsg.payload = \"Power Consumption: \" + msg.payload.svalue5 + \" Watt\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":120,"wires":[["c775a64d.63aac","d984877c.6eee08"]]},{"id":"c775a64d.63aac","type":"mqtt out","z":"a73572f2.89ada8","name":"MQTT to Display","topic":"leddisplay/text","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"8591549f.77809","x":1290,"y":120,"wires":[]},{"id":"d984877c.6eee08","type":"debug","z":"a73572f2.89ada8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1270,"y":180,"wires":[]},{"id":"8591549f.77809","type":"mqtt-broker","name":"Jonas_MQTT_Server","broker":"192.168.10.24","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Let me know.

Best regards
Last edited by FireWizard on Wednesday 14 April 2021 9:14, edited 1 time in total.
spike318
Posts: 20
Joined: Saturday 09 January 2021 18:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sent data to Mqqt Display with blocky

Post by spike318 »

I will test it verry much thanks for the help 👍👍👍👍
spike318
Posts: 20
Joined: Saturday 09 January 2021 18:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sent data to Mqqt Display with blocky

Post by spike318 »

I've created the node red functions
2021-04-14 10_24_18-Window.png
2021-04-14 10_24_18-Window.png (20.11 KiB) Viewed 1104 times
and i think this is working because i see some data in my mqqt explorer
2021-04-14 10_24_18-Window.png
2021-04-14 10_24_18-Window.png (20.11 KiB) Viewed 1104 times
but my display is notworking perhaps i need to do some recode ? or can i use Tasmota or ESP easy for this, or does anyone has another example ?
Attachments
2021-04-14 10_27_21-Window.png
2021-04-14 10_27_21-Window.png (4.28 KiB) Viewed 1104 times
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Sent data to Mqqt Display with blocky

Post by FireWizard »

Hello @spike318

You wrote:
I've created the node red functions and i think this is working because i see some data in my mqqt explorer but my display is not working perhaps i need to do some recode ? or can i use Tasmota or ESP easy for this, or does anyone has another example ?
I think you are right, that the correct information is sent to the MQTT server.

However I´m afraid that your MQTT client in your display unit is not polling the MQTT server.

Is there a method in your display unit, in order to see the communication. Otherwise you may try a tool like Wireshark to check if there is communication between your display unit and the MQTT server,

Also you can try MQTT Explorer to test the other functions of your display unit, like leddisplay/intensity and/or leddisplay/scroll.

If this does not function either, there is big change that you unit is not polling the MQTT server.

You did change the following in the ESP8266 software:

Code: Select all

#define MAX_DEVICES 4 // your device count

#define CLK_PIN   D5 // or SCK
#define DATA_PIN  D7 // or MOSI
#define CS_PIN    D4 // or SS // you can set it to any pin
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW // change according to your display type
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
and

Code: Select all

EspMQTTClient client(
  "YOUR_SSID",
  "YOUR_WIFI_PASSWORD",
  "YOUR_MQTT_SERVER",  // MQTT Broker server ip
  "YOUR_MQTT_USER",   // Can be omitted if not needed
  "YOUR_MQTT_PASSWORD",   // Can be omitted if not needed
  "MAX7219_DISPLAY",     // Client name that uniquely identify your device
  1883              // The MQTT port, default to 1883. this line can be omitted
);
If you want to check the MQTT Client (Your display unit) you can have a look at: http://www.steves-internet-guide.com/ch ... nnections/ However I never used that tool.

Regards
spike318
Posts: 20
Joined: Saturday 09 January 2021 18:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sent data to Mqqt Display with blocky

Post by spike318 »

Hi

Yes Yes i finnaly got it to work, i had some inssue's with IDE, i removed al the installed, libraries and then only reinstalled what i needed and than the compile went ok and i got some text on my display
P_20210415_084851.jpg
P_20210415_084851.jpg (79.34 KiB) Viewed 1067 times
Thankz a lot for helping me out now i can start to experiment more !!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests