Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timed out waiting for response from TWCManager script #6

Open
chran28 opened this issue Apr 10, 2019 · 17 comments
Open

Timed out waiting for response from TWCManager script #6

chran28 opened this issue Apr 10, 2019 · 17 comments

Comments

@chran28
Copy link

chran28 commented Apr 10, 2019

Hello, I'm still a freshman in programming. Have the TWCManager installed according to the instructions. When I go to the website, I get the following error: "If the script is running, make sure the $ twcScriptDir parameter in the source of this web page points to the directory containing the TWCManager script.". I checked the parameter and am of the opinion that everything is correct. What can I do to solve the problem?

@flodorn
Copy link

flodorn commented Apr 10, 2019

do you see the script running when you type "screen -r" on the rpi?

@chran28
Copy link
Author

chran28 commented Apr 11, 2019 via email

@flodorn
Copy link

flodorn commented Apr 11, 2019

This means the script isn't running on the rpi and you have to set it up properly first. It is not an issue of changing the country code.
Try running the script manually by typing "python3 TWC/TWCManager.py". If this works, you probably didn't setup the autostart bit properly.

@chran28
Copy link
Author

chran28 commented Apr 11, 2019 via email

@flodorn
Copy link

flodorn commented Apr 11, 2019

It looks like your wall connecter is set to master, not slave. You should disconnect the power and check that the rotary switch and dip switch are set correctly, see installation manual: https://www.tesla.com/sites/default/files/pdfs/wall-connector-eu/20161208/tesla-32a-wall-connector-installation-manual-en-EU-v2.pdf?201612081439

@chran28
Copy link
Author

chran28 commented Apr 11, 2019 via email

@flodorn
Copy link

flodorn commented Apr 11, 2019

Could be an issue with the wall connector. I'd set debugLevel to 11 in TWCManager.py and try different rotary switch positions on the wall connector to see which messages you get. Don't forget to power off the wall connector before making changes on the rotary switch.

Tx@ is for messages you send to your wall connector
Rx@ is for messages you receive

You could also try to run TWCManager as slave to see if this works.

@chran28
Copy link
Author

chran28 commented Apr 11, 2019 via email

@chran28
Copy link
Author

chran28 commented Apr 11, 2019 via email

@flodorn
Copy link

flodorn commented Apr 11, 2019

I don't see a picture.

Your serial port gets the excact same repsonse as the message you send during linkready1, this is strange. It casues the TWCManager script to think that the wall connector is sending it and is a master, but it's just a repeated signal on the serial port, or even the same signal as the source. Could be an issue with the serial adapter or the wiring.

How did you connect the serial wires?

I'd also try resetting the wall connector by pressing the reset button for >10sec

@chran28
Copy link
Author

chran28 commented Apr 11, 2019 via email

@flodorn
Copy link

flodorn commented Apr 11, 2019

There is no image file attached to the email.

As mentioned before, I'd try different settings on the rotary switch, change the serial cable from IN to OUT on the wall connector and run TWCManager as slave.

As for the autostart, if you followed the instructions of CDragon regarding the rc.local file it should work. I personally also had to change chmod of the TWC folder to 777 to make autostart work.

If the script has an error it also won't start. But you ruled that out by running it direclty with the python3 command.

@neoof86
Copy link

neoof86 commented May 2, 2019

Good Evening,

I am having a similar issue, I have been setting this up as a POC until my PW arrive and was going to see if I could write an API to interact with my SolarEdge inverter for now but upon reboot the script just does not seem to run

Below is an example of the start up script, I have checked for any potential errors by copying from the PDF and ensuring this went in as plain text like below

Screenshot 2019-05-02 at 21 03 48

I also tried to modify the script to try and run the following su - pi -c "screen -dm -S TWCManager ~/TWC/TWCManager.py" and still no luck, I also tried to also see if it was a permissions issue by amending the folder using chmod 777 but again it still would not start

I have tried the command manually and get the following

Screenshot 2019-05-02 at 21 04 27

If I run the Python the script runs as expect

Screenshot 2019-05-02 at 21 23 27

Whilst this is running it works as expected, Is there a simple step I have missed?

Screenshot 2019-05-02 at 21 25 58

@flodorn
Copy link

flodorn commented May 2, 2019

@neoof86
The only difference I notice is that I added the startup bit su - pi -c "screen -dm -S TWCscript ~/TWC/TWCManager.py" in rc.local directly above the exit 0 line

@simotronic
Copy link

Did you manage to correct the serial data where the serial response appears to be an echo?
A couple of thoughts.
Maybe the RX and TX lines are crossed?
Or is the USB device set to echo. According to the literature from ftdichip.com:
RS485 systems often have local echo enabled. This means any data transmitted by a device is echoed back to itself.
The USB-RS485-WE cable allows for local echo to be enabled/disabled by changing a bit in the FT232R EEPROM. If CBUS4 in the EEPROM is set for “PWRON#” local echo is enabled. If CBUS4 in the EEPROM is set for “TXDEN” local echo is disabled. Users can set this with MPROG from www.ftdichip.com
The default for the local echo is disabled (CBUS4 set for “TXDEN)
Maybe this is the issue?

@juamiso
Copy link

juamiso commented Apr 23, 2020

I have set up the script as systemd service and is working properly (starting at boot). To do so, I did follow the guideline in Systemd (method4).

create the file TWCManager.service in /etc/systemd/system/
the content should be:

[Unit]
Description=Autostart TWCManager, logs to be found in journalctl -U TWCManager.system
 
[Service]
User=pi
Type=idle
ExecStart=/usr/bin/python3 /home/pi/TWC/TWCManager.py
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

then give the proper rights, enable, start and reboot:

sudo chmod 644 /lib/systemd/system/TWCManager.service
sudo systemctl daemon-reload
sudo systemctl enable TWCManager.service
sudo reboot

If you want to check the status of the process, just write

sudo systemctl status TWCManager.service
you can "stop" it "restart" it or many other stuff to debug things.

The logs are to be found using journalctl

Maybe worth a try ?

@simotronic
Copy link

simotronic commented Apr 24, 2020 via email

deece pushed a commit to InfernoEmbedded/TWCManager that referenced this issue Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants