Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events stop after some time #27

Closed
ciscozine opened this issue Feb 4, 2019 · 183 comments
Closed

Events stop after some time #27

ciscozine opened this issue Feb 4, 2019 · 183 comments
Labels
bug Something isn't working

Comments

@ciscozine
Copy link

Hi,
I have a Magellan 5000 and I use a WemosD1 mini to connect to the alarm system.

At night I arm the alarm, but in the morning "ParadoxRs232toMqtt" seems to be down.
I can ping the wemos but I cannot receive MQTT Message.

What can I do? How can I do to debug it?

I use hassio on a rasperry and "Mosquitto broker" as a MQTT Server.

thanks
Fabio

@maragelis
Copy link
Owner

maragelis commented Feb 4, 2019

Have you tried the new release ? There where many bug fixes done.
Are you also getting "paradox disconnected" on the status topic ?

@ciscozine
Copy link
Author

Yes, I have tried the last release without resolve the problem

Thanks

@maragelis
Copy link
Owner

Is there any chance the raspberry is going to sleep?
Are you also getting "paradox disconnected" on the status topic ?

@ciscozine
Copy link
Author

No It doesn't go to sleep.
Do you know where can I find MQTT broker log on hassio?

thanks

@maragelis
Copy link
Owner

No sorry. Use mqtt.fx and leave it connected to status topic

@ciscozine
Copy link
Author

ciscozine commented Feb 4, 2019

Ok. I'll update you.
Other commands useful for debug this type of problem?
For the last, do you use some particular version of home assistant with your project?

thanks again

@maragelis
Copy link
Owner

No I dont use home assistant. I use openhab and homekit

@maragelis
Copy link
Owner

If you want you can try this https://github.com/maragelis/ParadoxRs232toMqtt/tree/Dev/ParadoxAlarmSystem/ParadoxAlarmSystemOTA

It has some mqtt connection updates, and get back to me Thanks

@ciscozine
Copy link
Author

What are the differences between the 2ino files?
thanks

@maragelis
Copy link
Owner

the one is a ino arduino file the other is a precompiled bin file for flashing

@ciscozine
Copy link
Author

Sorry, I didn't see the extension file :D
Last question: what happens if WEMOS lost connection for about 1minute to the access point? Does it try to reconnect to the AP?

Thanks
I'll update you after testing the new ino file

@maragelis
Copy link
Owner

Yes it will reconnect

@ciscozine
Copy link
Author

Hi, I'll load the new sketch. I'll update you tomorrow.
A question. I have trace =1 but using console (9600 or 115200) I do not see nothing. Why?

thanks

@ciscozine
Copy link
Author

Again, the same problem. The interface to the paradox seems be down.

I have sniffed the IP flow.

The wemos is live (icmp ok), the mqtt flow still persist. I notice only a SSDP port unreachable ssdp:

each five minute the wemos send to the broker a ssdp message, but at 3:06am the wemos send 2 ssdp message and 1 of that it's a port unreachable (problem on hassio server?)
image
But I don't know if it is the problem.

2 questions:

  1. My circuit has no resistor. is this the cause the problem?
  2. Can you tell me for each lib, which version have you used? I updated some lib and now, if i try to compile the sketch, I see "DynamicJsonBuffer' was not declared in this scope"

Thanks again

@maragelis
Copy link
Owner

maragelis commented Feb 5, 2019

My friend there is nothing to trace in this situation, trace is for tracing problems with panel commands.

  1. Are you using a stable pubsub library? Dont use beta software.
  2. Is Trace off <-- very important Trace must be off for seamless operation. Send Trace=0
  3. Try flashing a relaese file .bin https://github.com/maragelis/ParadoxRs232toMqtt/releases/tag/v2.1.1.
    I have many wemos connected to panels without this problem.

@ciscozine
Copy link
Author

I'll test and I'll update you! Thansk.
My personal suggestion for .bin file. Why don't you give use the possibility to enable authentication and SSL encryption? It would be perfect :)

Thanks

@maragelis
Copy link
Owner

I will look into it

@ciscozine
Copy link
Author

I update you.
also with the .bin the problem still persist.
What I notice is that after the problem the log of my mqtt broker on hassio (raspberry) is:
1549393009: Client 80:7D:3A:3E:B5:FF has exceeded timeout, disconnecting.
1549393009: Socket error on client 80:7D:3A:3E:B5:FF, disconnecting.
but I can ping the wemos d1..

Moreover if I unplug the power and plug the power, the wemos d1 led blinks only 1 time and the ping stop to work.
If I detach the serial port to the alarm system and unplug/plug the power, the wemos d1 led blink correctly (3 or 4 times); then if I attach the serial port the broker receive the message correctly.

Thanks

@ciscozine
Copy link
Author

ciscozine commented Feb 5, 2019

One time I receive also a "{"status":"Problem connecting to panel"}".
I change the cable without any changes. This is why I ask you if it is better use some resistor .

Moreover I confirm that the Alarme system serial works fine because I called the alarm man specialist.

thanks

@rjduraocosta rjduraocosta mentioned this issue Feb 5, 2019
@maragelis
Copy link
Owner

So this happens only when armed ? please help so I can help.

@ciscozine
Copy link
Author

No I noticed that only when disarmed. I cannot test if armed because there is a PIR sensor that I cannot disable

@maragelis
Copy link
Owner

So you are disarmed and the wemos disconnects from mqtt ?

@ciscozine
Copy link
Author

I'm sorry. I understand now. Generally when I try do disarm the system (it is armed), the wemos stops to work.

@maragelis
Copy link
Owner

Are you maybe having low wifi signal

@maragelis
Copy link
Owner

maragelis commented Feb 5, 2019

If the wifi signal cut out for too long the times out and cannot reconnect. Please check if you are getting disconnect status message.

After how long does it disconnect ?

@maragelis
Copy link
Owner

{"status":"Paradox Disconnected"} this is the last will message if wifi is disconnected, can you check if you are getting this message.

@ciscozine
Copy link
Author

Well, I have an access point at 20cm .. It isn't a wireless problem; in fact i can ping the wemos without any problem.
No I don't see "{"status":"Paradox Disconnected"}" .

@maragelis
Copy link
Owner

that tells me that the serial has stopped responding on the wemos.

@maragelis
Copy link
Owner

can i get what panel you have and firmware if possible

@rjduraocosta
Copy link

@maragelis of course no problem at all. I just have to wait until I get home again in the evening to compile and put the system to a test and send you the Trace. As soon as I do it i will get back to you.

Thanks.

@pilievwm
Copy link

@ciscozine not its not correct. you dont need both else{} statements, and adding the too events to the if statement causes problems with smart home rules. Let me explain.

When the alarm is armed for sleep, the alarm will also produce a full arm event and then the sleep event, this if you have a rule to run automation on sleep and other on arm the sleep arm event will run both.

@pilievwm how is the master branch going. I think I found the problem, whats causing the timeouts, Its the NTP procesure. The wemos is trying to get hold of ntp time and its timing out causing network errors. I will try fix tonight and get an update to you all. Stay tuned.

@maragelis it is working perfectly ok! There are no issues at all!
I just struggle with the retain messages because when the Home assistant is restarted the alarm is with unknown status and I have to send a manual MQTT message to arm and then to disarm it. Can you add a retain message to the system statuses?
And the other request is to have MQTT auth - I have other devices which use a cloud MQTT service. So my system needs to be accessible from the outside. Leaving the MQTT broker without authentication is huge security hole :)
And the last - I need my wemos to come to a static IP address. I really hate DHCP. Sometimes it gets a mess, the alarm is something really important and it needs a stable connection.

@maragelis
Copy link
Owner

which version is working for you

@maragelis
Copy link
Owner

maragelis commented Feb 11, 2019

@pilievwm in 201902112130 i added mqtt authentication and retain on hassio arm topic. If you want get the code and update master or try this dev version.

#define mqtt_user ""
#define mqtt_password ""

@maragelis
Copy link
Owner

@rjduraocosta managed to reproduce the error on my test panel. I think I solved the problem.
this is for @ciscozine and @rjduraocosta guys thanks for your help.
@ciscozine I need a full event subevent list when you arm please.

@rjduraocosta
Copy link

@rjduraocosta managed to reproduce the error on my test panel. I think I solved the problem.
this is for @ciscozine and @rjduraocosta guys thanks for your help.
@ciscozine I need a full event subevent list when you arm please.

Fantástic @maragelis , I am glad you found it. I was about to send you another Traced with the Dev version compiled in version 2.3.0 and WifiManager 0.12.0, with the same output as before.

If you need anything please keep me posted. I will test the new releases if you need.

Thanks for your awsome work.

@maragelis
Copy link
Owner

Yes please test

@rjduraocosta
Copy link

rjduraocosta commented Feb 11, 2019

Paradox_Dev_Trace_20190211_Esp8266_2_3_0_WifiManager_0_12_0.txt
I already did. Attached there is the Trace that I mentioned above. The output is the same as the last one,

Hope it helps you.

@maragelis
Copy link
Owner

@rjduraocosta are you using the bin file or compile

@maragelis
Copy link
Owner

maragelis commented Feb 11, 2019

@rjduraocosta looks like you are not using the right file 201902112130
https://github.com/maragelis/ParadoxRs232toMqtt/tree/Dev/ParadoxAlarmSystem/ParadoxAlarmSystemOTA

@rjduraocosta
Copy link

Oh sorry I did not know you already did the upload...my mistake...sorry.

I will test it tonight. Wich settings?

Esp8266 version 2.3.0, 2.4.2?
WifiManager version 0.12.0, 0.14.0?
MQTT max packet size?

Thanks for your support.

@maragelis
Copy link
Owner

I used 2.5.0
wifiManager 0.14.0
Mqtt 256

@rjduraocosta
Copy link

I will do the same with a Trace and report back.

Thanks.

@rjduraocosta
Copy link

rjduraocosta commented Feb 11, 2019

@maragelis Which option did you use for the Flash size?

image

and for the lWIP variant?

Sorry about the questions, but is just to be sure to compile like you did.

Thanks.

@maragelis
Copy link
Owner

That one the first

@maragelis
Copy link
Owner

Keep default

@ciscozine
Copy link
Author

Hi, I tested the last dev version, but it does not connect to the mqtt broker (hassio).
Any suggestions?

1549920493: New connection from 10.255.200.127 on port 1883.
1549920493: Socket error on client <unknown>, disconnecting.
1549920498: New connection from 10.255.200.127 on port 1883.
1549920498: Socket error on client <unknown>, disconnecting.
1549920503: New connection from 10.255.200.127 on port 1883.
1549920503: Socket error on client <unknown>, disconnecting.
1549920508: New connection from 10.255.200.127 on port 1883.
1549920508: Socket error on client <unknown>, disconnecting.

I used 2.5.0
wifiManager 0.14.0
Mqtt 256

Thanks!
Fabio

@ciscozine
Copy link
Author

UPDATE: Using mqtt + AUTH it works.
I'll test and let you know good news :)

@rjduraocosta
Copy link

rjduraocosta commented Feb 11, 2019

@maragelis System is up and running with Trace enabled. As soon as I have some news I will keep you posted.

@ciscozine if you do not use atentication in your MQTT brooker, just use something like this in the ino file:
#define mqtt_user "user"
#define mqtt_password "pass"

it will work just fine.

@maragelis maragelis added the bug Something isn't working label Feb 12, 2019
@rjduraocosta
Copy link

Hello and good morning to all,

@maragelis you did it, it works! Thanks a lot for your dedication. Attached I am sending you a Trace of the test and as you can see at line 951 is where your new code solved the issue. Afterwards events where coming like they used to with no need to "wake up" the system.

Perfect!

Another thing just for your info. In this version the data of the MQTT payload {"event":1,"sub_event":3,"data":""} is coming empty because the function processMessage is beeing called with the last parameter with an empty string:

processMessage( inData[7], inData[8], "");

Great work and superb support.

When you need further testing for a master release please let me know.

Thanks again for you time.

Paradox_Dev_Trace_201902112130_Fixed.txt

@maragelis
Copy link
Owner

i was getting a lot of garbage on data string which at first I thought might be throwing the buffer error, so i disabled it, I will renable it, and send the dev branch to TEST

@maragelis maragelis mentioned this issue Feb 12, 2019
Merged
@maragelis
Copy link
Owner

By the way @rjduraocosta without your help I would not of found it. Thank you.

@rjduraocosta
Copy link

@maragelis you are absolutely welcome. I am very glad that I could contribute.
You managed to turn our Alarm System in an interactive system with our Home Automation server (in my case openHAB). That is priceless work.

Thnaks again for your time.

@rjduraocosta
Copy link

@maragelis new Dev branch version is up and runnig with Trace enbled.

I have to go out now and I will only come back late in the evening. I will keep you posted on the results and send you the Trace file.

Thanks again.

@rjduraocosta
Copy link

@maragelis new Dev branch version is up and runnig with Trace enbled.

I have to go out now and I will only come back late in the evening. I will keep you posted on the results and send you the Trace file.

Thanks again.

@maragelis, just to update you on the test I was performing when you added the data string to the MQTT payload. Everything runs as expected. You can see in the attached Trace that your code did it's magic in line 1530.

Thanks again for your work.
Paradox_Dev_20190212_Stable_2.2.1.txt

@maragelis
Copy link
Owner

I think we can close the issue. Thanks to all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants