@hek
Thanks for quick reply. Is your example Mifare One S51 readonly?
Posts made by zuolan
-
RE: 💬 RFID Lock Sensor
-
RE: 💬 RFID Lock Sensor
Hi Hek,
Thanks for sharing. It looks like a useful addition to my openhab system.
Can you tell me if it is possible to WRITE to the cards and tags? Some of them are being sold as 'white' cards. I am worried I have to program the tags myself. -
RE: My final setup to get MySensors and OpenHab communicating via MQTT
Thanks.
I now try to get MQTT to talk to openhab by following the RelayActuator example. I only have the openhab demo running.
I am not sure I have enough information in the above instruction to comple the mqtt.items file. For the following MQTT topics setup of mine,
I will try the following for the first line:
String Garage_Door "Garage Door [%s]" (gGarage, Windows) {mqtt="<[broker:mygateway1-out/102/1/1/0/2:state:MAP(1closed0open.map)]"}For the second line I am really stuck about how the do the "/2/2/0/0/2/"part:
Switch MQTTTestSwitch "MQTT Test Switch" (gBasement) {mqtt=">[broker:mygateway1-in/2/2/0/0/2:command:ON:1],>[broker:mygateway1-in/2/2/0/0/2:command:OFF:0]"}How should one figure out?
OK. To answer my own question the information is clearly here:
https://www.mysensors.org/download/serial_api_20#sensor-typesI will be reading up.
-
RE: My final setup to get MySensors and OpenHab communicating via MQTT
On the topic of editing header files, I found (maybe this is obvious for other people) many including the #define MY_SOFTSPI should be done in the sketch (before the corresponding header file is included?). In this way you don't have to worry about changing it back or conflict.
-
RE: My final setup to get MySensors and OpenHab communicating via MQTT
@Martin-Tellblom
Your advice of changing the MY_NODE_ID made the difference. I foolishly left it in the MyConfig.h file so it is conflicting with the gateway.
So on mqttspy I now get this!!!!!!!!!!!!!!!!!!!!!!!!!!!
Thanks so much for helping me.
-
RE: My final setup to get MySensors and OpenHab communicating via MQTT
I actually have the problem below solved. Since I already finished writing, so I am leaving this here for other people.
More information on this.
Although the Light Sensor data is not getting through, the Light Sensor node does cause all these MQTT messages to be sent.
Before I turn on the Light Sensor node, there is no MQTT message on the mqttspy and on the GatewayW5100MQTTClient COM port it is very quiet and I got this:
After I turn on the Light Sensor node the MQTT messages started comming and on the GatewayW5100MQTTClient COM port:
0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
0;255;3;0;9;TSM:INIT
0;255;3;0;9;TSM:RADIO:OK
0;255;3;0;9;TSM:GW MODE
0;255;3;0;9;TSM:READY
IP: 192.168.1.108
0;255;3;0;9;No registration required
0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
IP: 192.168.1.108
0;255;3;0;9;Attempting MQTT connection...
0;255;3;0;9;MQTT connected
0;255;3;0;9;TSP:SANCHK:OK
0;255;3;0;9;TSP:SANCHK:OK
0;255;3;0;9;TSP:SANCHK:OK
0;255;3;0;9;TSP:SANCHK:OK<<Light Sensor Turned on>>
0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
0;255;3;0;9;TSP:MSG:BC
0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
0;255;3;0;9;TSP:CHKUPL:OK
0;255;3;0;9;TSP:MSG:GWL OK
0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
0;255;3;0;9;TSP:MSG:BC
0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
0;255;3;0;9;TSP:MSG:GWL OK
0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
0;255;3;0;9;TSP:MSG:BC
0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
0;255;3;0;9;TSP:CHKUPL:OK
0;255;3;0;9;TSP:MSG:GWL OK
0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
.......So question is why the messages from Light Sensor do not get through (or I am still not capturing them) while causing messages being sent on mygateway1-out/255/255/3/0/3?
See next post.
-
RE: My final setup to get MySensors and OpenHab communicating via MQTT
@Martin-Tellblom
Thanks again.I installed mqttspy and changed #define MY_NODE_ID 100.
I subscribe to the following topics:
mygateway1-in
/#I'm still not getting any messages in mygateway1-in.
Especially not this one: "MySensors/100/255/3/0/6 Light Sensor" that you are getting.
All the messages I can see still in mygateway1-out/255/255/3/0/3 topic.
So I think data from my Light Sensor node is not getting through.Your thoughts? And how to debug this?
On the COM port of the Light Sensor I got below. Do you see any indication showing it is sending data to mqtt? What about the !TSM:FALILURE?
!TSM:CHKID:FAIL (ID=255)
!TSM:FAILURE
TSM:PDT
TSM:INIT
TSM:RADIO:OK
TSM:FPAR
TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
TSP:MSG:READ 0-0-255 s=255,c=3,t=8,pt=1,l=1,sg=0:0
TSP:MSG:FPAR RES (ID=0, dist=0)
TSP:MSG:PAR OK (ID=0, dist=1)
TSM:FPAR:OK
TSM:ID
TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
TSM:ID
TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
TSM:ID
TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
TSM:ID
TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
!TSM:CHKID:FAIL (ID=255)
!TSM:FAILURE
TSM:PDT
TSM:INIT
TSM:RADIO:OK
TSM:FPAR -
RE: My final setup to get MySensors and OpenHab communicating via MQTT
@Martin-Tellblom
OK. I am not getting any from 'mygateway1-in/#'. Let me check.Just to be clear, in the above sketch
sendSketchInfo("Light Sensor", "1.0",true);
send(msg.set(lightLevel));
should have caused messages in 'mygateway1-in/#'?
Thanks,
-
RE: My final setup to get MySensors and OpenHab communicating via MQTT
@Martin-Tellblom
OK. I will. Can you post an example of messages you are getting so I have a rough idea?Many thanks.
-
RE: My final setup to get MySensors and OpenHab communicating via MQTT
@Martin-Tellblom Something is still not right. I looked at the MQTT messages using
mosquito_sub -v -t 'mygateway1-out/#'
I got below:
mygateway1-out/0/255/0/0/18 2.0.1-beta
...
mygateway1-out/255/255/3/0/3 (null)
...
It seems the (null)is where the message body should have been. So the payload is missing.The sensor node is the 'LightSensor' sketch taking an analog data
// Enable debug prints to serial monitor
#define MY_DEBUG// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69#include <SPI.h>
#include <MySensors.h>#define CHILD_ID_LIGHT 0
#define LIGHT_SENSOR_ANALOG_PIN 0unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
int lastLightLevel;void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Light Sensor", "1.0",true);// Register all sensors to gateway (they will be created as child devices)
present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
}void loop()
{
int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23;Serial.println(lightLevel);
if (lightLevel != lastLightLevel) {
send(msg.set(lightLevel));
lastLightLevel = lightLevel;
}
sleep(SLEEP_TIME);
}Why the sensor node is not returning the voltage reading?
What am I doing wrong?Thanks,
-
RE: My final setup to get MySensors and OpenHab communicating via MQTT
Update on this. It seems to be working after I found I did not modify the MyConfig.h being used.
After uncommenting #define MY_SOFTSPI
I got below.0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.0.1-beta
0;255;3;0;9;TSM:INIT
0;255;3;0;9;TSM:INIT:TSP OK
0;255;3;0;9;TSM:INIT:GW MODE
0;255;3;0;9;TSM:READY
IP: 192.168.1.108
0;255;3;0;9;MCO:REG:NOT NEEDED
0;255;3;0;9;MCO:BGN:STP
0;255;3;0;9;MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1
IP: 192.168.1.108
0;255;3;0;9;Attempting MQTT connection...
0;255;3;0;9;MQTT connected
0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
0;255;3;0;9;TSF:SANCHK:OK
IP: 192.168.1.108
0;255;3;0;9;Attempting MQTT connection...
0;255;3;0;9;MQTT connected
0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18 -
RE: My final setup to get MySensors and OpenHab communicating via MQTT
Hi,
Thanks for the help.I keep getting these messages on the COM port for the MQTT Gateway. What does it mean and what should I do to proceed? Thx.
0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.0.1-beta
0;255;3;0;9;TSM:INIT
0;255;3;0;9;!TSM:INIT:TSP FAIL
0;255;3;0;9;TSM:FAILURE
0;255;3;0;9;TSM:FAILURE:PDT
0;255;3;0;9;TSM:FAILURE:RE-INIT
0;255;3;0;9;TSM:INIT
0;255;3;0;9;!TSM:INIT:TSP FAIL
0;255;3;0;9;TSM:FAILURE
0;255;3;0;9;TSM:FAILURE:PDT
0;255;3;0;9;TSM:FAILURE:RE-INIT -
RE: My final setup to get MySensors and OpenHab communicating via MQTT
Eric,
Thanks for posting. It looks exactly what I need to follow.Can you describe how the hardware(Ethernet Shield and nRF24L01, SPI pins) are connected?
Also where to look for them in the header file?