Strange issue with sensor

Hello,

Well, I’ve been running my Enocean integration at home for a few weeks, and I’ve noticed two suspicious things (related or not).

Actually, (ir)regularly, I no longer receive data in Gladys via my USB key, like a kind of disconnection but I don’t see it. I put logs on the ‹ error › and ‹ disconnect › events.

And besides that, I have something strange in the database, all weekend, my « decos » occurred around 7-8 PM.

And on the database side, in the t_device_feature_state table, I see this for all my sensors (movements, temperature…):


1f7b9ce4-94b2-4670-bc5d-90d20b9b7dd4|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 09:39:57.068 +00:00|2021-11-01 09:39:57.068 +00:00
b9860941-5d3e-4164-aa19-51c7a337ffe9|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 09:45:23.598 +00:00|2021-11-01 09:45:23.598 +00:00
9429c876-7b6e-42ba-a709-b14b5b88b0b8|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 09:59:22.333 +00:00|2021-11-01 09:59:22.333 +00:00
02b2ab5c-e478-4f11-85bb-fc7164de0b6b|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 10:20:33.522 +00:00|2021-11-01 10:20:33.522 +00:00
b9173868-e0c1-400f-a6b9-63ea39150dff|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 10:39:58.708 +00:00|2021-11-01 10:39:58.708 +00:00
6ed685b3-c176-4118-8d7e-49f772bc30ee|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 10:59:23.562 +00:00|2021-11-01 10:59:23.562 +00:00
cd48bfc0-762a-4b28-b6cb-7e4589ab22bb|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 11:22:20.263 +00:00|2021-11-01 11:22:20.263 +00:00
f4dec7a4-a645-4545-bbbc-41d1e089fea8|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 11:45:16.839 +00:00|2021-11-01 11:45:16.839 +00:00
e6a208f1-8af6-4c0a-9e2f-4bec66b29f1e|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 12:04:41.729 +00:00|2021-11-01 12:04:41.729 +00:00
8e2dc968-334e-4c0a-aca2-bc15353b9768|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 12:22:20.787 +00:00|2021-11-01 12:22:20.787 +00:00
bec4cdd3-8670-4168-9b7b-19e63f948cc9|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 12:34:42.147 +00:00|2021-11-01 12:34:42.147 +00:00
bc51b55a-6c4c-46d5-bb16-b3235cd478f8|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 12:50:35.352 +00:00|2021-11-01 12:50:35.352 +00:00
f306a703-20a0-441c-80e9-2e45c58a10cb|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 13:04:42.519 +00:00|2021-11-01 13:04:42.519 +00:00
b9652656-0d24-4f56-8937-99b7643dbe28|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 13:25:53.392 +00:00|2021-11-01 13:25:53.392 +00:00
b0c01dab-6d81-4a9b-8748-0f84ddee5a14|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.6666666666667|2021-11-01 13:43:32.095 +00:00|2021-11-01 13:43:32.095 +00:00
f56a6232-7d55-49d9-89b0-dc652d6b9bd5|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.6666666666667|2021-11-01 13:55:53.322 +00:00|2021-11-01 13:55:53.322 +00:00
7d64dece-4d70-4a07-a984-1baa557ab521|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.6666666666667|2021-11-01 14:11:46.290 +00:00|2021-11-01 14:11:46.290 +00:00
1e0f303e-1ffb-45f5-ba92-88b199cbfe41|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 16:39:09.804 +00:00|2021-11-01 16:39:09.804 +00:00
7f84deec-719c-4278-be6b-a86e7c8e4a84|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 16:39:10.124 +00:00|2021-11-01 16:39:10.124 +00:00
29231c1a-006b-4267-98eb-5a1ab03aca71|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 16:39:12.117 +00:00|2021-11-01 16:39:12.117 +00:00
4cdbcb3d-47d5-4ef0-863d-7d1afd4efa52|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 16:39:13.270 +00:00|2021-11-01 16:39:13.270 +00:00
c7f2386d-fa4e-46e8-b9b0-5c346b921acd|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 16:39:14.246 +00:00|2021-11-01 16:39:14.246 +00:00
aca660b6-cdd3-4e49-b852-17cd62ecdc7a|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 16:39:15.149 +00:00|2021-11-01 16:39:15.149 +00:00
fa2276e7-f472-4846-9fdb-ea04f1a1cde6|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 16:39:15.867 +00:00|2021-11-01 16:39:15.867 +00:00
2756217f-d583-4636-a8f1-d7039dc5642c|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 16:39:16.995 +00:00|2021-11-01 16:39:16.995 +00:00
df6af10b-164e-427d-b533-bf951263b035|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 16:39:17.343 +00:00|2021-11-01 16:39:17.343 +00:00
017ef6a6-66e4-4145-a40d-ad0baea4575d|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.9803921568627|2021-11-01 16:39:17.986 +00:00|2021-11-01 16:39:17.986 +00:00
eb4e768d-b775-4cd5-b7e9-eab5e179769b|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 16:39:18.654 +00:00|2021-11-01 16:39:18.654 +00:00
1aa1b5f3-d1b8-45cf-bc23-5850911926d3|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.8235294117647|2021-11-01 16:39:19.553 +00:00|2021-11-01 16:39:19.553 +00:00
adf67493-cd66-4b24-8eee-70ff6a8bdc8d|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.6666666666667|2021-11-01 16:39:20.888 +00:00|2021-11-01 16:39:20.888 +00:00
9f5e71fc-e462-4a83-839a-1f58c45b7bb1|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.6666666666667|2021-11-01 16:39:21.255 +00:00|2021-11-01 16:39:21.255 +00:00
7f9eaef6-a9d3-454c-92ac-ddc147fbdda0|b9f7354c-67e5-44ae-91bc-f4ba0f3b5eff|18.6666666666667|2021-11-01 16:39:22.124 +00:00|2021-11-01 16:39:22.124 +00:00

The last states saved before the « pseudo logout » occurs seem to be duplicates of the previous N states.

I don’t think all the sensors start flooding (especially with different values but identical to the previous ones).

Thinking about it, I merged for testing, the devs in progress on the data aggregation tasks to have graphs.

Isn’t there a link? a rewrite in the database?

The thing is that in the end, I don’t know / don’t think that these inconsistencies in the database have a link with my « disconnection » of my device, especially since the log flood is not at the same time for all sensors.

I’m open to help, leads to explore, I’m stuck.

That doesn’t ring a bell!

I would rather suspect a problem in the EnOcean integration, is there anything in the lib you use/your code that could cause this?

I double-checked but no, I don’t understand it, last night it cut out again around 7 p.m.

I added some debug to see and around 6:48 p.m., I have dozens and dozens of times the same events.
I put a console.log on the event on.(‹ data ›), a few lines after decoding the payload, and I see the same devices over and over again…

I don’t quite get it, as if there were N times an event receiver…

Well, as I put it under pm2 on my side for the moment, I’ve already had surprises with pm2 so I’m restarting today with a nohup npm start

I’ll see the result tonight.

It smells like a bug in the code or you add the event listener N times, do you have a link to the code in question? :slight_smile:

This is where I set the listener.

I don’t see where I might have made this mistake, moreover, this happens after several hours of normal operation, and randomly depending on the devices.

I’m digging…

You’re attaching the listener every time the connect() function is called, are you sure that connect is only called once?

I see that you’re not doing anything in the stop function of the service, normally the service should clean up everything that was set up in the start (including the listeners specifically):

I will add the cleans at the stop indeed.

Regarding the connect, it is only called once. When I check the logs, it is consistent.

I think I found the origin of my problem.
Thanks @pierre-gilles because it was probably a problem of listeners not cleaned up, on the library side that I use.
In some error cases, I entered a timeout condition and at that moment the listeners were not cleaned up.

I patched it at my end, I will let it run to see.

https://github.com/enocean-js/enocean-js/issues/247