Thanks @LastSamurai, indeed I only needed to restart the node to see the message.
Turns out directly connecting the nrf24 via SPI acts like an Ethernet gateway listening on all interfaces on port 5003. (This information was new to me).
Regarding MQTT: I tried Openhab, but it did not work out of the box with the Ethernet gateway, so I quickly tried domoticz and the SPI-nrf24 worked straight away. Could I have domoticz and OpenHAB (for my 5.1 receiver) running at the same time and communicating via MQTT?
Regarding internet access: No, I actually do not want to expose any actuators but maybe sensors (HVAC, alarms). But this is low prio.
@tommas
It seems to work with the older mysensors binding:
org.openhab.binding.mysensors-2.2.0-SNAPSHOT.jar .
3 of my 5 nodes updated the values in openhab2 (2.3.0~20180331153334-1)
Thanks for the suggestion. I found another solution.
I have the item like this:
Switch Incalzire_Releu_GF_Living1 "Incalzire Releu Living 1" <heating> (Incalzire) {mqtt=">[mysensor:MyMQTT/3/1/V_HEATER_SW:command:ON:1],>[mysensor:MyMQTT/3/1/V_HEATER_SW:command:OFF:0],<[mysensor:MyMQTT/3/1/V_HEATER_SW:command:MAP(1on0off.map)]"}
and in 1onoff.map i have:
**1=ON
0=OFF
1.4.1=REQUEST
**
And then I have a rule:
rule "SW1 Persist"
when
Item Incalzire_Releu_GF_Living1 received command
then
if (receivedCommand == "REQUEST")
{
sendCommand(Incalzire_Releu_GF_Living1 , Incalzire_Releu_GF_Living1.state);
}
end
In the arduino code for the relay I have in the setu() this code.
**void setup()
{
gw.begin(incomingMessage, AUTO, true);
gw.sendSketchInfo("Relay Control", "1.0");
for (int sensor=1 ; sensor<=NUMBER_OF_RELAYS;sensor++)
{
gw.present(sensor, S_HEATER);
gw.request(sensor, V_HEATER_SW,0);
}
}**
So whenever gw.request is called the idem receives an update with 1.4.1 that is resolved by the rule to the actual state of the switch in openhab.
Like this, when arduino starts, the relays will be swiched ON as per the actual state of the switch.
@Ericb2745
Well, in that case, it seems you are missing the receiving part of the code. This is directly from the example for the actuator and it works for me... It goes at the end of the code after the void loop.
// process incoming message
void receive(const MyMessage &message) {
if (message.type == V_LIGHT) {
if (message.sensor < noRelays) { // check if message is valid for relays..... previous line [[[ if (message.sensor <=noRelays){ ]]]
Relays[message.sensor].relayState = message.getBool();
digitalWrite(Relays[message.sensor].relayPin, Relays[message.sensor].relayState ? RELAY_ON : RELAY_OFF); // and set relays accordingly
saveState( message.sensor, Relays[message.sensor].relayState ); // save sensor state in EEPROM (location == sensor number)
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.print(message.getBool());
if(message.getBool() == 0)
Serial.println(" = OFF");
else(Serial.println(" = ON"));
}
}
}