Resol VBUS , Raspberry Pi, MQTT code, Thingspeak

716 views
Skip to first unread message

PH YT Largy

unread,
May 10, 2021, 9:29:04 AM5/10/21
to Resol Vbus
Hi All
I have my VBUS sending info to my Raspberry Pi and displaying temps on my iPhone through Daniel Wippermans code from here

I was also trying to send the results to Thingspeak via the MQTT code Daniel has implemented.  I have tried numerous variations but cant get the info to Thingspeak.

My config is as follows in config.js

 mqttConnect: {

        host: 'mqtt://mqtt.thingspeak.com',

        username: 'mosquitto',

        password: 'MQTT API key from Thingspeak',


mqttTopic: 'channels/12345channel id/publish/12345 Write API key',

 mqttPacketFieldMap: {

        temp1: '00_0010_427B_10_0100_000_2_0',

        field2: '00_0010_427B_10_0100_002_2_0',

        temp3: '00_0010_427B_10_0100_004_2_0',

        relay1: '00_0010_427B_10_0100_008_1_0',

        relay1hrs: '00_0010_427B_10_0100_010_2_0'

    },


ANy help or suggestion greatly appreciated.


Many thanks


paul




Craggy

unread,
May 10, 2021, 9:56:31 AM5/10/21
to Resol Vbus
Hi Paul

Not sure if it's any help but here's my working config to pull data into Homeassistant..

    mqttConnect: {
        host: '10.20.30.40',
    port: '1883',
        username: 'MY_USERNAME',
        password: 'MY_PASSWORD',
    },

    /**
     * MQTT topic to publish to.
     */
    mqttTopic: 'home/resol',

    /**
     * A map of MQTT message attributes to VBus packet field IDs.
     *
     * An example sensor in Home Assistant would be:
     * - platform: mqtt
     *    name: "Resol Collector Temp"
     *    state_topic: "home/resol"
     *    unit_of_measurement: '°C'
     *    value_template: "{{ value_json.temp1 }}"
     */
    mqttPacketFieldMap: {
        temp1: '00_0010_4720_10_0100_004_2_0',
        temp2: '00_0010_4720_10_0100_006_2_0',
        temp3: '00_0010_4720_10_0100_008_2_0',
        relay1: '00_0010_4720_10_0100_016_1_0',
        heatqty: '00_0010_4720_10_0100_020_4_0',
    relay1hrs: '00_0010_4720_10_0100_028_4_0',
    },


Here's the Homeassistant part:

  -  platform: mqtt
     name: "Solar Collector Temp"
     state_topic: "home/resol"
     unit_of_measurement: '°C'
     value_template: "{{ value_json.temp1 }}"
  -  platform: mqtt
     name: "Water Store Temp"
     state_topic: "home/resol"
     unit_of_measurement: '°C'
     value_template: "{{ value_json.temp2 }}"
  -  platform: mqtt
     name: "Water Store Top Temp"
     state_topic: "home/resol"
     unit_of_measurement: '°C'
     value_template: "{{ value_json.temp3 }}"
  -  platform: mqtt
     name: "Solar Pump Speed"
     state_topic: "home/resol"
     unit_of_measurement: '%'
     value_template: "{{ value_json.relay1 }}"
  -  platform: mqtt
     name: "Solar Pump Runtime"
     state_topic: "home/resol"
     unit_of_measurement: 'hrs'
     value_template: "{{ value_json.relay1hrs }}"

Has been working perfectly without a blip for two years.

Daniel Wippermann

unread,
May 10, 2021, 10:12:03 AM5/10/21
to Resol Vbus
Hi Paul,

the existing vbustouch-proxy example does not work as-is with Thingspeak. They expect published data to be URL encoded (like HTML forms). But the current vbustouch-proxy example JSON-encodes its data.

I have made some changes to the vbustouch-proxy to make it work with Thingspeak. It now supports a new config option „mqttEncoding“ which you should set to „urlencoded“.

My working Thingspeak MQTT config looks like this:

    /**
     * Interval (milliseconds) in which data will be uploaded to MQTT. A value of zero disables this functionality.
     */
    mqttInterval30000,

    /**
     * MQTT connect parameters, https://github.com/mqttjs/MQTT.js#connect
     */
    mqttConnect: {
        host'mqtt.thingspeak.com',
        // username: 'mosquitto',
        // password: 'secret',

    },

    /**
     * MQTT topic to publish to.
     */
    mqttTopic'channels/CHANNEL_ID/publish/API_KEY',

    /**
     * Specifies how the MQTT payload is encoded. Supports 'json' (default) and 'urlencoded'.
     */
    mqttEncoding'urlencoded',


    /**
     * A map of MQTT message attributes to VBus packet field IDs.
     *
     * An example sensor in Home Assistant would be:
     * - platform: mqtt
     *    name: "Resol Collector Temp"
     *    state_topic: "home/resol"
     *    unit_of_measurement: '°C'
     *    value_template: "{{ value_json.temp1 }}"
     */
    mqttPacketFieldMap: {
        field1'00_0010_7E11_10_0100_000_2_0',
        field2'00_0010_7E11_10_0100_002_2_0',
        field3'00_0010_7E11_10_0100_004_2_0',
        field4'00_0010_7E11_10_0100_006_2_0',
    },


I’ll push my changes in the next couple of minutes.

Hope that helps!

Best regards,
Daniel

--
You received this message because you are subscribed to the Google Groups "Resol Vbus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to resol-vbus+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/resol-vbus/bf917ba1-d48c-4b9b-8f68-2bd17f0eea85n%40googlegroups.com.

PH YT Largy

unread,
May 11, 2021, 11:50:10 AM5/11/21
to Resol Vbus
Brilliant Daniel thanks very much.
I could see that Thingspeak was getting updates but all data was 0.  Now i have updated with your changes it is all working great and getting results through to Thingspeak.

Thanks again for your help

Paul

PH YT Largy

unread,
May 11, 2021, 11:50:10 AM5/11/21
to Resol Vbus
Thanks Craggy.  I was getting Thingspeak to see my MQTT updates but it was not displaying any data.  Daniels edit below has now fixed it for me.
Paul

PH YT Largy

unread,
Apr 28, 2022, 7:56:30 AM4/28/22
to Resol Vbus
Something seems to have broken for me since 14 April 2022.  Suddenly stopped working.  When look at Thingsspeak they seem to have some new MQTT setup.  Ichanged my config .js to

 mqttConnect: {

        host: 'mqtt3.thingspeak.com',

        username: 'ORkAJzcVDzILCRsBGTEPJhw',

        password: 'secret hidden',

    },


    /**

     * MQTT topic to publish to.

     */

    mqttTopic: 'channels/1382505/publish/',

    /**

     * mqttTopic: 'channels/1382505/publish/B0PK1PT1N5FRNAF2',

    */

    /**

     * Specifies how the MQTT payload is encoded. Supports 'json' (default) and 'urlencoded'.

     */

    mqttEncoding: 'urlencoded',




Any suggestions as to what ssue may be.

Many thanks

paul



On Monday, 10 May 2021 at 15:12:03 UTC+1 Daniel wrote:

PH YT Largy

unread,
Apr 28, 2022, 10:23:42 AM4/28/22
to Resol Vbus
This is the error I am getting on Raspberry Pi

pi@Cot:~/resol-vbus/examples/vbustouch-proxy $ node index.js

debug: Connecting to VBus...

debug: Connection state changed to CONNECTING

debug: Connection state changed to CONNECTED

debug: Connected to VBus...

debug: Starting web server...

debug: Starting HeaderSetConsolidator timer...

debug: Starting MQTT logging

debug: Started web server at: 

debug:   - http://0.0.0.0:3000/ (internal)

debug:   - http://127.0.0.1:3000/ (internal)

debug:   - http://192.168.0.110:3000/

debug: 00_0010_427B_10_0100_000_2_0: Temperature sensor 1

00_0010_427B_10_0100_002_2_0: Temperature sensor 2

00_0010_427B_10_0100_004_2_0: Temperature sensor 3

00_0010_427B_10_0100_006_2_0: Temperature sensor 4

00_0010_427B_10_0100_008_1_0: Pump speed relay 1

00_0010_427B_10_0100_012_1_0: Pump speed relay 2

00_0010_427B_10_0100_010_2_0: Operating hours relay 1

00_0010_427B_10_0100_014_2_0: Operating hours relay 2

00_0010_427B_10_0100_016_1_0: UnitType

00_0010_427B_10_0100_017_1_0: System

00_0010_427B_10_0100_020_2_0: ErrorMask

00_0010_427B_10_0100_022_2_0: System time

00_0010_427B_10_0100_020_1_1: Sensor 1 defective

00_0010_427B_10_0100_020_1_2: Sensor 2 defective

00_0010_427B_10_0100_020_1_4: Sensor 3 defective

00_0010_427B_10_0100_020_1_8: Sensor 4 defective

00_0010_427B_10_0100_024_4_0: Status mask

00_0010_427B_10_0100_028_4_0: Heat quantity

00_0010_427B_10_0100_032_2_0: SW Version

00_0010_427B_10_0100_034_2_0: Variant

error: undefined

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}

error: undefined {"code":4}


thanks


paul



Daniel Wippermann

unread,
Apr 30, 2022, 1:20:42 AM4/30/22
to resol...@googlegroups.com
Hi Paul,

yeah, I was able to recreate your situation and got the same error messages.

I was able to get rid of the errors by adding a „clientId“ parameter to the „mqttConnect“ object. Since I previously had no client ID I had to add a new MQTT device under https://thingspeak.com/devices/mqtt first and then export the credentials of that device as a text file.


This credentials file contains a client ID as well as username and password which I copied over to the config.json:

mqttConnect: {
clientId: '...',
username: '...',
password: '...',
},


I then stripped the last part of the „mqttTopic“ because that seems to be handled by the „clientId“ / „username“ now:

mqttTopic: 'channels/1385789/publish',


In your example the „mqttTopic" has a trailing slash character. Perhaps removing it helps as well.

With that configuration changes new data points are added to my test channel.

I hope it works for you as well.

Best regards,
Daniel





PH YT Largy

unread,
Apr 30, 2022, 2:20:42 AM4/30/22
to Resol Vbus
Brilliant Daniel.  Working a treat again
Paul

PH YT Largy

unread,
Dec 20, 2022, 7:44:19 AM12/20/22
to Resol Vbus
Hi Daniel.  Seems to have broken again.  

This is the output I get

debug: Connecting to VBus...

debug: Connection state changed to CONNECTING

debug: Connection state changed to DISCONNECTED

error: undefined


Any suggestions


thanks


paul




PH YT Largy

unread,
Dec 20, 2022, 10:18:56 AM12/20/22
to Resol Vbus
Rebooted VBUS and seems to be working again.  
Also clock on VBUS was way out so not sure if that was also maybe problem.

Thanks

paul
Reply all
Reply to author
Forward
0 new messages