RFLink And MySensors
Posted: 24 Nov 2016, 16:27
Recently I have tried to read a MySensors Dallas Temperature Sensor with an RFlink into Domoticz.
However I could not get the RFlink to see my sensor data
After a while I realised (did not read the site properly ) that the RFlink is not a full blown MySensors gateway.
This means, that RFlink only reads the sensor data, but does not integrate itself into the MySensors network as a Gateway.
The MySensors nodes expect that there is a gateway to communicate with, and during initialisation of a sensor it checks the existent of that gateway.
I wanted to use the RFlink to read the sensordata, without the need of building an extra Mysensors Gateway.
What would be the purpose of the MySensors integration in RFlink, if that was not possible, anyway?
The problem with this setup is, that the MySensors nodes check for the existence of a gateway, and the RFlink does not fullfill this function.
Because the sensors don't see a gateway they stop transmitting there sensor data, and so the RFlink does not get any signals to read.
The solution to this problem was to prevent the MySensors nodes to do this Gateway check.
I have used this dirty solution that breaks the gateway check.
Add red lines to the file MySensors/core/MyTransport.cpp in the Mysensors library
and
Put the following at the beginning of your sketch
After these changes You can upload your sketch to your sensor node.
This solution works, but I don't like the fact that I have to change external libraries.
Is there anyone with a better solution?
However I could not get the RFlink to see my sensor data
After a while I realised (did not read the site properly ) that the RFlink is not a full blown MySensors gateway.
This means, that RFlink only reads the sensor data, but does not integrate itself into the MySensors network as a Gateway.
The MySensors nodes expect that there is a gateway to communicate with, and during initialisation of a sensor it checks the existent of that gateway.
I wanted to use the RFlink to read the sensordata, without the need of building an extra Mysensors Gateway.
What would be the purpose of the MySensors integration in RFlink, if that was not possible, anyway?
The problem with this setup is, that the MySensors nodes check for the existence of a gateway, and the RFlink does not fullfill this function.
Because the sensors don't see a gateway they stop transmitting there sensor data, and so the RFlink does not get any signals to read.
The solution to this problem was to prevent the MySensors nodes to do this Gateway check.
I have used this dirty solution that breaks the gateway check.
Add red lines to the file MySensors/core/MyTransport.cpp in the Mysensors library
Code: Select all
void stParentUpdate() {
//----------- Add this -----------
_nc.parentNodeId != 0
//----------- End ----------------
if (transportTimeInState() > STATE_TIMEOUT || _transportSM.preferredParentFound) {
// timeout or preferred parent found
if (_nc.parentNodeId != AUTO) {
debug(PSTR("TSM:FPAR:OK\n")); // find parent ok
_transportSM.findingParentNode = false;
setIndication(INDICATION_GOT_PARENT);
transportSwitchSM(stID);
}
Code: Select all
bool transportCheckUplink(bool force) {
//----------- Add this -----------
return true;
//----------- End ---------------
if (!force && (hwMillis() - _transport_lastUplinkCheck) < CHKUPL_INTERVAL) {
debug(PSTR("TSP:CHKUPL:OK (FLDCTRL)\n")); // flood control
return true;
}
Code: Select all
#define MY_NODE_ID 1 //(choose 1-255) Normally the gateway would provide the node ID's to all the nodes
#undef MY_REGISTRATION_FEATURE
#define MY_PARENT_NODE_ID 0
#define MY_PARENT_NODE_IS_STATIC
#define MY_REGISTRATION_RETRIES 0
This solution works, but I don't like the fact that I have to change external libraries.
Is there anyone with a better solution?