Per group notifications

renaud 8 years ago

Hello,

I have set up a new notification of "device online", checked "send via mail" and unchecked "all devices".
Then I created a group named "mail when online" and assigned it the former notification.
I did put one device in that group.
But I do not receive any email when that device becomes online. Is there something missing in what I did?

PS: mail notifications work fine if "all devices" is checked, but I don't wnat them for all devices.

Thank you

renaud 8 years ago

If I look in the database, I get this:

MariaDB [traccar]> select * from notifications;
+----+--------------+------------+------+------+------+--------+
| id | type         | attributes | web  | mail | sms  | always |
+----+--------------+------------+------+------+------+--------+
| 10 | deviceOnline | {}         |      |     |      |       |
| 19 | deviceOnline | {}         |      |     |      |       |
| 20 | deviceOnline | {}         |      |     |      |       |
| 25 | deviceOnline | {}         |     |     |      |        |
+----+--------------+------------+------+------+------+--------+

The last one is the one where I configured the deviceOnline not for every device. Is it normal that all the fields look empty?

Anton Tananaev 8 years ago

MySQL and MariaDB command line tools always have problems with showing BOOLEAN values. One possible solution here.

renaud 8 years ago

Actually, it's not BOOLEAN, which is why there is a display problem

MariaDB [traccar]> describe notifications;
+------------+---------------+------+-----+---------+----------------+
| Field      | Type          | Null | Key | Default | Extra          |
+------------+---------------+------+-----+---------+----------------+
| id         | int(11)       | NO   | PRI | NULL    | auto_increment |
| type       | varchar(128)  | NO   |     | NULL    |                |
| attributes | varchar(4000) | YES  |     | NULL    |                |
| web        | bit(1)        | YES  |     | b'0'    |                |
| mail       | bit(1)        | YES  |     | b'0'    |                |
| sms        | bit(1)        | YES  |     | b'0'    |                |
| always     | bit(1)        | NO   |     | b'0'    |                |
+------------+---------------+------+-----+---------+----------------+

I am not sure there is any improvement storing this kind of value as a BIT instead of a BOOLEAN, there should be storage padding anyway.

Anton Tananaev 8 years ago

There is no Boolean type in MySQL. Bit is what liquibase uses instead of Boolean.

renaud 8 years ago

well, yes and no :) There is no bit storage based boolean, but there is a boolean, which will print fine.

MariaDB [test]> create table test (t BOOLEAN);
Query OK, 0 rows affected (0.07 sec)

MariaDB [test]> describe test;
+-------+------------+------+-----+---------+-------+
| Field | Type       | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| t     | tinyint(1) | YES  |     | NULL    |       |
+-------+------------+------+-----+---------+-------+

Anyway, this doesn't really help with my primary issue, which is being unable to make notifications based on a group. Did you already see this issue, am I supposed to be able to make notifications based on groups?

renaud 8 years ago

Here is my original query with the correct display:

MariaDB [traccar]> select id,type,hex(web),hex(mail),hex(sms),hex(always) from notifications;
+----+--------------+----------+-----------+----------+-------------+
| id | type         | hex(web) | hex(mail) | hex(sms) | hex(always) |
+----+--------------+----------+-----------+----------+-------------+
| 10 | deviceOnline | 0        | 1         | 0        | 1           |
| 19 | deviceOnline | 0        | 1         | 0        | 1           |
| 20 | deviceOnline | 0        | 1         | 0        | 1           |
| 25 | deviceOnline | 1        | 1         | 0        | 0           |
+----+--------------+----------+-----------+----------+-------------+
Anton Tananaev 8 years ago

It should work as long as you linked it to the group and device is in that group.

renaud 8 years ago

Well, it does not work, that's my issue. How could I trace the cause? Note that it's not only for mail, if I check web based notifications, they also won't work unless "all devices" is selected.

Anton Tananaev 8 years ago

Can I have access to the account to take a look?

renaud 8 years ago

I have enabled registration, so you can create yourself an account on https://traccar.arnor.org

Anton Tananaev 8 years ago

Well, I wanted to check if you configured everything correctly in your account.

renaud 8 years ago

Maybe you can try to create one to see if you can replicate the problem on the same server. In case you are not, I would be able to see what you did different to me.

renaud 8 years ago

This would also help you check for https://github.com/tananaev/traccar/issues/3735

abyss 8 years ago

@renaud
To not spread discussion...

I've checked it on my test environment and it works fine.

Have all used in process objects linked to you? Device, Notification, Group?