ottopaulsen / MMM-MQTT

MQTT Client module for MagicMirror2
MIT License
57 stars 29 forks source link

How do I specify a specific payload where I have a Topic with multiple payloads. #73

Open fritserasmus opened 6 months ago

fritserasmus commented 6 months ago

This is an example of the Topic and Payload(s) string from an inverter

sbfspot/2130438237 {"Timestamp": "09/05/2024 14:43:38","SunRise": "09/05/2024 06:37:00","SunSet": "09/05/2024 17:30:00","InvSerial": 2130438237,"InvName": "SB 4000TL-21 237 Links","InvTime": "09/05/2024 14:43:34","InvStatus": "Ok","InvTemperature": 39.580,"InvGridRelay": "Closed","EToday": 10.217,"ETotal": 37005.084,"PACTot": 388.000,"UDC1": 64.550,"UDC2": 0.000,"IDC1": 5.717,"IDC2": 1.281,"PDC1": 368.000,"PDC2": 0.000,"GridFreq": 51.800}

I would like to show the value of sbfspot/2130438237 Payload.PDC1 (being 368.000 in the string above) how do I specify that?

Thanking you in advance Frits

chimeranzl commented 3 months ago

try

                        {
                            topic: 'sbfspot/2130438237 ',
                            label: 'ABC',
                            jsonpointer: '/PDC1',
                            suffix: '',
                            maxAgeSeconds: 60,
                        },