tagyoureit / nodejs-poolController

An application to control pool equipment from various manufacturers.
GNU Affero General Public License v3.0
323 stars 94 forks source link

Nixie “Schedules” start/end timer settings not responding as expected #367

Closed rock-crusher closed 2 years ago

rock-crusher commented 2 years ago

Issue: In the nixie scheduler when setting the on/off times the minutes are not changeable while in the 12:00pm hour. When you try, it automatically reverts back to 12:00pm. For instance, if you set the time as 12:37pm the system automatically resets the time back to12:00pm for some reason. All the other hours 1-11 am or pm you can set any minute you desire.
I’m sure it’s just something I’m doing wrong. Any Ideas?

Schedules

rstrouse commented 2 years ago

Alright this is so confounding. Something about the pi OS is not right and all the goofy recommendations on the web are brutally complicated. We may be better off re-imaging the OS and starting over.

I do not think there is anything wrong with your pump. While it is writing to the port I am not so sure that the message is actually making it to the pump. All of the gymnastics that we have been performing wrt the port permissions makes me think that the messages make it to the transmit buffer they end up blowing out into the ether.

How do you feel about re-imaging the SD card and starting over?

rock-crusher commented 2 years ago

I'm ok with what ever you recommend, but will need your help getting it done.

rstrouse commented 2 years ago

So I assume you bought a pi kit with a pre-loaded SD card. It should also have an adapter to put the SD card in with a USB port. Pull the SD card out of the pi and insert it into this adapter.

So are you a Mac or a Windows user?

rock-crusher commented 2 years ago

Windows

rstrouse commented 2 years ago

Ok so follow these instructions to get the image installed on the Raspberry Pi. Once you do that we need to hook the pi up to a mouse, keyboard, and monitor to install XRDP.

https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/2

EDIT: You want the following OS image

rstrouse commented 2 years ago

Once you get the pi back up and running with a keyboard, mouse, and monitor.

Run the following commands so you can get access to it from your pc. Set the basic settings for the pi and hook up a network connection to it. Then run the following commands.

sudo apt-get update sudo apt-get upgrade sudo apt-get install xrdp

After you do this you should be able to access your pi using Remote Desktop Connection (rdp). Open rdp and enter raspberrypi into the computer field and press connect. Answer yes to the prompts and the login screen for the pi should appear. You are now operating the pi headless so you can stop using the monitor, keyboard and mouse. image

Next you will want to perform the install of the software starting with the pre-requisites. https://github.com/tagyoureit/nodejs-poolController/wiki/DIY-Standalone-Nixie-Pool-Controller#install-software-prerequisites

When you get to the part where you are selecting the interfaces. Disable the Serial Console and enable the Serial Port.

Once you get to that point go ahead and configure the MEGA-BAS and your relay card and let me know when you finish that configuration.

rock-crusher commented 2 years ago

Ok, did all that, now just start everything all over again in DIY Standalone Nixie Pool Controller?

rock-crusher commented 2 years ago

sorry the page didn't refresh, disregard my above comment

rock-crusher commented 2 years ago

Once you get the pi back up and running with a keyboard, mouse, and monitor.

Run the following commands so you can get access to it from your pc. Set the basic settings for the pi and hook up a network connection to it. Then run the following commands.

sudo apt-get update sudo apt-get upgrade sudo apt-get install xrdp

After you do this you should be able to access your pi using Remote Desktop Connection (rdp). Open rdp and enter raspberrypi into the computer field and press connect. Answer yes to the prompts and the login screen for the pi should appear. You are now operating the pi headless so you can stop using the monitor, keyboard and mouse. image

Next you will want to perform the install of the software starting with the pre-requisites. https://github.com/tagyoureit/nodejs-poolController/wiki/DIY-Standalone-Nixie-Pool-Controller#install-software-prerequisites

When you get to the part where you are selecting the interfaces. Disable the Serial Console and enable the Serial Port.

Once you get to that point go ahead and configure the MEGA-BAS and your relay card and let me know when you finish that configuration.

Ok, I'll get started on this, thanks.

tagyoureit commented 2 years ago

I have the Mega-BAS card and have not yet enabled RS-485 pass thru. I tried it and ran into the same issue. Ironically, there seem to be thousands of similar issues out there but I figured out a quick and easy way to do this that I didn't see mentioned anywhere. Give this a try and let me know if this works for you.

  1. Run sudo raspi-config.
  2. Select 3 interface options
  3. Select P6 serial port
  4. Important one - Would you like a login shell to be accessible over serial? NO.

image

  1. Would you like the serial port hardware to be enabled? Yes.

image

Final settings should look like:

image

  1. Press OK/Finish/Reboot. Then try to load up the njsPC again.

When I answered yes to the login shell (easy to do!) that is where this problem is caused. I tried it about 3 times and was able to replicate the Unable to open port each time I answered yes to the login shell question.

rock-crusher commented 2 years ago

Hi tagyoureit, unfortunately I haven't been able to complete getting everything installed. I'm stuck once again, I can't seem to get PM2 installed and running. When I try and run the command: sudo npm install -g pm2 I get this: l

rstrouse commented 2 years ago

After installing node you must open a new console window or the path to num will not be found.

rock-crusher commented 2 years ago

After installing node you must open a new console window or the path to num will not be found.

Sorry, I don't understand

rock-crusher commented 2 years ago

I didn't have a problem installing pm2 last time around, now I'm having trouble and don"t understand. "open a new console window" ??

tagyoureit commented 2 years ago

He means close the terminal and re-open it. That will start a new shell session.

rock-crusher commented 2 years ago

Thank for that info tagyoureit. That is what I have been doing, or so I thought. I'll try again

rock-crusher commented 2 years ago

Same thing, not working.

rock-crusher commented 2 years ago

I give-up for now

tagyoureit commented 2 years ago

It looks like you don't have node/npm installed yet. These instructions will get you through it: https://linuxize.com/post/how-to-install-node-js-on-raspberry-pi/

On the following command in the article, replace the 10 with 12: eg curl -sL https://deb.nodesource.com/setup_10.x | sudo bash - should become curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -

rstrouse commented 2 years ago

I think you may have missed the nvm install 12.18.3 command. This installs node and npm using the node version manager.

rock-crusher commented 2 years ago

Hi guys, I'm giving this another try. I followed tagyoureit's suggestions above and it installed. So, got the pm2 done along with logrotate. Question 1, I didn't have to do this first time around, all I did before was copy past from DIY Standalone Nixie Pool Controller see attached image "b" below and it worked fine, so why this time different? Now, i'm having problem with REM. I got the Mega-Bas ok, but when trying to install the relay card the 3-0x03 unknown address is incorrect. It wont let me put in the correct address. When I click the + add device button and then click the add 12c address to put the correct address in, the window never opens, the program automatically chooses some generic one as shown in image "a" below which is wrong and will not work. Question 2, Why doesn't the window open so I can put in the correct address like it did before in the first time around? As per image "c" below, address 72 & 63 is what I want. It seems to get the 72 correct which I assigned for the Mega-Bas, but wrong for the other address (relay card) and I cant change it?

Anyway I'm stuck here and need help.

b

a

c

rstrouse commented 2 years ago

The detection method in REM is passive. It does this so that it does not interrupt communication with other devices. The 0x03 is not a correct address and it will disappear after REM restarts or the detection is re-run. So the address you need is 63 in decimal 0x3F is a hexadecimal address. So when the address screen pops up enter 63.

rstrouse commented 2 years ago

So to question 1. The reason this worked differently this time is because I believe you missed one of the commands to install nodejs using the nvm (Node Version Manager). That is the command nvm install 12.18.3. There are a several of methods to get node and npm (Node Process Manager). The command that @tagyoureit had you run simply installs it from another packaged source.

If you look at this link you will see both methods of install. https://linuxize.com/post/how-to-install-node-js-on-raspberry-pi/

rock-crusher commented 2 years ago

I cant get the address screen to open. I've rebooted etc. Can you help me get it open?

rstrouse commented 2 years ago

Hmmm... just to be sure you are clicking on the + symbol on the I2c Bus #1 tab. image

If so what browser are you using?

rock-crusher commented 2 years ago

yes

rstrouse commented 2 years ago

Which browser? Chrome, Edge, or something else?

rock-crusher commented 2 years ago

chrome

rstrouse commented 2 years ago

Ok so I open run pm2 monit and watch the console when you click on the plus symbol. It is very odd that your addresses in i2cdetect start at 8 not 3.

rstrouse commented 2 years ago

Shoot me a screenshot of your interfaces tab on the Raspberry Pi Configuration. It should have only I2C and Serial Port enabled. All others should be set to Disable.

rock-crusher commented 2 years ago

I will disable SPI e

rock-crusher commented 2 years ago

This is screenshot

Ok so I open run pm2 monit and watch the console when you click on the plus symbol. It is very odd that your addresses in i2cdetect start at 8 not 3.

This is before disabling SPI

d

rstrouse commented 2 years ago

That tells me that the I2c bus is not communicating. If you stretch that screen to the right you will get more info. What hardware is installed on your pi?

rock-crusher commented 2 years ago

just the building automation card & relay card if that is what you mean.

rstrouse commented 2 years ago

Run the following commands pm2 stop REM cd ~/relayEquipmentManager npm start

This way we can watch the console when you run.

rock-crusher commented 2 years ago

now what?

rstrouse commented 2 years ago

What is the complete error for the BAS trying to communicate?

rstrouse commented 2 years ago

Also when you ran npm start did any error messages appear in the console?

rock-crusher commented 2 years ago

Run the following commands pm2 stop REM cd ~/relayEquipmentManager npm start

This way we can watch the console when you run.

g

rock-crusher commented 2 years ago

Hope this is what you were asking for?

rstrouse commented 2 years ago

Ok so it looks like you have more than one REM server loaded. Did you run pm2 stop REM?

rock-crusher commented 2 years ago

yes

rock-crusher commented 2 years ago

do it again?

rstrouse commented 2 years ago

Yes this time it should show that REM is stopped. Do you have it running in any other window?

rock-crusher commented 2 years ago

No, I'll do it again.

rock-crusher commented 2 years ago

Wait, I do have it open now, but in one window is that ok?

rstrouse commented 2 years ago

If you mean on the pi then no that is not ok. When we run npm start we are starting another copy and there can only be 1.

rock-crusher commented 2 years ago

Here is my screen, is this ok? h

rstrouse commented 2 years ago

I am talking about terminal windows. The web page is ok as this is not a REM server. Only the program launched by npm start or a pm2 process is a server. You didn't also set up systemd from the same Wiki page did you?

rstrouse commented 2 years ago

The reason why I am saying that REM is still running is because of this message on the npm start. That indicates that the server is already running on the designated port when we are trying to start it. image