Panda88CO / udi-TeslaPowerWall

UDI tesla power wall automation using Polyglot
MIT License
0 stars 0 forks source link

Local and cloud connection issues #3

Open oddirt opened 3 years ago

oddirt commented 3 years ago

Great idea to connect to the PowerWall. I'm getting this error trying to connect to local:

2021-07-13 21:44:58,619 [NodeServer] [INFO ] BOTH selected 2021-07-13 21:44:58,620 [NodeServer] [DEBUG] class tesla_info - init 2021-07-13 21:44:58,627 [NodeServer] [INFO ] Local Access: True 2021-07-13 21:44:58,634 [NodeServer] [INFO ] Cloud Access: True 2021-07-13 21:44:58,641 [NodeServer] [DEBUG] Local access enabled 2021-07-13 21:45:08,765 [NodeServer] [DEBUG] No connection to local power wall - keep trying to login - Powerwall is unreachable: HTTPSConnectionPool(host='xxx.xxx.xxx.xxx', port=443): Max retries exceeded with url: /api/login/Basic (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x80267be90>, 'Connection to xxx.xxx.xxx timed out. (connect timeout=10)')) 2021-07-13 21:45:08,766 [NodeServer] [DEBUG] Exception Controller start: Powerwall api error: Must be logged in to log out 2021-07-13 21:45:08,767 [NodeServer] [INFO ] Did not connect to power wall 2021-07-13 21:45:08,768 [NodeServer] [DEBUG] stop - Cleaning up 2021-07-13 21:45:58,569 [Controller] [INFO ] Tesla Power Wall Controller shortPoll 2021-07-13 21:45:58,571 [Controller] [DEBUG] heartbeat: hb=0 2021-07-13 21:45:58,573 [Controller] [INFO ] Waiting for system/nodes to get created 2021-07-13 21:46:58,571 [Controller] [INFO ] Tesla Power Wall Controller shortPoll 2021-07-13 21:46:58,572 [Controller] [DEBUG] heartbeat: hb=1

...those lines repeat a bunch of times and I also get this error:

2021-07-13 21:53:07,582 [Controller] [DEBUG] ISY-update called 2021-07-13 21:53:07,583 [Controller] [ERROR] _parseInput: failed controller.runCmd(UPDATE) 'NoneType' object has no attribute 'pollSystemData' Traceback (most recent call last): File "/var/polyglot/.local/lib/python3.7/site-packages/polyinterface/polyinterface.py", line 846, in _parseInput self.nodes[input[key]['address']].runCmd(input[key]) File "/var/polyglot/.local/lib/python3.7/site-packages/polyinterface/polyinterface.py", line 749, in runCmd fun(self, command) File "./TeslaPWController.py", line 343, in ISYupdate if self.TPW.pollSystemData('all'): AttributeError: 'NoneType' object has no attribute 'pollSystemData'

I had recently logged into the local PW gateway to verify my account credentials. They worked, so I logged out.

When I go into admin console, the NS appears but all the fields are blank, so it seems the cloud connection isn't working either. I can log into my Tesla web account with the same credentials.

Thanks in advance.

Panda88CO commented 3 years ago
There is currently an issue with Tesla’s cloud connection – seems they added one more parameter to the authentication procedure – I am debugging it and hope to have a solution soon Can you try to use LOCAL only and see if it works – I think the issue is the CLOUD connection fails and then both fails – once both are established it is ok if one of the fails (based on my testing).  If not can you send me the full log – ***@***.*** Christian Sent from Mail for Windows 10 From: oddirtSent: Tuesday, July 13, 2021 9:54 PMTo: Panda88CO/udi-TeslaPowerWallCc: SubscribedSubject: [Panda88CO/udi-TeslaPowerWall] Local and cloud connection issues (#3) Great idea to connect to the PowerWall. I'm getting this error trying to connect to local:2021-07-13 21:44:58,619 [NodeServer] [INFO ] BOTH selected2021-07-13 21:44:58,620 [NodeServer] [DEBUG] class tesla_info - init2021-07-13 21:44:58,627 [NodeServer] [INFO ] Local Access: True2021-07-13 21:44:58,634 [NodeServer] [INFO ] Cloud Access: True2021-07-13 21:44:58,641 [NodeServer] [DEBUG] Local access enabled2021-07-13 21:45:08,765 [NodeServer] [DEBUG] No connection to local power wall - keep trying to login - Powerwall is unreachable: HTTPSConnectionPool(host='xxx.xxx.xxx.xxx', port=443): Max retries exceeded with url: /api/login/Basic (Caused by ConnectTimeoutError(, 'Connection to 10.35.94.53 timed out. (connect timeout=10)'))2021-07-13 21:45:08,766 [NodeServer] [DEBUG] Exception Controller start: Powerwall api error: Must be logged in to log out2021-07-13 21:45:08,767 [NodeServer] [INFO ] Did not connect to power wall2021-07-13 21:45:08,768 [NodeServer] [DEBUG] stop - Cleaning up2021-07-13 21:45:58,569 [Controller] [INFO ] Tesla Power Wall Controller shortPoll2021-07-13 21:45:58,571 [Controller] [DEBUG] heartbeat: hb=02021-07-13 21:45:58,573 [Controller] [INFO ] Waiting for system/nodes to get created2021-07-13 21:46:58,571 [Controller] [INFO ] Tesla Power Wall Controller shortPoll2021-07-13 21:46:58,572 [Controller] [DEBUG] heartbeat: hb=1I had recently logged into the local PW gateway to verify my account credentials. They worked, so I logged out.When I go into admin console, the NS appears but all the fields are blank, so it seems the cloud connection isn't working either. I can log into my Tesla web account with the same credentials.Thanks in advance.—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
oddirt commented 3 years ago

Sure thing, here's the log after changing over to local only:

2021-07-14 09:34:58,893 [Interface ] [DEBUG] Received stop from Polyglot... Shutting Down. 2021-07-14 09:34:58,895 [Interface ] [INFO ] Disconnecting from MQTT... localhost:1883 2021-07-14 09:34:58,896 [Interface ] [DEBUG] stop - Cleaning up 2021-07-14 09:34:58,898 [Interface ] [INFO ] MQTT Graceful disconnection. 2021-07-14 09:35:26,894 [MainThread] [INFO ] Received Config from STDIN. 2021-07-14 09:35:26,895 [MainThread] [INFO ] UDI Polyglot v2 Interface 2.0.34 Starting... 2021-07-14 09:35:27,452 [MainThread] [DEBUG] gws: {'default': {2: ('xxx.xxx.xxx.xxx', 'igb0')}, 2: [('xxx.xxx.xxx.xxx', 'igb0', True)]} 2021-07-14 09:35:27,452 [MainThread] [DEBUG] gw: default=('xxx.xxx.xxx.xxx', 'igb0') 2021-07-14 09:35:27,453 [MainThread] [DEBUG] ifad: igb0=[{'addr': 'xxx.xxx.xxx.xxx', 'netmask': '255.255.255.0', 'broadcast': 'xxx.xxx.xxx.xxx'}] 2021-07-14 09:35:27,453 [MainThread] [INFO ] Connect: Network Interface: {'addr': 'xxx.xxx.xxx.xxx', 'netmask': '255.255.255.0', 'broadcast': 'xxx.xxx.xxx.xxx'} 2021-07-14 09:35:27,455 [Interface ] [INFO ] Connecting to MQTT... localhost:1883 2021-07-14 09:35:27,457 [MainThread] [INFO ] init Tesla Power Wall Controller 2021-07-14 09:35:27,490 [Interface ] [INFO ] MQTT Connected with result code 0 (Success) 2021-07-14 09:35:27,492 [Interface ] [INFO ] MQTT Subscribing to topic: udi/polyglot/ns/10 - MID: 1 Result: 0 2021-07-14 09:35:27,492 [Interface ] [INFO ] MQTT Subscribing to topic: udi/polyglot/connections/polyglot - MID: 2 Result: 0 2021-07-14 09:35:27,493 [Interface ] [INFO ] Sent Connected message to Polyglot 2021-07-14 09:35:27,542 [NodeServer] [INFO ] LogFile disabled 2021-07-14 09:35:27,544 [NodeServer] [DEBUG] LOCAL 2021-07-14 09:35:27,545 [NodeServer] [DEBUG] IPaddress retrieved: xxx.xxx.xxx.xxx 2021-07-14 09:35:27,546 [NodeServer] [INFO ] OCAL_USER_EMAIL retrieved: XXXXXXXX 2021-07-14 09:35:27,547 [NodeServer] [DEBUG] LOCAL_USER_PASSWORD retrieved: XXXXXXXX 2021-07-14 09:35:27,555 [NodeServer] [INFO ] LOCAL selected 2021-07-14 09:35:27,562 [NodeServer] [DEBUG] class tesla_info - init 2021-07-14 09:35:27,569 [NodeServer] [INFO ] Local Access: True 2021-07-14 09:35:27,576 [NodeServer] [INFO ] Cloud Access: False 2021-07-14 09:35:27,583 [NodeServer] [DEBUG] Local access enabled 2021-07-14 09:35:37,649 [NodeServer] [DEBUG] No connection to local power wall - keep trying to login - Powerwall is unreachable: HTTPSConnectionPool(host='xxx.xxx.xxx.xxx', port=443): Max retries exceeded with url: /api/login/Basic (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x8016dd350>, 'Connection to xxx.xxx.xxx.xxx timed out. (connect timeout=10)')) 2021-07-14 09:35:37,650 [NodeServer] [DEBUG] Exception Controller start: Powerwall api error: Must be logged in to log out 2021-07-14 09:35:37,651 [NodeServer] [INFO ] Did not connect to power wall 2021-07-14 09:35:37,651 [NodeServer] [DEBUG] stop - Cleaning up 2021-07-14 09:36:27,528 [Controller] [INFO ] Tesla Power Wall Controller shortPoll 2021-07-14 09:36:27,530 [Controller] [DEBUG] heartbeat: hb=0 2021-07-14 09:36:27,532 [Controller] [INFO ] Waiting for system/nodes to get created

Panda88CO commented 3 years ago

Found a bug in Local access - I'll verify and release later - I am focused on finding a solution for the Tesla Authentication - seems they changed something

oddirt commented 3 years ago

Thanks for looking into this--you totally rock! Appreciate the responsiveness. Yes, I was masking out the local IPs of my PW and router.

mdorr75 commented 3 years ago

I totally concur (re: rocking and responding).

Panda88CO commented 3 years ago

I found discussion on what is happening - seems Tesla is adding CAPTCHAss https://github.com/timdorr/tesla-api/discussions/390 I'll see if there is a work around - I may consider using an automated service to get around it - not too expensive assuming the number of users is low - It seems you can refresh the Token without CAPTACH so I may work on a way to store tokens locally in case of reboot I'll keep you guys updated

Panda88CO commented 3 years ago

Made a release that I believe fixes the local access - Cloud is still TBD

oddirt commented 3 years ago

Thanks. I'm still getting the same error with local. Is there something I need to do on the PowerWall side to enable access? I can see it on my LAN and use its IP address in the NS configuration page.

Might not be relevant, but I usually can't access the Tesla gateway's web interface unless I disconnect my laptop from my LAN, connect to the gateway's wifi SSID, then browse to the https://teg site.

Panda88CO commented 3 years ago

Can you send log again - I wonder if it updated - I had the same error but after I updated it is fixed (latest version is 0.6.28)

In my setup I just log in using a browser - xxx.xxx.xxx.xxx on my local network - if that works I see no reason it would not work - It seems different from what you do - It should be accessible directly from you local LAN - not a dedicated network. Mine is hooked up to local LAN - I log in as type customer. Seems you can go into connections and connect your LAN and/or to your WIFI

My power wall was just updated to the a newer version - but I worked with the older one as well You may need to erase the 2nd node in the polisy if it is there - it seems to be left over when you change to LOCAL from CLOUD/BOTH

oddirt commented 3 years ago

Sure thing:

2021-07-15 18:33:10,206 MQTT polyinterface DEBUG polyinterface:_message: Received stop from Polyglot... Shutting Down. 2021-07-15 18:33:10,207 MQTT polyinterface INFO polyinterface:stop: Disconnecting from MQTT... localhost:1883 2021-07-15 18:33:10,209 MQTT polyinterface DEBUG TeslaPWController:stop: stop - Cleaning up 2021-07-15 18:33:10,210 MQTT polyinterface INFO polyinterface:_disconnect: MQTT Graceful disconnection. 2021-07-15 18:33:10,211 MQTT polyinterface DEBUG polyinterface:_startMqtt: MQTT Done: 2021-07-15 18:33:13,721 MainThread polyinterface INFO polylogger:set_basic_config: set_basic_config: enable=True level=30 2021-07-15 18:33:14,668 MainThread polyinterface INFO polyinterface:init_interface: Received Config from STDIN. 2021-07-15 18:33:14,669 MainThread polyinterface INFO init:: UDI Polyglot v2 Interface 2.1.0 Starting... 2021-07-15 18:33:15,311 MainThread polyinterface DEBUG polyinterface:get_network_interface: gws: {'default': {2: ('xxx.xxx.xxx.1', 'igb0')}, 2: [('xxx.xxx.xxx.1', 'igb0', True)]} 2021-07-15 18:33:15,311 MainThread polyinterface DEBUG polyinterface:get_network_interface: gw: default=('xxx.xxx.xxx.1', 'igb0') 2021-07-15 18:33:15,312 MainThread polyinterface DEBUG polyinterface:get_network_interface: ifad: igb0=[{'addr': 'xxx.xxx.xxx.106', 'netmask': '255.255.255.0', 'broadcast': 'xxx.xxx.xxx.255'}] 2021-07-15 18:33:15,312 MainThread polyinterface INFO polyinterface:init: Connect: Network Interface: {'addr': 'xxx.xxx.xxx.106', 'netmask': '255.255.255.0', 'broadcast': 'xxx.xxx.xxx.255'} 2021-07-15 18:33:15,314 Interface polyinterface INFO polyinterface:_startMqtt: Connecting to MQTT... localhost:1883 2021-07-15 18:33:15,320 MainThread polyinterface INFO TeslaPWController:init: init Tesla Power Wall Controller 2021-07-15 18:33:15,345 MQTT polyinterface INFO polyinterface:_connect: MQTT Connected with result code 0 (Success) 2021-07-15 18:33:15,347 MQTT polyinterface INFO polyinterface:_connect: MQTT Subscribing to topic: udi/polyglot/ns/10 - MID: 1 Result: 0 2021-07-15 18:33:15,348 MQTT polyinterface INFO polyinterface:_connect: MQTT Subscribing to topic: udi/polyglot/connections/polyglot - MID: 2 Result: 0 2021-07-15 18:33:15,348 MQTT polyinterface INFO polyinterface:_connect: Sent Connected message to Polyglot 2021-07-15 18:33:15,353 MQTT polyinterface INFO polyinterface:_subscribe: MQTT Subscribed Succesfully for Message ID: 1 - QoS: (0,) 2021-07-15 18:33:15,356 MQTT polyinterface INFO polyinterface:_subscribe: MQTT Subscribed Succesfully for Message ID: 2 - QoS: (0,) 2021-07-15 18:33:15,399 NodeServer polyinterface INFO TeslaPWController:start: LogFile disabled 2021-07-15 18:33:15,401 NodeServer polyinterface DEBUG TeslaPWController:start: LOCAL 2021-07-15 18:33:15,402 NodeServer polyinterface DEBUG TeslaPWController:start: IPaddress retrieved: xxx.xxx.xxx.53 2021-07-15 18:33:15,403 NodeServer polyinterface INFO TeslaPWController:start: OCAL_USER_EMAIL retrieved: xxxx 2021-07-15 18:33:15,403 NodeServer polyinterface DEBUG TeslaPWController:start: LOCAL_USER_PASSWORD retrieved: XXXXXXXX 2021-07-15 18:33:15,404 NodeServer polyinterface INFO TeslaPWController:start: LOCAL selected 2021-07-15 18:33:15,404 NodeServer polyinterface DEBUG TeslaInfo:init: class tesla_info - init 2021-07-15 18:33:15,405 NodeServer polyinterface INFO TeslaInfo:init: Local Access: True 2021-07-15 18:33:15,405 NodeServer polyinterface INFO TeslaInfo:init: Cloud Access: False 2021-07-15 18:33:15,406 NodeServer polyinterface DEBUG TeslaInfo:init: Local access enabled 2021-07-15 18:33:25,491 NodeServer polyinterface DEBUG TeslaInfo:localLogin: No connection to local power wall - keep trying to login - Powerwall is unreachable: HTTPSConnectionPool(host='xxx.xxx.xxx.53', port=443): Max retries exceeded with url: /api/login/Basic (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x8027bfbe0>, 'Connection to xxx.xxx.xxx.53 timed out. (connect timeout=10)')) 2021-07-15 18:33:25,493 NodeServer polyinterface DEBUG TeslaPWController:start: Exception Controller start: Powerwall api error: Must be logged in to log out 2021-07-15 18:33:25,493 NodeServer polyinterface INFO TeslaPWController:start: Did not connect to power wall 2021-07-15 18:33:25,494 NodeServer polyinterface DEBUG TeslaPWController:stop: stop - Cleaning up 2021-07-15 18:34:15,392 Controller polyinterface INFO TeslaPWController:shortPoll: Tesla Power Wall Controller shortPoll 2021-07-15 18:34:15,394 Controller polyinterface DEBUG TeslaPWController:heartbeat: heartbeat: hb=0

The dashboard shows version 0.6.28: TeslaPWControl(10) Current Status: Connected Current Version: 0.6.28

Panda88CO commented 3 years ago

looks OK to besides the connection to the power wall. If you can figure out to log into you powerwall on your LAN I am confident it will work. I think you can try to configure the network once you are logged in to the power wall

mdorr75 commented 3 years ago

Indeed, exactly as you said, the LAN connection is configured after logging into the gateway in access point mode (like lots of IOT stuff). Just in case, here are the official instructions:

https://www.tesla.com/support/energy/powerwall/own/monitoring-from-home-network

For some reason, the https://teg URL didn't work for me, but the 192.168.91.1 address did.

oddirt commented 3 years ago

Weird, I had set up my PW with a LAN IP address and have been able to connect to it using the app. Never been able to log into the PW using the LAN IP, and following the steps @mdorr75 shared didn't change that. Only thing I can think of is that my PW isn't fully installed. It's been 2 years and Tesla has had to go back to the drawing board to do a full home back up solution. The PW is otherwise functional. I'll discuss with Tesla when they come back some day to finish the install.

Panda88CO commented 3 years ago

Can you ping the PW on the LAN? Best of luck

oddirt commented 3 years ago

I can't ping it even though it comes up on the LAN device list. I'm guessing I'll need the installer login to allow pings and network login.

Panda88CO commented 3 years ago

yes - it sounds like something is not installed correctly - networking wise

Panda88CO commented 3 years ago

Quick question - I think I know how to get by the new login from Tesla. The question is what is the preferred way - I can email an captcha image file to use and user must input in polisy to continue with login - or alternative is to use an automated captcha solver service - it is not 100% accurate but it can be done in background. It does cost a little money (500solves/$) What do you think is the best way - To use the solver one need to input an API key (I do not want to leave my key in public code) Let me know

mdorr75 commented 3 years ago

My gut reaction is that relying on another third party service is a bad idea in the long term (perhaps for you more than anyone). From my naive user perspective, anything you can do to pass through Tesla's captcha challenge would be the way to go if at all possible (which I know you also realize). When you say that you can email an image file, is that what you have in mind? If so, I guess one issue might be timeout, but that's not necessarily a deal killer for a user like me assuming an appropriate message is displayed indicating the need to respond promptly to the challenge.

Panda88CO commented 3 years ago

yes - I think it will work on Polisy - but not sure on PGC - The message interface seems different.

I think I'll try both to see what works better.

I believe it should only be needed one time after system starts - should be possible to renew the token once logged into the system

oddirt commented 3 years ago

Whatever is easiest to develop and implement for end users should work, so the concept of a third party sound reasonable. I think with Polyglot 3, a paid solution could be feasible for you to implement with end users (you should also get paid for your time and expertise).

Slightly off-topic but I also wonder about the usefulness of the cloud solution in a power outage situation where local ISP relays can go down. I know there are many other use scenarios for this NS where the cloud connectivity are useful. I'm banking on local connectivity for worst case scenario of PG&E PSP or other things that could bring down the local grid.

Panda88CO commented 3 years ago

Understood - The automatic solver is an easier approach with the existing code - otherwise I need to break the login into two On the other topic - I agree - that is why I offer the option of BOTH. However, there is no (minimal) ability to control the firewall locally - control can only be done through cloud interface. The cloud open new abilities on optimizing power consumption - e.g. letting power wall discharge more if it will be sunny tomorrow - build you own discharge schedules, only allow storm mode when electricity cost is low etc.

CLalib commented 3 years ago

I am completely new to installing your nodeserver. I attempted both locally on a Polisy and in the cloud. Could not connect either way.

I am attaching my logs for both the local and cloud install. Any suggestions would be most appreciated.

Really appreciate your efforts on this! Looking forward to getting it up and running!

Thanks, Chris

Local Install

8/14/2021, 15:44:20 [polyglot] info: Starting Polyglot.... 8/14/2021, 15:44:20 [polyglot] info: Settings: Polyglot Version 2.2.13 8/14/2021, 15:44:20 [polyglot] info: Settings: Retrieved config from database 8/14/2021, 15:44:20 [polyglot] info: Running in Polisy mode 8/14/2021, 15:44:20 [polyglot] info: Settings: Retrieved config overrides from .env and updated database 8/14/2021, 15:44:20 [polyglot] info: Aedes MQTT Broker Service: Started on port 1883 8/14/2021, 15:44:21 [polyglot] info: MQTT Client Service: Started 8/14/2021, 15:44:21 [polyglot] info: HTTPS Interface Service: Started - Address: 0.0.0.0 Port: 443 8/14/2021, 15:44:21 [polyglot] info: MQTTS: polyglot authenticated successfully. 8/14/2021, 15:44:21 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:44:22 [polyglot] info: MQTTS: polyglot_frontend-LV3iQ authenticated successfully. 8/14/2021, 15:44:22 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:44:22 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 8/14/2021, 15:44:22 [polyglot] info: ISY: Got Version 5.3.4 8/14/2021, 15:44:22 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 8/14/2021, 15:44:22 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 8/14/2021, 15:44:25 [polyglot] error: MQTTS: connectionError: null Invalid protocol 8/14/2021, 15:44:26 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:44:30 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:44:55 [polyglot] info: MQTTS: Client Disconnected: 8/14/2021, 15:44:55 [polyglot] info: MQTTS: polyglot_frontend-689Ob authenticated successfully. 8/14/2021, 15:44:55 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:44:56 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 8/14/2021, 15:45:05 [polyglot] info: MQTTS: Client Disconnected: 8/14/2021, 15:45:05 [polyglot] info: MQTTP: Frontend Websockets interface Disconnected. 8/14/2021, 15:45:10 [polyglot] info: Successful login by admin 8/14/2021, 15:45:11 [polyglot] info: MQTTS: polyglot_frontend-kRqlZ authenticated successfully. 8/14/2021, 15:45:11 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:45:11 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 8/14/2021, 15:45:27 [polyglot] info: TeslaPWControl New(1): Attempting to install TeslaPWControl New NodeServer into ISY. 8/14/2021, 15:45:27 [polyglot] error: Error: Failed to install NodeServer. ISY responded with other than 200. at Object.installNodeServer (/snapshot/polyglot-v2/lib/modules/nodeserver.js:910:42) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Object.addns (/snapshot/polyglot-v2/lib/modules/nodeserver.js:840:24) at async nodeservers (/snapshot/polyglot-v2/lib/modules/parse/frontend.js:150:18) 8/14/2021, 15:45:27 [polyglot] error: FrontendP: addns NodeServer error ReferenceError: newNodeServer is not defined at Object.addns (/snapshot/polyglot-v2/lib/modules/nodeserver.js:862:7) at processTicksAndRejections (internal/process/task_queues.js:97:5)

Cloud Install

Cloning into 'nodeserver'... Collecting pgc_interface>=1.1.0 Downloading https://files.pythonhosted.org/packages/4b/01/130cf4d57349365bc63b1fc1597e050f421d30560f9da7361e4d747b8a06/pgc_interface-1.1.9.tar.gz Collecting AWSIoTPythonSDK (from pgc_interface>=1.1.0) Downloading https://files.pythonhosted.org/packages/c7/df/b1d263104123ec6aff3564bf23cebe184713a8fd090f0541e9a683b7ed13/AWSIoTPythonSDK-1.4.9.tar.gz (80kB) Building wheel for pgc-interface (setup.py): started Building wheels for collected packages: pgc-interface, AWSIoTPythonSDK Building wheel for pgc-interface (setup.py): finished with status 'done' Stored in directory: /root/.cache/pip/wheels/1b/0a/05/672f0f2868a4a4d95b35f28481ad8b0196ba69fdd7fbc96ecb Building wheel for AWSIoTPythonSDK (setup.py): started Stored in directory: /root/.cache/pip/wheels/c6/81/c4/92f92fc23f1247e45c6e1e00c6c9a3dbe9450ba9be9cb17bf1 Building wheel for AWSIoTPythonSDK (setup.py): finished with status 'done' Successfully built pgc-interface AWSIoTPythonSDK Installing collected packages: AWSIoTPythonSDK, pgc-interface Successfully installed AWSIoTPythonSDK-1.4.9 pgc-interface-1.1.9 WARNING: You are using pip version 19.1.1, however version 21.2.4 is available. You should consider upgrading via the 'pip install --upgrade pip' command. (+ pip3 install -r requirements_cloud.txt --user) Collecting tesla_powerwall (from -r requirements_cloud.txt (line 1)) Downloading https://files.pythonhosted.org/packages/a0/db/1e848aa1d6dde48374065760821afdc98d0de1741ecc122094e0d6e5d129/tesla_powerwall-0.3.10.tar.gz Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Installing backend dependencies: started Installing backend dependencies: finished with status 'done' Preparing wheel metadata: started Preparing wheel metadata: finished with status 'done' Collecting requests_oauth2 (from -r requirements_cloud.txt (line 2)) Downloading https://files.pythonhosted.org/packages/52/dc/01c3c75e6e7341a2c7a971d111d7105df230ddb74b5d4e10a3dabb61750c/requests-oauth2-0.3.0.tar.gz Collecting time (from -r requirements_cloud.txt (line 3)) ERROR: Could not find a version that satisfies the requirement time (from -r requirements_cloud.txt (line 3)) (from versions: none) ERROR: No matching distribution found for time (from -r requirements_cloud.txt (line 3)) WARNING: You are using pip version 19.1.1, however version 21.2.4 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

Panda88CO commented 3 years ago

The nodeserver is transitioning now as Tesla changed their login method. I am in process to fix the issue. I'll let you know once it is fixed

Christian Olgaard


From: CLalib @.> Sent: Sunday, August 15, 2021 9:06:36 AM To: Panda88CO/udi-TeslaPowerWall @.> Cc: Panda88CO @.>; Comment @.> Subject: Re: [Panda88CO/udi-TeslaPowerWall] Local and cloud connection issues (#3)

I am completely new to installing your nodeserver. I attempted both locally on a Polisy and in the cloud. Could not connect either way.

I am attaching my logs for both the local and cloud install. Any suggestions would be most appreciated.

Really appreciate your efforts on this! Looking forward to getting it up and running!

Thanks, Chris

Local Install

8/14/2021, 15:44:20 [polyglot] info: Starting Polyglot.... 8/14/2021, 15:44:20 [polyglot] info: Settings: Polyglot Version 2.2.13 8/14/2021, 15:44:20 [polyglot] info: Settings: Retrieved config from database 8/14/2021, 15:44:20 [polyglot] info: Running in Polisy mode 8/14/2021, 15:44:20 [polyglot] info: Settings: Retrieved config overrides from .env and updated database 8/14/2021, 15:44:20 [polyglot] info: Aedes MQTT Broker Service: Started on port 1883 8/14/2021, 15:44:21 [polyglot] info: MQTT Client Service: Started 8/14/2021, 15:44:21 [polyglot] info: HTTPS Interface Service: Started - Address: 0.0.0.0 Port: 443 8/14/2021, 15:44:21 [polyglot] info: MQTTS: polyglot authenticated successfully. 8/14/2021, 15:44:21 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:44:22 [polyglot] info: MQTTS: polyglot_frontend-LV3iQ authenticated successfully. 8/14/2021, 15:44:22 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:44:22 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 8/14/2021, 15:44:22 [polyglot] info: ISY: Got Version 5.3.4 8/14/2021, 15:44:22 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 8/14/2021, 15:44:22 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 8/14/2021, 15:44:25 [polyglot] error: MQTTS: connectionError: null Invalid protocol 8/14/2021, 15:44:26 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:44:30 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:44:55 [polyglot] info: MQTTS: Client Disconnected: 8/14/2021, 15:44:55 [polyglot] info: MQTTS: polyglot_frontend-689Ob authenticated successfully. 8/14/2021, 15:44:55 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:44:56 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 8/14/2021, 15:45:05 [polyglot] info: MQTTS: Client Disconnected: 8/14/2021, 15:45:05 [polyglot] info: MQTTP: Frontend Websockets interface Disconnected. 8/14/2021, 15:45:10 [polyglot] info: Successful login by admin 8/14/2021, 15:45:11 [polyglot] info: MQTTS: polyglot_frontend-kRqlZ authenticated successfully. 8/14/2021, 15:45:11 [polyglot] info: MQTTS: Client Connected: 8/14/2021, 15:45:11 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 8/14/2021, 15:45:27 [polyglot] info: TeslaPWControl New(1): Attempting to install TeslaPWControl New NodeServer into ISY. 8/14/2021, 15:45:27 [polyglot] error: Error: Failed to install NodeServer. ISY responded with other than 200. at Object.installNodeServer (/snapshot/polyglot-v2/lib/modules/nodeserver.js:910:42) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Object.addns (/snapshot/polyglot-v2/lib/modules/nodeserver.js:840:24) at async nodeservers (/snapshot/polyglot-v2/lib/modules/parse/frontend.js:150:18) 8/14/2021, 15:45:27 [polyglot] error: FrontendP: addns NodeServer error ReferenceError: newNodeServer is not defined at Object.addns (/snapshot/polyglot-v2/lib/modules/nodeserver.js:862:7) at processTicksAndRejections (internal/process/task_queues.js:97:5)

Cloud Install

Cloning into 'nodeserver'... Collecting pgc_interface>=1.1.0 Downloading https://files.pythonhosted.org/packages/4b/01/130cf4d57349365bc63b1fc1597e050f421d30560f9da7361e4d747b8a06/pgc_interface-1.1.9.tar.gz Collecting AWSIoTPythonSDK (from pgc_interface>=1.1.0) Downloading https://files.pythonhosted.org/packages/c7/df/b1d263104123ec6aff3564bf23cebe184713a8fd090f0541e9a683b7ed13/AWSIoTPythonSDK-1.4.9.tar.gz (80kB) Building wheel for pgc-interface (setup.py): started Building wheels for collected packages: pgc-interface, AWSIoTPythonSDK Building wheel for pgc-interface (setup.py): finished with status 'done' Stored in directory: /root/.cache/pip/wheels/1b/0a/05/672f0f2868a4a4d95b35f28481ad8b0196ba69fdd7fbc96ecb Building wheel for AWSIoTPythonSDK (setup.py): started Stored in directory: /root/.cache/pip/wheels/c6/81/c4/92f92fc23f1247e45c6e1e00c6c9a3dbe9450ba9be9cb17bf1 Building wheel for AWSIoTPythonSDK (setup.py): finished with status 'done' Successfully built pgc-interface AWSIoTPythonSDK Installing collected packages: AWSIoTPythonSDK, pgc-interface Successfully installed AWSIoTPythonSDK-1.4.9 pgc-interface-1.1.9 WARNING: You are using pip version 19.1.1, however version 21.2.4 is available. You should consider upgrading via the 'pip install --upgrade pip' command. (+ pip3 install -r requirements_cloud.txt --user) Collecting tesla_powerwall (from -r requirements_cloud.txt (line 1)) Downloading https://files.pythonhosted.org/packages/a0/db/1e848aa1d6dde48374065760821afdc98d0de1741ecc122094e0d6e5d129/tesla_powerwall-0.3.10.tar.gz Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Installing backend dependencies: started Installing backend dependencies: finished with status 'done' Preparing wheel metadata: started Preparing wheel metadata: finished with status 'done' Collecting requests_oauth2 (from -r requirements_cloud.txt (line 2)) Downloading https://files.pythonhosted.org/packages/52/dc/01c3c75e6e7341a2c7a971d111d7105df230ddb74b5d4e10a3dabb61750c/requests-oauth2-0.3.0.tar.gz Collecting time (from -r requirements_cloud.txt (line 3)) ERROR: Could not find a version that satisfies the requirement time (from -r requirements_cloud.txt (line 3)) (from versions: none) ERROR: No matching distribution found for time (from -r requirements_cloud.txt (line 3)) WARNING: You are using pip version 19.1.1, however version 21.2.4 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Panda88CO/udi-TeslaPowerWall/issues/3#issuecomment-899072183, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APQ7ECVD4E6WALCDB4WDD4TT47QYZANCNFSM5AKVJNUA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.

CLalib commented 3 years ago

Thanks so much! Again, we all appreciate your efforts on this. This will be excellent functionality.

Panda88CO commented 3 years ago

Just a quick update - I managed to get captcha login on cloud working, but Tesla just changed to use recaptcha - Need to find a work around this (if possible)

CLalib commented 3 years ago

Thanks @Panda88CO ... I would be totally fine with local access only. I know you are still updating the code, but right now I cannot install 0.7.4 on my Polisy. I get a "cloneRepo: Non-zero exit code: 128" error result and the install fails.

There is obviously a lot more that could be done, but my short-term goal is just to have ISY turn off air conditioners in the event of a grid outage. Local only should be fine for that.

Again, sincerely appreciate your efforts.

Panda88CO commented 3 years ago

I do not see the same issue on my setup. Can you try to uninstall completely - ideally lremove from polisy (if possible) login to polisy (using Putty SSH or similar) admin/admin and do cd /var/polyglot/nodeservers and then sudo rm-r TeslaPWControl and then try to install again If that does not work can you try to run bash install.sh from /var/polyglot/nodeservers/TeslaPWControl and let me know the error - I think it may be caused by a missing library but on my system they are all installed so I'll not get the error

CLalib commented 3 years ago

Deleting the old version of TelsaPWControl did let me install the new version (sort of). I still got the cloneRepo error, but the install went through. Still looks like a missing library though. Here is the log. When I go back to "Add Nodeservers" it is not on the list, but it does show the correct version number in my slot 1.

When I try to do the manual install using SSH, it tells me no such file or directory.

Btw, if we can get this up and running, I am very interested in making a donation for your time. You are putting a lot of time into this and should get something out of it.

9/8/2021, 14:05:14 [polyglot] info: NSChild cloneRepo: Successfully cloned TeslaPWControl into NodeServer directory. 9/8/2021, 14:05:24 [polyglot] error: NSChild: TeslaPWControl cloneRepo: Non-zero exit code: 128 9/8/2021, 14:05:24 [polyglot] error: NSResponse: Success: false - cloneRepo: Non-zero exit code: 128 9/8/2021, 14:05:41 [polyglot] info: TeslaPWControl(1): Attempting to install TeslaPWControl NodeServer into ISY. 9/8/2021, 14:05:41 [polyglot] info: TeslaPWControl(1): Installed into ISY sucessfully. Profile uploaded, restart Admin console. 9/8/2021, 14:05:41 [polyglot] info: Registered new local NodeServer: TeslaPWControl(1) 9/8/2021, 14:05:41 [polyglot] info: Waiting 10 seconds before starting TeslaPWControl for the first time. 9/8/2021, 14:05:51 [polyglot] info: NS: Starting Local NodeServer TeslaPWControl profile number 1 :: Version 0.7.4 9/8/2021, 14:05:52 [polyglot] error: NSChild STDERR: TeslaPWControl: Traceback (most recent call last): File "./TeslaPWController.py", line 5, in import polyinterface ModuleNotFoundError: No module named 'polyinterface'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "./TeslaPWController.py", line 7, in import pgc_interface as polyinterface ModuleNotFoundError: No module named 'pgc_interface'

9/8/2021, 14:05:52 [polyglot] info: TeslaPWControl(1): NodeServer Disconnected. 9/8/2021, 14:08:09 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 14:08:09 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 14:13:09 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 14:13:09 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 14:15:11 [polyglot] info: MQTTS: Client Disconnected: 9/8/2021, 14:15:12 [polyglot] info: MQTTS: polyglot_frontend-ay4Pj authenticated successfully. 9/8/2021, 14:15:12 [polyglot] info: MQTTS: Client Connected: 9/8/2021, 14:15:12 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 9/8/2021, 14:18:09 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 14:18:09 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined

Panda88CO commented 3 years ago

What system are you installing on ? polisy or raspberryPi running polyglot v2? on polisy the location is: cd /var/polyglot/nodeservers on raspberryPi it is: cd ~/.polyglot/nodeservers If you are running polisy an you do a full power cycle to get it updated to the latest version

can you send me the complete log file - It is strange it is complaining about polyinterface missing - can you try: pip install polyinterface --user

CLalib commented 3 years ago

I am running this on a polisy. Doing the pip install seemed to fix the missing library, but there is still something not complete.

I am not the most sophisticated user. Sorry that I can't help more.

Here are logs for various activities.

After the install:

9/8/2021, 14:39:40 [polyglot] info: TeslaPWControl(1): Attempting to install TeslaPWControl NodeServer into ISY. 9/8/2021, 14:39:42 [polyglot] info: TeslaPWControl(1): Installed into ISY sucessfully. Profile uploaded, restart Admin console. 9/8/2021, 14:39:42 [polyglot] info: Registered new local NodeServer: TeslaPWControl(1) 9/8/2021, 14:39:42 [polyglot] info: Waiting 10 seconds before starting TeslaPWControl for the first time. 9/8/2021, 14:39:52 [polyglot] info: NS: Starting Local NodeServer TeslaPWControl profile number 1 :: Version 0.7.4 9/8/2021, 14:39:54 [polyglot] info: TeslaPWControl(1): NodeServer Disconnected. 9/8/2021, 14:41:26 [polyglot] info: TeslaPWControl(1): Processing command: start 9/8/2021, 14:41:26 [polyglot] info: NS: Starting Local NodeServer TeslaPWControl profile number 1 :: Version 0.7.4 9/8/2021, 14:41:29 [polyglot] info: TeslaPWControl(1): NodeServer Disconnected.

After power cycling my polisy:

9/8/2021, 14:43:55 [polyglot] info: Starting Polyglot.... 9/8/2021, 14:43:55 [polyglot] info: Settings: Polyglot Version 2.2.13 9/8/2021, 14:43:55 [polyglot] info: Settings: Retrieved config from database 9/8/2021, 14:43:55 [polyglot] info: Running in Polisy mode 9/8/2021, 14:43:55 [polyglot] info: Settings: Retrieved config overrides from .env and updated database 9/8/2021, 14:43:55 [polyglot] info: Aedes MQTT Broker Service: Started on port 1883 9/8/2021, 14:43:56 [polyglot] info: MQTT Client Service: Started 9/8/2021, 14:43:56 [polyglot] info: HTTPS Interface Service: Started - Address: 0.0.0.0 Port: 443 9/8/2021, 14:43:56 [polyglot] info: MQTTS: polyglot authenticated successfully. 9/8/2021, 14:43:56 [polyglot] info: MQTTS: Client Connected: 9/8/2021, 14:43:57 [polyglot] info: TeslaPWControl(1): - NodeServer found on ISY with the name TeslaPWControl. Checking for Nodes... 9/8/2021, 14:43:57 [polyglot] info: TeslaPWControl(1): Found 0 nodes, Performing ReSync with ISY 9/8/2021, 14:43:57 [polyglot] info: TeslaPWControl(1): Completed ReSync with ISY. 9/8/2021, 14:43:57 [polyglot] info: NS: Starting Local NodeServer TeslaPWControl profile number 1 :: Version 0.7.4 9/8/2021, 14:43:57 [polyglot] info: MQTTS: polyglot_frontend-FmDhM authenticated successfully. 9/8/2021, 14:43:57 [polyglot] info: MQTTS: Client Connected: 9/8/2021, 14:43:57 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 9/8/2021, 14:43:57 [polyglot] info: ISY: Got Version 5.3.4 9/8/2021, 14:43:57 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 14:43:57 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 14:43:59 [polyglot] info: TeslaPWControl(1): NodeServer Disconnected. 9/8/2021, 14:44:02 [polyglot] error: MQTTS: connectionError: null Invalid protocol 9/8/2021, 14:44:03 [polyglot] info: MQTTS: Client Connected: 9/8/2021, 14:44:07 [polyglot] info: MQTTS: Client Connected:

After running a stop/start command on the nodeserver:

9/8/2021, 14:46:19 [polyglot] info: TeslaPWControl(1): Processing command: stop 9/8/2021, 14:46:19 [polyglot] info: TeslaPWControl(1):: Not running. Ignoring stop command. 9/8/2021, 14:46:28 [polyglot] info: TeslaPWControl(1): Processing command: start 9/8/2021, 14:46:28 [polyglot] info: NS: Starting Local NodeServer TeslaPWControl profile number 1 :: Version 0.7.4 9/8/2021, 14:46:30 [polyglot] info: TeslaPWControl(1): NodeServer Disconnected. 9/8/2021, 14:48:56 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 14:48:56 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 14:53:56 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 14:53:56 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 14:56:03 [polyglot] error: MQTTS: keepaliveTimeout: polyglot_frontend-FmDhM 9/8/2021, 14:56:03 [polyglot] error: MQTTS: clientError: polyglot_frontend-FmDhM keep alive timeout 9/8/2021, 14:56:03 [polyglot] info: MQTTS: Client Disconnected: 9/8/2021, 14:56:05 [polyglot] info: MQTTS: polyglot_frontend-FmDhM authenticated successfully. 9/8/2021, 14:56:05 [polyglot] info: MQTTS: Client Connected: 9/8/2021, 14:56:05 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 9/8/2021, 14:58:56 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 14:58:56 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 15:03:56 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 15:03:56 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 15:04:03 [polyglot] error: MQTTS: keepaliveTimeout: polyglot_frontend-FmDhM 9/8/2021, 15:04:03 [polyglot] error: MQTTS: clientError: polyglot_frontend-FmDhM keep alive timeout 9/8/2021, 15:04:03 [polyglot] info: MQTTS: Client Disconnected: 9/8/2021, 15:04:05 [polyglot] info: MQTTS: polyglot_frontend-FmDhM authenticated successfully. 9/8/2021, 15:04:05 [polyglot] info: MQTTS: Client Connected: 9/8/2021, 15:04:05 [polyglot] info: MQTTP: Frontend Websockets interface Connected.

Panda88CO commented 3 years ago

can you provide the time aligned logs for polisy and node server Maybe you can also try to run pip install git+https://github.com/jrester/tesla_powerwall#egg=tesla_powerwall

CLalib commented 3 years ago

Ran pip install git+https://github.com/jrester/tesla_powerwall#egg=tesla_powerwall per your recommendation.

I did a brand new nodeserver install on a new slot just to start things completely fresh.

Here is the nodeserver log:

2021-09-08 15:33:30,564 MainThread polyinterface INFO polylogger:set_basic_config: set_basic_config: enable=True level=30 2021-09-08 15:33:31,600 MainThread polyinterface INFO polyinterface:init_interface: Received Config from STDIN. 2021-09-08 15:33:31,601 MainThread polyinterface INFO init:: UDI Polyglot v2 Interface 2.1.0 Starting... 2021-09-08 15:33:32,306 MainThread polyinterface ERROR polyinterface:write: Traceback (most recent call last): 2021-09-08 15:33:32,307 MainThread polyinterface ERROR polyinterface:write: File "./TeslaPWController.py", line 13, in 2021-09-08 15:33:32,308 MainThread polyinterface ERROR polyinterface:write: from TeslaInfo import tesla_info 2021-09-08 15:33:32,308 MainThread polyinterface ERROR polyinterface:write: File "/var/polyglot/nodeservers/TeslaPWControl/TeslaInfo.py", line 20, in 2021-09-08 15:33:32,309 MainThread polyinterface ERROR polyinterface:write: from TeslaCloudAPI import TeslaCloudAPI 2021-09-08 15:33:32,310 MainThread polyinterface ERROR polyinterface:write: File "/var/polyglot/nodeservers/TeslaPWControl/TeslaCloudAPI.py", line 11, in 2021-09-08 15:33:32,311 MainThread polyinterface ERROR polyinterface:write: from TPWauth import TPWauth 2021-09-08 15:33:32,311 MainThread polyinterface ERROR polyinterface:write: File "/var/polyglot/nodeservers/TeslaPWControl/TPWauth.py", line 11, in 2021-09-08 15:33:32,312 MainThread polyinterface ERROR polyinterface:write: import captcha 2021-09-08 15:33:32,312 MainThread polyinterface ERROR polyinterface:write: File "/var/polyglot/nodeservers/TeslaPWControl/captcha.py", line 4, in 2021-09-08 15:33:32,313 MainThread polyinterface ERROR polyinterface:write: from svglib.svglib import svg2rlg 2021-09-08 15:33:32,313 MainThread polyinterface ERROR polyinterface:write: ModuleNotFoundError 2021-09-08 15:33:32,314 MainThread polyinterface ERROR polyinterface:write: : 2021-09-08 15:33:32,314 MainThread polyinterface ERROR polyinterface:write: No module named 'svglib'

Here is the log from the polisy:

9/8/2021, 15:33:19 [polyglot] info: TeslaPWControl(5): Attempting to install TeslaPWControl NodeServer into ISY. 9/8/2021, 15:33:20 [polyglot] info: TeslaPWControl(5): Installed into ISY sucessfully. Profile uploaded, restart Admin console. 9/8/2021, 15:33:20 [polyglot] info: Registered new local NodeServer: TeslaPWControl(5) 9/8/2021, 15:33:20 [polyglot] info: Waiting 10 seconds before starting TeslaPWControl for the first time. 9/8/2021, 15:33:30 [polyglot] info: NS: Starting Local NodeServer TeslaPWControl profile number 5 :: Version 0.7.4 9/8/2021, 15:33:32 [polyglot] info: TeslaPWControl(5): NodeServer Disconnected. 9/8/2021, 15:33:57 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 15:33:57 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 15:38:57 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 15:38:57 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 15:43:57 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 15:43:57 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 15:46:03 [polyglot] error: MQTTS: keepaliveTimeout: polyglot_frontend-j91SD 9/8/2021, 15:46:03 [polyglot] error: MQTTS: clientError: polyglot_frontend-j91SD keep alive timeout 9/8/2021, 15:46:03 [polyglot] info: MQTTS: Client Disconnected: 9/8/2021, 15:46:05 [polyglot] info: MQTTS: polyglot_frontend-j91SD authenticated successfully. 9/8/2021, 15:46:05 [polyglot] info: MQTTS: Client Connected: 9/8/2021, 15:46:05 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 9/8/2021, 15:48:57 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 15:48:57 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 15:53:57 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 15:53:57 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 15:55:03 [polyglot] error: MQTTS: keepaliveTimeout: polyglot_frontend-j91SD 9/8/2021, 15:55:03 [polyglot] error: MQTTS: clientError: polyglot_frontend-j91SD keep alive timeout 9/8/2021, 15:55:03 [polyglot] info: MQTTS: Client Disconnected: 9/8/2021, 15:55:05 [polyglot] info: MQTTS: polyglot_frontend-j91SD authenticated successfully. 9/8/2021, 15:55:05 [polyglot] info: MQTTS: Client Connected: 9/8/2021, 15:55:05 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 9/8/2021, 15:58:57 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 15:58:57 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 16:03:57 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 16:03:57 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined 9/8/2021, 16:04:03 [polyglot] error: MQTTS: keepaliveTimeout: polyglot_frontend-j91SD 9/8/2021, 16:04:03 [polyglot] error: MQTTS: clientError: polyglot_frontend-j91SD keep alive timeout 9/8/2021, 16:04:03 [polyglot] info: MQTTS: Client Disconnected: 9/8/2021, 16:04:05 [polyglot] info: MQTTS: polyglot_frontend-j91SD authenticated successfully. 9/8/2021, 16:04:05 [polyglot] info: MQTTS: Client Connected: 9/8/2021, 16:04:05 [polyglot] info: MQTTP: Frontend Websockets interface Connected. 9/8/2021, 16:08:57 [polyglot] info: NS: Powerwall 2 NodeServer no longer found in the ISY. Removing from Polyglot 9/8/2021, 16:08:57 [polyglot] error: NS checkExistingNodeServers Error: ReferenceError: data is not defined

Panda88CO commented 3 years ago

what do you have in your config? did you select LOCAL only - you need to set the following Clipboard01

CLalib commented 3 years ago

None of those fields populated in config. There were no fields at all. I tried adding all of them manually using the exact key names in your example with valid values for each. Restarted the nodeserver. Didn't seem to make a difference. The log entries looks exactly the same.

My config screen now looks exactly like yours (but with my data).

2021-09-08 16:46:34,516 MainThread polyinterface INFO polylogger:set_basic_config: set_basic_config: enable=True level=30 2021-09-08 16:46:35,560 MainThread polyinterface INFO polyinterface:init_interface: Received Config from STDIN. 2021-09-08 16:46:35,561 MainThread polyinterface INFO init:: UDI Polyglot v2 Interface 2.1.0 Starting... 2021-09-08 16:46:36,142 MainThread polyinterface ERROR polyinterface:write: Traceback (most recent call last): 2021-09-08 16:46:36,143 MainThread polyinterface ERROR polyinterface:write: File "./TeslaPWController.py", line 13, in 2021-09-08 16:46:36,144 MainThread polyinterface ERROR polyinterface:write: from TeslaInfo import tesla_info 2021-09-08 16:46:36,144 MainThread polyinterface ERROR polyinterface:write: File "/var/polyglot/nodeservers/TeslaPWControl/TeslaInfo.py", line 20, in 2021-09-08 16:46:36,145 MainThread polyinterface ERROR polyinterface:write: from TeslaCloudAPI import TeslaCloudAPI 2021-09-08 16:46:36,146 MainThread polyinterface ERROR polyinterface:write: File "/var/polyglot/nodeservers/TeslaPWControl/TeslaCloudAPI.py", line 11, in 2021-09-08 16:46:36,147 MainThread polyinterface ERROR polyinterface:write: from TPWauth import TPWauth 2021-09-08 16:46:36,147 MainThread polyinterface ERROR polyinterface:write: File "/var/polyglot/nodeservers/TeslaPWControl/TPWauth.py", line 11, in 2021-09-08 16:46:36,148 MainThread polyinterface ERROR polyinterface:write: import captcha 2021-09-08 16:46:36,148 MainThread polyinterface ERROR polyinterface:write: File "/var/polyglot/nodeservers/TeslaPWControl/captcha.py", line 4, in 2021-09-08 16:46:36,149 MainThread polyinterface ERROR polyinterface:write: from svglib.svglib import svg2rlg 2021-09-08 16:46:36,150 MainThread polyinterface ERROR polyinterface:write: ModuleNotFoundError 2021-09-08 16:46:36,150 MainThread polyinterface ERROR polyinterface:write: : 2021-09-08 16:46:36,150 MainThread polyinterface ERROR polyinterface:write: No module named 'svglib'

Panda88CO commented 3 years ago

It seems it is related to the polyinterface - is your network interface configured? did you do a full upgrade of your polisy system ? https://wiki.universal-devices.com/index.php?title=Polisy:User_Guide#Update_and_Upgrade_All_the_Packages

This is what my start up looks like 2021-09-08 13:34:11,048 MainThread polyinterface INFO polylogger:set_basic_config: set_basic_config: enable=True level=30 2021-09-08 13:34:12,264 MainThread polyinterface INFO polyinterface:init_interface: Received Config from STDIN. 2021-09-08 13:34:12,265 MainThread polyinterface INFO init:: UDI Polyglot v2 Interface 2.1.0 Starting... 2021-09-08 13:34:13,994 MainThread polyinterface DEBUG polyinterface:get_network_interface: gws: {'default': {2: ('192.168.1.1', 'igb0')}, 2: [('192.168.1.1', 'igb0', True)]} 2021-09-08 13:34:13,995 MainThread polyinterface DEBUG polyinterface:get_network_interface: gw: default=('192.168.1.1', 'igb0') 2021-09-08 13:34:13,996 MainThread polyinterface DEBUG polyinterface:get_network_interface: ifad: igb0=[{'addr': '192.168.1.244', 'netmask': '255.255.255.0', 'broadcast': '192.168.1.255'}] 2021-09-08 13:34:13,996 MainThread polyinterface INFO polyinterface:init: Connect: Network Interface: {'addr': '192.168.1.244', 'netmask': '255.255.255.0', 'broadcast': '192.168.1.255'} 2021-09-08 13:34:13,998 Interface polyinterface INFO polyinterface:_startMqtt: Connecting to MQTT... localhost:1883 2021-09-08 13:34:14,004 MainThread polyinterface INFO TeslaPWController:init: init Tesla Power Wall Controller - 1

CLalib commented 3 years ago

I had already updated and upgraded all of my packages using SSH.

My network interface seems to be configured properly. The only thing that might be less usual is that I have a '7' in the third position of my IP address. Can't imagine that would matter. The interface screen will not let me populate the IPv4 gateway unless I uncheck DHCP. I've tried it both ways, did a full reboot and doesn't seem to matter. The gateway I used when I unchecked DHCP is 192.168.7.1.

(I've removed my mac address for privacy in the screenshot.)

You have spent enough time with me, but if you have any ideas I am certainly happy to test them.

Thanks again!

image

Panda88CO commented 3 years ago
My network interface is ATH0 – are you using wireless?I agree net mask should not matter Sent from Mail for Windows From: CLalibSent: Wednesday, September 8, 2021 6:26 PMTo: Panda88CO/udi-TeslaPowerWallCc: Panda88CO; MentionSubject: Re: [Panda88CO/udi-TeslaPowerWall] Local and cloud connection issues (#3) I had already updated and upgraded all of my packages using SSH.My network interface seems to be configured properly. The only thing that might be less usual is that I have a '7' in the third position of my IP address. Can't imagine that would matter. The interface screen will not let me populate the IPv4 gateway unless I uncheck DHCP. I've tried it both ways, did a full reboot and doesn't seem to matter. The gateway I used when I unchecked DHCP is 192.168.7.1.(I've removed my mac address for privacy in the screenshot.)You have spent enough time with me, but if you have any ideas I am certainly happy to test them.Thanks again!—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.  
CLalib commented 3 years ago

Not using wireless. The Ath0 screen is enabled and looks the same. I just pulled up Igb0 because I saw that in your log.

Panda88CO commented 3 years ago
I think I found a way to debug – I’ll try tomorrow – related to install script Sent from Mail for Windows From: CLalibSent: Wednesday, September 8, 2021 7:56 PMTo: Panda88CO/udi-TeslaPowerWallCc: Panda88CO; MentionSubject: Re: [Panda88CO/udi-TeslaPowerWall] Local and cloud connection issues (#3) Not using wireless. The Ath0 screen is enabled and looks the same. I just pulled up Igb0 because I saw that in your log.—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.  
Panda88CO commented 3 years ago

Give it a try now - I think I fixed the install script - at least it is stalls in my fairly clean polisy

CLalib commented 3 years ago

Your new update is working! Can't wait to play around with it a bit, but all the data was retrieved from the PW perfectly. Setup with the new version was clear and easy. Thank you!

Panda88CO commented 3 years ago

glad to hear it worked out - I'll let you know if I manage to get cloud connection working again - it has a lot more functionality. But they introduced recaptcha which is difficult to automate around

CLalib commented 3 years ago

If the nodeserver loses connection with the PW for whatever reason, will it automatically keep trying to log back in or will it have to be manually restarted? Don't know if you have a way of sending me a DM, but if you can get me Zelle/Paypal/Apple Pay contact info, I would like to send you something for your time and effort.

Panda88CO commented 3 years ago
There is a heart beat you can use to detect if node server crashes – in my experience it is more difficult to handle (as code cannot restart it self)  Code is supposed to try to reconnect when connection is lost – if  cable is unplugged it works (last time I tested it) – I have not dared to try to bring power wall down  Don’t worry about my effort – I do it for fun – if you want to give a little money – donate it to a good cause 😊  Sent from Mail for Windows From: CLalibSent: Thursday, September 9, 2021 5:12 PMTo: Panda88CO/udi-TeslaPowerWallCc: Panda88CO; MentionSubject: Re: [Panda88CO/udi-TeslaPowerWall] Local and cloud connection issues (#3) If the nodeserver loses connection with the PW for whatever reason, will it automatically keep trying to log back in or will it have to be manually restarted?Don't know if you have a way of sending me a DM, but if you can get me Zelle/Paypal/Apple Pay contact info, I would like to send you something for your time and effort.—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.  
Panda88CO commented 3 years ago

Just uploaded new build supporting CLOUD again - you will need a key for 2Captcha to solve the recaptcha Tesla has moved to use during login. Is it about 3$ for 1000 solves - only needed once per start

Polyglot cloud is still not 100% working - should be ok early next week - mostly getting build to work correctly

CLalib commented 3 years ago

Thanks @Panda88CO! Can’t wait to try CLOUD. LOCAL has been flawless in 0.7.5 so far. Any practical way to pass the timestamp of the last valid longpoll to the ISY? That would allow me to build an alert if the nodeserver ever loses connection with the PW for an extended period of time.

Panda88CO commented 3 years ago

Let me think about it - The easiest way may be to pass the number of long polls without data access - maybe in the main node - but it will revert logic to value vs True/False. Time is not handled easy in ISY - you would need to pass number of seconds - it is also a possibility - Would you want a number from local connection and one from cloud? I combine data from the two when both are on-line - cloud has some delay in data - not sure how much - probably not critical

There is a field connected to Tesla you could use and keep track on ISY side as well

CLalib commented 3 years ago

This is not critical at all. Here is the situation I am trying to resolve. A few times per day, my PW is unreachable by IP address usually for 5-15 minutes. Not sure why. It has done that since it was new. If I log directly into the PW (vs. using the WiFi network), it still says connected to WiFi and connected to Tesla. Same behavior on multiple routers. Always comes back by itself.

When I looked at the ISY during one of these outages, I think it still said node up and connected to Tesla-true, even though the nodeserver log showed PW unreachable. But you are correct that the code goes right back to polling as soon as the PW is reachable again. So having a alert might really not be necessary anyway.

I might be able to resolve my PW issue just by using an Ethernet connection. Haven’t tried.

Panda88CO commented 3 years ago

I'll take a look next week - they code on nod eup is very simple My PW is on ethernet and have never had that type of issue

oddirt commented 2 years ago

It's been a while but Tesla finally (almost) completed my installation. Long story short, the initial install only backed up half my house, so we went back to the drawing board. Two years later, it's all done.

Just installed the latest update of the node server, restarted the server, and everything is working! Had to run an ethernet line b/c the TEG Gateway's wifi keeps dropping--it's a known problem, from what I gathered from a quick search. @CLalib, you might want to give the ethernet line a try. I think the Wifi may have been why I wasn't able to connect before. I'm using the LOCAL mode, since Tesla's Cloud authentication is causing problems.

Now I have a Power Outage mode program that turns off unnecessary lights, etc and shuts off the programs that automate them when the Grid Status is "Islanded." Not sure what the "Islanded_Ready" mode is--nothing comes up in an online search. But I've left that out of the programming until I can play around with it--I'm guessing it might be when there's a storm coming and PW charges up in preparation.

Huge thanks, @Panda88CO! Your node server rocks. You should get it into the PG3 store so you can get paid for your efforts.