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

Fix of uninstall.sh script and typos #198

Merged
merged 5 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions dbus_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,14 @@ def check_opendtu_data(self, meter_data):
raise ValueError("You do not have the latest OpenDTU Version to run this script,"
"please upgrade your OpenDTU to at least version 4.4.3")

def fetch_opendtu_inverter_data(self, inverter_serial):
'''Fetch inverter date from OpenDTU device for one interter'''
def fetch_opendtu_iv_data(self, inverter_serial):
'''Fetch inverter data from OpenDTU device for one inverter'''
iv_url = self._get_status_url() + "?inv=" + inverter_serial
logging.debug(f"Inverter URL: {iv_url}")
return self.fetch_url(iv_url)

def fetch_ahoy_iv_data(self, inverter_number):
'''Fetch inverter date from Ahoy device for one interter'''
'''Fetch inverter data from Ahoy device for one inverter'''
iv_url = self.get_ahoy_base_url() + "/inverter/id/" + str(inverter_number)
logging.debug(f"Inverter URL: {iv_url}")
return self.fetch_url(iv_url)
Expand Down Expand Up @@ -606,7 +607,7 @@ def get_values_for_inverter(self):
else:
inverter_serial = meter_data["inverters"][self.pvinverternumber]["serial"]
logging.info(f"Inverter #{self.pvinverternumber} Serial: {inverter_serial}")
root_meter_data = self.fetch_opendtu_inverter_data(inverter_serial)["inverters"][0]
root_meter_data = self.fetch_opendtu_iv_data(inverter_serial)["inverters"][0]
logging.debug(f"{root_meter_data}")
firmware_v24_2_12_or_newer = False

Expand Down
3 changes: 3 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ ln -s $SCRIPT_DIR/service /service/$SERVICE_NAME

# add install-script to rc.local to be ready for firmware update
filename=/data/rc.local

#check if rc.local already exists, if not create it
if [ ! -f $filename ]
then
touch $filename
Expand All @@ -41,4 +43,5 @@ then
echo >> $filename
fi

#check if the service exists? if not add it to rc.local
grep -qxF "$SCRIPT_DIR/install.sh" $filename || echo "$SCRIPT_DIR/install.sh" >> $filename
8 changes: 6 additions & 2 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SERVICE_NAME=$(basename $SCRIPT_DIR)
filename=/data/rc.local
RC_LOCAL_FILE=/data/rc.local

#remove the service
rm /service/$SERVICE_NAME

# end the dbus-opendtu process
kill $(pgrep -f 'supervise dbus-opendtu')
kill $(pgrep -f "python $SCRIPT_DIR/dbus-opendtu.py")

# delete old logs if they exist
if [ -f $SCRIPT_DIR/current.log ]; then
rm $SCRIPT_DIR/current.log*
fi

# remove install.sh from rc.local
STARTUP=$SCRIPT_DIR/install.sh
sed -i "\~$STARTUP~d" $RC_LOCAL_FILE
Loading