Open rbrueckner82 opened 6 years ago
Which MM version are you using?
i had the issue with 2.4.1 and the latest 2.5.0
I have exactly the same issue. I tried to debug the fritz_access.py script.
It seems to me something goes wrong when downloading the phone books. My FritzBox contains two phonebooks: The standard one which I can't delete and an external phonebook from my Google account. In my case result["NewPhonebookList"]
in line 25 is 0,1
. When moving through this list the second time phonebook_id gets the comma value instead of the value 1.
I tried to fix it, but I still get the PhythonShell is not a constructor error
I am using MagicMirror v2.5.0
Same issue for me. I also tried to use curly brackets in line 10 of node_helper.js like so: const {PythonShell} = require ... But, now I receive:
SyntaxError: Unexpected Token F in JSON at position 2
M4Rv,
Were you able to figure this out? I am getting the same issue after I had the brackets.
same here :(
I fixed it (at least for me)! It took me hours to find out, that it's a combination of three issues:
As mentioned aldready above by M4Rv the require statement in line 10 of node_helper.js requires curly brackets: const {PythonShell} = require('python-shell');
Options beginning at line 210 of node_helper.js need additional option "pythonPath":
var options = {
pythonPath: 'python',
mode: 'json',
scriptPath: path.resolve(__dirname),
args: args
};
I assume this is only an issue, if the Fritz!Box uses more than one Phonebook:
The NewPhoneookList received in line 22 of fritz_access.py contains commas between the IDs. These commas need to be removed from the array before going through the array in the for loop.
I added the line
result["NewPhonebookList"] = result["NewPhonebookList"].replace(",","")
in fritz_access.py right before the existing line
for phonebook_id in result["NewPhonebookList"]:
I hope this works also for you.
good job, worked for me! it shows me recent calls but no live status "xyz is calling" - did i miss something in the config?
Alerting of incoming calls worked for me from the beginning. I only had the above issue with the display of the list of recent calls. Did you activate the callmonitor of your Fritz!Box as described in step 4 of the installation instructions?
Yeah i did.. at least i think so - hard to tell without feedback. running FRITZ!OS 06.87 on 6490 cable.
good job, for me i set 1. and 2. and now is working fine
thanks
I reduced code for step 3 and created a new fork pieba which contains the changes for all three steps: https://github.com/PieBa/MMM-FRITZ-Box-Callmonitor/tree/pieba
New step 3:
In file fritz_access.py just add .replace(",","")
in line 26 before the :
So the complete new line 26 would be like this:
for phonebook_id in result["NewPhonebookList"].replace(",",""):
How about a PR on this module?
How about a PR on this module?
I am not a programmer and I am new to MM, github and linux. I don't know how to do a PR. However I'd like to contribute if I can.
I have the problem that incoming calls are no longer displayed centrally. I have changed the items described above.
I have the problem solved for me :) (Python 3.8.x, MM2) Hier is the code.
In the file "node_helper.js": ... const {PythonShell} = require("python-shell"); //const PythonShell = require('python-shell'); ...
In the file "fritz_access.py":
..... import argparse, os, sys, json from fritzconnection import FritzConnection import urllib.request as urllib2 .....
and ..... def forward_file(self, url, filename): try: f = urllib2.urlopen(url) content = f.read().decode("utf-8") .....
Does anyone know this mistake, meets with this as well as the FitBit module, according to MichMich it lies at the respective modules and not at the MagicMirror Core.
https://github.com/MichMich/MagicMirror/issues/1415
0|mm | TypeError: PythonShell is not a constructor 0|mm | at Class.loadDataFromAPI (/home/pi/MagicMirror/modules/MMM-FRITZ-Box-Callmonitor/node_helper.js:216:17) 0|mm | at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-FRITZ-Box-Callmonitor/node_helper.js:62:10) 0|mm | at Socket. (/home/pi/MagicMirror/modules/node_modules/node_helper/index.js:113:11)
0|mm | at emitTwo (events.js:126:13)
0|mm | at Socket.emit (events.js:214:7)
0|mm | at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:513:12
0|mm | at _combinedTickCallback (internal/process/next_tick.js:131:7)
0|mm | at process._tickCallback (internal/process/next_tick.js:180:9)