byte4geek / SEPLOS_MQTT

Read data From Seplos BMS and send them to the Home Assistant
GNU General Public License v3.0
39 stars 13 forks source link

Receive MQTT Message #16

Closed PhotonHebs closed 5 months ago

PhotonHebs commented 11 months ago

Thank you for writing this byte4geek! It will be unbelievably useful... amazeballs!

I have got to the stage where I test the communication ~/SEPLOS_MQTT/query_seplos_ha.sh 4201 and all is well - all of the measurements are displayed in my terminal window.

However, I have been unable to receive the MQTT message. I have triple checked my broker details and they are correct. I am running mosquito on another raspberry pi and it definitely works well because it is throwing around hundreds of messages between various pis running node red.

I run ~/SEPLOS_MQTT/run_bms_query.sh & nohup ~/SEPLOS_MQTT/run_bms_query.sh & but nothing happens. I ran sudo ~/SEPLOS_MQTT/run_bms_query.sh and it displays the following on the terminal:

grep: /root/SEPLOS_MQTT/config.ini: No such file or directory
grep: /root/SEPLOS_MQTT/config.ini: No such file or directory
grep: /root/SEPLOS_MQTT/config.ini: No such file or directory
grep: /root/SEPLOS_MQTT/config.ini: No such file or directory
grep: /root/SEPLOS_MQTT/config.ini: No such file or directory
grep: /root/SEPLOS_MQTT/config.ini: No such file or directory
grep: /root/SEPLOS_MQTT/config.ini: No such file or directory
grep: /root/SEPLOS_MQTT/config.ini: No such file or directory
grep: /root/SEPLOS_MQTT/config.ini: No such file or directory
/home/pi/SEPLOS_MQTT/run_bms_query.sh: line 34: cd: /root/SEPLOS_MQTT/: No such file or directory
touch: cannot touch '/root/SEPLOS_MQTT/BMS_error.log': No such file or directory
touch: cannot touch '/root/SEPLOS_MQTT/nohup.out': No such file or directory
/home/pi/SEPLOS_MQTT/run_bms_query.sh: line 43: /root/SEPLOS_MQTT/BMS_error.log: No such file or directory
ls: cannot access '/root/SEPLOS_MQTT/BMS_error.log': No such file or directory
mv: cannot stat '/root/SEPLOS_MQTT/BMS_error.log': No such file or directory
ls: cannot access '/root/SEPLOS_MQTT/nohup.out': No such file or directory
cp: cannot stat '/root/SEPLOS_MQTT/nohup.out': No such file or directory
/home/pi/SEPLOS_MQTT/run_bms_query.sh: line 55: /root/SEPLOS_MQTT/nohup.out: No such file or directory
/home/pi/SEPLOS_MQTT/run_bms_query.sh: line 58: /root/SEPLOS_MQTT/query_seplos_ha.sh: No such file or directory
(standard_in) 2: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
/home/pi/SEPLOS_MQTT/run_bms_query.sh: line 110: /root/SEPLOS_MQTT/BMS_error.log: No such file or directory
sleep: missing operand
Try 'sleep --help' for more information.

Is this a permissions thing? I note the response above mentions /root/SEPLOS_MQTT/... is that correct?

Any help would be very much appreciated, thank you.

Regards Keith

PhotonHebs commented 11 months ago

Update, I received one message randomly so I know that I have the topic right, however, the cron or manual triggers don't seem to result in another message being sent.

byte4geek commented 11 months ago

what is the path where did you install the script? what is the user you used?

for example if you install under /home/pi with user pi do not run it wiht sudo, because sudo run it as root env and try to use /root folder, if you installed the script using sudo it is possible you have right permission of the file wrong that user pi can't access.

StevenHodl commented 9 months ago

Hi @byte4geek , I had the same issue and your proposed solution worked for me. Simply git cloned without using sudo and now it works. Thanks!