Closed slametps closed 5 years ago
Ok. let me see.
Anyway, that error message is coming when module tries to send admin notification but there might be no chat_id for admin. did you set the adminChatId
in configuration?
Yap, I set adminChatId
. I think, it should only send one time ERROR MESSAGE for one unhandled-error.
Yes It should be. I'll test it on my device and examine what's the problem. Sorry for inconvenience.
Thx. Btw, it is a great and very useful module, though. I'm adding telegram feature for my own and other modules, including to newsfeed (MM default module), so I can read the feeds via telegram.
Great. Frankly I'm considering alternative newsfeed module compatible with TelegramBot and Assistant.. but what the my lazyness... :)
Anyway, I've tested on my device, but the warning message came normally, just once (per 10minutes). So I cannot find any suspicious yet. But I'll try more.
I think there are two points to check;
1) warning_interval : .checkWarning()
in MMM-Tools
<- It might be sending messages too many times
2) TELBOT_TELL_ADMIN : .notificationReceived()
and .say()
in MMM-TelegramBot.js
and .say()
in node_helper.js
.
I think something wrong in point 2.
You can test this with your other test module by sending notification ("TELBOT_TELL_ADMIN"). Can you do that?
Ok, I'll try it later when I'm home.
Have you any progress?
Sorry, I'm still in business trip. I will update soon when I can reach my MM.
I tried sending TELBOT_TELL_ADMIN, but nothing happened.
Nothing? No error? Or no message? I need more detailed information especially browser dev console.
No error raised. Also no messages to telegram. I'm using MM-2.1.3 and Electron 1.6.10.
Sorry, for previous image.
This is the browser dev console log.
Ok. 0) what is ‘1’ error? (Upper right of console) is it related to this problem? Check it first. 1) I think notification was transferred without problem. Have you got message from Modulescheduler without error in telegram? 2) css of mmm-tools was collided with others. I think it caused by ‘bottom’ region. Try to put it into other region(‘top_right’) to check this suspicious.
You can talk with me in slack or email. I think it could be more convenient to talk.
1 error listed is about loading MMM-ModuleScheduler, not related to MMM-TelegramBot (IMO).
from browser dev console above, MMM-TelegramBot seemed not get the TELBOT_TELL_ADMIN message. Kinda weird?
I’ll check that on Monday. Have a nice weekends :)
Ok.
First, your redbox doesn't tell anything about whether notification was transmitted or not. Because "...received a module notification: ..." log is default implements of notificationReceived
, so if a module has not its own notificationReceived
function, that log is shown. If there is no log about that, it doesn't mean notification is not received.
Second, I cannot find any suspicious point about notification mechanism.
I've tested with this code
Module.register("test",{
notificationReceived: function(noti, payload) {
if (noti == "DOM_OBJECTS_CREATED") {
this.sendNotification("TELBOT_TELL_ADMIN", "This is test")
}
},
})
register this test
module and See the result. I can get This is test
message in Telegram normally.
What I mean in the redbox is I sent message TELBOT_TELL_ADMIN via MMM-ModuleScheduler and all modules received the message but MMM-TelegramBot (no message in my telegram either).
What I mean in the redbox is I sent message TELBOT_TELL_ADMIN via MMM-ModuleScheduler and all modules received the message but MMM-TelegramBot (no message in my telegram either).
I understand your words. but, That log doesn't prove MMM-TelegramBot had received the notification or not(even though really there had been the real problem).
Because that log message was shown automatically when that module has no notificationReceived
method implementation. MMM-TelegramBot has its own notificationReceived implementation thus it will not make that log message. So you cannot know REALLY MMM-TelegramBot couldn't catch the notification. Of course, it could prove the notification is fired and sent to some modules. But there are two possible points to consider. 1) MMM-TelegramBot got the notification, but module reacted wrongly or 2) MMM-TelegramBot couldn't get the notification because the notification chain was broken somewhere before MMM-TelegramBot although notification is fired normally.
The only way to check whether module could catch notification is yelling the notification when it is caught. Try this in MMM-TelegramBot.js
notificationReceived: function(notification, payload, sender) {
console.log("NOTIFICATION is really coming :", notification); //when module catch the notification, this log will be shown in dev console.
switch(...
}
Anyway, We will assume notification is received without any problem, but module worked wrongly.
The next check point is in node_helper.js
;
say: function(r, adminMode=false) {
var chatId = (adminMode) ? this.adminChatId : r.chat_id
console.log("Check Admin ChatID", chatId, adminMode, this.adminChatId, r.chat_id) //Check chatId for admin in terminal log.
When your TELBOT_TELL_ADMIN notification is received, this line could make your error. Check this.adminChatId
. that is defined in your config and should be the same.
Any progress?
I got a flooding messages on Telegram when exception occurs, causing RPI exhausted and CPU temperature raising rapidly. It is some flooding messages sent by TelegramBot: ` ERROR Bad Request: chat_id is empty
at {"type":"TEXT","text":"Terjadi kesalahan. Hubungi admin."} ` Can you help me fix this issue?