Read the statement by Michael Teeuw here.
MMM-FRITZ-Box-Callmonitor-py3 and MMM-Callmonitor-Current-Call
-
@rkorell
Hi Ralf,I did not touch the file “fritz_access.py” by now, but what I already did was edeting the files “MMM-FRITZ-Box-Callmonitor-py3.js” and “node-helper.js”.
In the file “node-helper.js” I already added:
const CALL_TYPE = Object.freeze({
INCOMING: “1”,
MISSED: “2”,
OUTGOING: “3”,
BLOCKED: “4”
})
and tried this (now comented out because it did not work):
//Call blocked
//monitor.on(“blocked”, function (call) {
// var name = self.ownNumbers.includes(call.caller) ? self.getName(call.called) : self.getName(call.caller);
// var direction = self.ownNumbers.includes(call.caller) ? “out” : “in”;
// self.sendSocketNotification(“blocked”, { “caller”: name, “direction”: direction });
//});
and this (also now comented out):
for (var index in callArray) {
var call = callArray[index];
var type = call.Type[0];
//Try to handle blocked calls this is new from “if to else” delete all lines from “if to else” if it not works!
//if var name = type == CALL_TYPE.BLOCKED || type == CALL_TYPE.INCOMING ? self.getName(call.Caller[0]) : self.getName(call.Called[0]);
// var duration = call.Duration[0];
// if (type == CALL_TYPE.INCOMING && self.config.deviceFilter && self.config.deviceFilter.indexOf(call.Device[0]) > -1) {
// continue;
//} else
//From here the original script is ongoing
var name = type == CALL_TYPE.MISSED || type == CALL_TYPE.INCOMING ? self.getName(call.Caller[0]) : self.getName(call.Called[0]);
var duration = call.Duration[0];
if (type == CALL_TYPE.INCOMING && self.config.deviceFilter && self.config.deviceFilter.indexOf(call.Device[0]) > -1) {
continue;
}
In the file “MMM-FRITZ-Box-Callmonitor-py3” I did already this:
const CALL_TYPE = Object.freeze({
INCOMING: “1”,
MISSED: “2”,
OUTGOING: “3”,
BLOCKED: “4” //New entry! to handle blocked calls
})
and tried this:
//Handle blocked calls
//if (notification === “blocked”) {
//Send notification for currentCall module
// this.sendNotification(“CALL_BLOCKED”, payload.caller);
//Remove alert from UI when call is connected
// this.sendNotification(“HIDE_ALERT”);
// this.activeAlert = null;
//}
But that all does not work so I comented it out again.
Thats my problem I can’t code and I dont really understand what I’m doing, all I can do is “Try and Error”!But thanks a lot for your help. :-)
Carsten
-
@xIExodusIx Yeahh…
You figured out the exact same idea and made more out of this than I’m able to do.
But for sure you have to start at the python script - the python script “feeds” node-helper.
And if node-helper don’t get info about “blocked” - your If-clause is never true so your new code couldn’t be reached.
And for setting the python script correctly you have to identify how the AVM/Fritz interface works…Regards,
Ralf -
I have almost 2 hours googled for the right name of the function for the blocked calls, but did not find anythig about that.
And I found some smaller errors in the funktion of the module. E.g. it should delete the alert (the big popup on the gui of the MM when a call comes in) when I answer this call. But that does not work.
This should do the job in the "MMM-FRITZ-Box-Callmonitor-py3:
if (notification === “connected”) {
//Send notification for currentCall module
this.sendNotification(“CALL_CONNECTED”, payload);//Remove alert only on connect if it is the current alert shown if (this.activeAlert === payload) { //Remove alert from UI when call is connected this.sendNotification("HIDE_ALERT"); this.activeAlert = null; } }
but it dosn’t work.
As I already said: I can’t code :-(
Regards,
Carsten -
@xIExodusIx Yes, I identified this “bug” as well and couldn’t find the mistake…
As I mentioned - I couldn’t code (this) as well …Regards,
Ralf -
I think it is something with the syntax, maybe it has changed somehow in python3, or a wrong set “,” or “;” so the modulescript could not run correct, but it is enough to let the module almost run as expected.
For that I have not enough experience to figure that out.Would be nice if there were the possebility of a testing enviroment for MS-Windows, so that I could test the scripts. For editing I could use VS-Code.
-
@xIExodusIx said in MMM-FRITZ-Box-Callmonitor-py3 and MMM-Callmonitor-Current-Call:
testing enviroment for MS-Windows,
For Python you can use this …
Regards,
Ralf -
Hi Ralf,
I found out that the correct entry for handle “blocked calls” is “10”, not “4”, I found that on “https://fritzconnection.readthedocs.io/en/1.14.0/sources/library_modules.html”
Slowly I understand how the module works and what the entire entries do, but without understandig the syntax and how to code. I will not come further.Regards
Carsten -
@xIExodusIx
Dear Carsten,quick question: For several reasons yesterday I had checked the log files during startup of my MagicMirror.
Unfortunately there is an error related to your pimped module:
[ERROR] ERROR! Could not find main module js file for MMM-FRITZ-Box-Callmonitor-py3_drtorchwood
The module works (!?) but may there is something that don’t work?
Is there a submodule which is not loaded to git?
Thanks for any hint!
-
@rkorell said in MMM-FRITZ-Box-Callmonitor-py3 and MMM-Callmonitor-Current-Call:
MMM-FRITZ-Box-Callmonitor-py3
Hi Ralf,
I have searched all my log-files in “.pm2/logs/” for that string, but I didn’t find anything related to that error. I don’t have this error in my pm2 log-files.
Are there more log-files I can check, if so where can I find them?
I’m sure you have checked your MagicMirror/config/config.js if there is a type missmatch.Reguards
Carrsten -
@xIExodusIx It’s in the PM2 logs, yes.
I guess you have some code parked in an additional file “py3_drtorchwood” which is present on your system but not on mine …
especially drtorchwood isn’t present on my system at all.
Will dig into code lateron …
Thanks for your double check.Regards,
Ralf