Howto use myscontroller from node-red-contrib-mysensors?



  • Hi,

    @tbowmo maybe you can help with this:

    I would like to use the myscontroller node from node-red-contrib-mysensors to assign and track my node IDs, but I am struggling with the details.

    myscontroller seems to read the incoming msg, but when double clicking on it, id is "undefined".

    Here are the relevant nodes:

    [{"id":"8aa619bf.bcddb8","type":"myscontroller","z":"a8b8ec2f.f6e17","database":"839402cc.e6ba6","name":"node_controller","handleid":true,"timeresponse":true,"timezone":"UTC","measurementsystem":"M","mqttroot":"mysensors-in","x":740,"y":660,"wires":[["ca58e694.77646","da1a60bf.fddd1"]]},{"id":"d1caae4a.7e6d08","type":"mqtt in","z":"a8b8ec2f.f6e17","name":"","topic":"mysensors-out/#","qos":"2","broker":"708db7ae.68d95","x":300,"y":660,"wires":[["4abb49a2.3b382"]]},{"id":"4abb49a2.3b382","type":"mysdecode","z":"a8b8ec2f.f6e17","database":"","name":"","mqtt":true,"enrich":false,"x":530,"y":660,"wires":[["8aa619bf.bcddb8"]]},{"id":"da1a60bf.fddd1","type":"mqtt out","z":"a8b8ec2f.f6e17","name":"","topic":"","qos":"","retain":"","broker":"708db7ae.68d95","x":1020,"y":660,"wires":[]},{"id":"839402cc.e6ba6","type":"mysensorsdb","z":"","name":"test_db_1","file":"/home/blub/test_db_1.sqlite"},{"id":"708db7ae.68d95","type":"mqtt-broker","z":"","name":"mosquitto-betty","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
    

    And the relevant sketch code:

    #define MY_DEBUG
    #define MY_RADIO_NRF24
    #include <MySensors.h>
    #define CHILD_ID 1
    //#define MY_PARENT_NODE_ID 0
    //#define MY_PARENT_NODE_IS_STATIC
    #define SN "Worktable RGBW"
    #define SV "1.6"
    [...]
    
    void presentation(){
    	sendSketchInfo(SN, SV);
    	present(CHILD_ID, S_RGBW_LIGHT );
    }
    
    

    When I restart the node, it actually gets node id 1, no matter what I do with myscontroller.

    My configure is:

    /configure --spi-spidev-device=/dev/spidev0.0 --my-transport=rf24 --my-rf24-ce-pin=2 --my-rf24-cs-pin=13 --my-rf24-irq-pin=21 --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mysensors --my-mqtt-password=blub --my-port=1883 --my-mqtt-user=mysensors
    

    I think I am just using the wrong topics, setting and combination of nodes.

    When I set the topic in myscontroller to the publish topic, the following message spams my broker:

    mysensors-out/1/255/3/0/6 : msg : Object
    object
    topic: "mysensors-out/1/255/3/0/6"
    payload: "M"
    qos: 0
    retain: false
    _topic: "mysensors-out/1/255/3/0/6"
    _msgid: "f5d62d35.d8df2"
    topicRoot: "mysensors-out"
    nodeId: 1
    childSensorId: 255
    messageType: 3
    ack: 0
    subType: 6
    origin: 2
    messageTypeStr: "C_INTERNAL"
    subTypeStr: "I_CONFIG"
    

  • Admin

    @pansen said in Howto use myscontroller from node-red-contrib-mysensors?:

    Hi,

    @tbowmo maybe you can help with this:

    I would like to use the myscontroller node from node-red-contrib-mysensors to assign and track my node IDs, but I am struggling with the details.

    myscontroller seems to read the incoming msg, but when double clicking on it, id is "undefined".

    Just double checked my install.. And it too is showing nodes as undefined ID.. It seems that a bug appeared, and I have to dig into it..

    When I set the topic in myscontroller to the publish topic, the following message spams my broker:

    mysensors-out/1/255/3/0/6 : msg : Object
    object
    topic: "mysensors-out/1/255/3/0/6"
    payload: "M"
    qos: 0
    retain: false
    _topic: "mysensors-out/1/255/3/0/6"
    _msgid: "f5d62d35.d8df2"
    topicRoot: "mysensors-out"
    nodeId: 1
    childSensorId: 255
    messageType: 3
    ack: 0
    subType: 6
    origin: 2
    messageTypeStr: "C_INTERNAL"
    subTypeStr: "I_CONFIG"
    

    This is the controller nodered node responding to an I_CONFIG request from your mysensors node. It sends an "M" to the node (for "M"etric). Does the node receive the data?

    It should only send one for each request from your mysensor nodes..

    I haven't looked that much at my system the last 6 months or so, other than doing a restart now and then, because it drops either my ikea lamps, or my chromecast integration. Been to busy with the paid work thingy 🙂


  • Admin

    @pansen

    FYI, I just released a small bug fix for the mysensors node-red module.. So now it should show the correct node ID's in the controller view.


 

218
Online

8.6k
Users

9.4k
Topics

99.0k
Posts