Dave
(Dave)
9 August 2017 11:04
12
Hi Trystan
I get the following error when trying to update…
error: Your local changes to the following files would be overwritten by checkout:
src/emonhub.py
src/interfacers/EmonHubMqttInterfacer.py
src/interfacers/EmonModbusTcpInterfacer.py
Please, commit your changes or stash them before you can switch branches.
Aborting
How do you stash things in a pi?
Regards
Dave
What are the changes you have made? Happy to help with merging if it makes sense?
Dave
(Dave)
9 August 2017 11:50
14
Hi Trystan
TBH I dont have a clue what changes Ive made, I was running Stuarts script that reads SMA inverters over bluetooth but that stopped working after an update.
I’m happy to make a backup and force git to do an update but I dont know the git commands
Regards
Dave
can you copy the results here of:
git diff
Dave
(Dave)
9 August 2017 12:44
16
TrystanLea:
git diff
pi@emonpi(rw):emonhub$ git diff
diff --git a/src/emonhub.py b/src/emonhub.py
index aee21c0..acdbf40 100755
--- a/src/emonhub.py
+++ b/src/emonhub.py
@@ -138,6 +138,7 @@ class EmonHub(object):
if not I.isAlive():
#I.start()
self._log.warning(I.name + " thread is dead") # had to be r estarted")
+ self._exit = True
# Sleep until next iteration
time.sleep(0.2)
diff --git a/src/interfacers/EmonHubMqttInterfacer.py b/src/interfacers/EmonHubM qttInterfacer.py
index d25958c..4f458cd 100644
--- a/src/interfacers/EmonHubMqttInterfacer.py
+++ b/src/interfacers/EmonHubMqttInterfacer.py
@@ -123,8 +123,14 @@ class EmonHubMqttInterfacer(EmonHubInterfacer):
payload = str(value)
self._log.info("Publishing: "+topic+" "+payload)
+
:...skipping...
diff --git a/src/emonhub.py b/src/emonhub.py
index aee21c0..acdbf40 100755
--- a/src/emonhub.py
+++ b/src/emonhub.py
@@ -138,6 +138,7 @@ class EmonHub(object):
if not I.isAlive():
#I.start()
self._log.warning(I.name + " thread is dead") # had to be restarted")
+ self._exit = True
# Sleep until next iteration
time.sleep(0.2)
diff --git a/src/interfacers/EmonHubMqttInterfacer.py b/src/interfacers/EmonHubMqttInterfacer.py
index d25958c..4f458cd 100644
--- a/src/interfacers/EmonHubMqttInterfacer.py
+++ b/src/interfacers/EmonHubMqttInterfacer.py
@@ -123,8 +123,14 @@ class EmonHubMqttInterfacer(EmonHubInterfacer):
payload = str(value)
self._log.info("Publishing: "+topic+" "+payload)
+
result =self._mqttc.publish(topic, payload=payload, qos=2, retain=False)
+ try:
+ result =self._mqttc.publish(topic, payload=payload, qos=2, retain=False)
+ except Exception as e:
+ self._log.warning("Unable to publish: "+topic+" "+payload+" error: "+ str(e))
+
if result[0]==4:
self._log.info("Publishing error? returned 4")
diff --git a/src/interfacers/EmonModbusTcpInterfacer.py b/src/interfacers/EmonModbusTcpInterfacer.py
index 6afe843..27036b5 100644
--- a/src/interfacers/EmonModbusTcpInterfacer.py
+++ b/src/interfacers/EmonModbusTcpInterfacer.py
@@ -16,7 +16,7 @@ Monitors Solar Inverter using modbus tcp
Thanks @dave , the changes displayed are in relation to the proposed changes in the original thread here .
You can now discard these with
git checkout src/emonhub.py
git checkout src/interfacers/EmonHubMqttInterfacer.py
does it list any changes in: src/interfacers/EmonModbusTcpInterfacer.py? is what you copied in the full output?
If so you can also do:
git checkout src/interfacers/EmonModbusTcpInterfacer.py
Or all in one go with a single command:
git checkout .
Then you should be able to follow the steps above.
Thanks
stuart
(stuart)
9 August 2017 13:40
18
Dave this script should be working fine in the current code base - isn’t yours ?
stuart
(stuart)
9 August 2017 13:41
19
beaylott:
kill_list
So there are no duplicate names in the “kill_list” variable ?
Dave
(Dave)
9 August 2017 13:48
20
@stuart
No, I did an update once and I was never able to get it work again
I’ll have a go again following your guide.
@TrystanLea
I’ve changed the branch and have the Your branch is up-to-date with 'origin/emon-pi-develop'.
All seems to be working so far
Regards
Dave
Great @Dave , did you run sudo service emonhub restart at the end too?
beaylott
(Ben Aylott)
9 August 2017 13:55
22
Ah i see what you mean. i think this following condition will mean there isn’t (even if there are duplicates in the config file)…
# check init_settings against the file copy, if they are the same move on to the next
if self._interfacers[name].init_settings == settings['interfacers'][name]['init_settings']:
continue
# Delete interfacers if setting changed or name is unlisted or Type is missing
self._log.info("Deleting interfacer '%s' ", name)
self._interfacers[name].stop = True
del(self._interfacers[name])
for name, I in settings['interfacers'].iteritems():
# If interfacer does not exist, create it
if name not in self._interfacers:
try:
if not 'Type' in I:
continue
self._log.info("Creating " + I['Type'] + " '%s' ", name)
if I['Type'] in ('EmonModbusTcpInterfacer','EmonFroniusModbusTcpInterfacer') and not pymodbus_found :
self._log.error("Python module pymodbus not installed. unable to load modbus interfacer")
# This gets the class from the 'Type' string
interfacer = getattr(ehi, I['Type'])(name,**I['init_settings'])
interfacer.set(**I['runtimesettings'])
interfacer.init_settings = I['init_settings']
… there shouldn’t be any duplicates.
Dave
(Dave)
9 August 2017 13:55
23
yep, all working as it should be
Dave
(Dave)
9 August 2017 14:20
24
@stuart
I get the following error when running the script…
ERROR MainThread Unable to create 'SMASolar' interfacer: __i__() got an unexpected keyword argument 'readdcvalues'
Regards
Dave
stuart
(stuart)
9 August 2017 15:31
25
Hi @Dave
Take the “readdcvalues” parameter out of the emonHUB configuration file.
The only valid parameter values are:
inverteraddress
inverterpincode
timeinverval
nodeid
packettrace
Dave
(Dave)
9 August 2017 15:56
26
Thank You Stuart!
I don’t know how on earth “readdcvalues” got in the config fine.
It all working now
Have you thought any more on pulling data from multiable interters?
Regards
Dave
stuart
(stuart)
10 August 2017 15:44
27
Its really difficult to do this without having a 2nd inverter to test the code against
Dave
(Dave)
10 August 2017 16:09
28
Where in the country are you based? as I have a spare inverter lying around that I’m due to put on eBay.
Regards
Dave
stuart
(stuart)
11 August 2017 08:30
29
I’m in the Midlands, although strangely I’m looking to buy an inverter for some more panels I’m putting on my garage roof!!
Still working reliable for me on a couple of systems.
Robert.Wall
(Robert Wall)
Split this topic
14 August 2017 10:10
31
7 posts were split to a new topic: Sunny Boy inverters for sale