From fd35760499c50d7792d9a816deabbb13b57d1424 Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 11:57:03 +0100
Subject: [PATCH 01/17] Update enclosure_settings.jinja2
added novus1040 to sensor type
---
octoprint_enclosure/templates/enclosure_settings.jinja2 | 1 +
1 file changed, 1 insertion(+)
diff --git a/octoprint_enclosure/templates/enclosure_settings.jinja2 b/octoprint_enclosure/templates/enclosure_settings.jinja2
index 473ebb0..8a1c45a 100644
--- a/octoprint_enclosure/templates/enclosure_settings.jinja2
+++ b/octoprint_enclosure/templates/enclosure_settings.jinja2
@@ -617,6 +617,7 @@
+
From 8d757f461349cd8b1f2ffb21556415b9df08e92c Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 12:33:22 +0100
Subject: [PATCH 02/17] Update enclosure_settings.jinja2
removed sensor pin from options
---
octoprint_enclosure/templates/enclosure_settings.jinja2 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/octoprint_enclosure/templates/enclosure_settings.jinja2 b/octoprint_enclosure/templates/enclosure_settings.jinja2
index 8a1c45a..e93a4f2 100644
--- a/octoprint_enclosure/templates/enclosure_settings.jinja2
+++ b/octoprint_enclosure/templates/enclosure_settings.jinja2
@@ -733,7 +733,7 @@
-
+
From 0f9c331d1b11bda363e432816f4113206adc9809 Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 13:00:03 +0100
Subject: [PATCH 03/17] Create novus1040.py
---
octoprint_enclosure/novus1040.py | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 octoprint_enclosure/novus1040.py
diff --git a/octoprint_enclosure/novus1040.py b/octoprint_enclosure/novus1040.py
new file mode 100644
index 0000000..03b7791
--- /dev/null
+++ b/octoprint_enclosure/novus1040.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+import minimalmodbus
+import ctypes
+import struct
+import sys
+
+## setup ##
+ # port name, slave address (in decimal)
+novus = minimalmodbus.Instrument('/dev/ttyACM0', 1)
+
+# for Novus 1040 comms documentation see:
+# https://www.novusautomation.com/downloads/Arquivos/communication_protocol_n1040_v20x_c_en.pdf
+novus.serial.baudrate = 115200
+REG_ADDR = {
+ 'Active SP': 0,
+ 'PV': 1,
+ 'dppo': 73
+}
+
+## Read decimal point precision setting ##
+DP = 3 - novus.read_register(REG_ADDR['dppo'], 0)
+#print(f'decimal places: {DP}')
+## set up complete ##
+
+class NovusTemp:
+ def getTemp(self):
+ temperature = novus.read_register(REG_ADDR['PV'], DP)
+ return '{0:0.1f}'.format(temperature)
From 839c0edb3ae0ee3905b2cc52d805f806786da23b Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 13:06:58 +0100
Subject: [PATCH 04/17] Update __init__.py
---
octoprint_enclosure/__init__.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py
index 72d8376..075ae2d 100644
--- a/octoprint_enclosure/__init__.py
+++ b/octoprint_enclosure/__init__.py
@@ -23,6 +23,7 @@ import json
import copy
from smbus2 import SMBus
from .getPiTemp import PiTemp
+from .novus1040 import NovusTemp
import struct
@@ -1290,6 +1291,19 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
"Failed to get pi cpu temperature")
self.log_error(ex)
return 0
+
+ def read_novus_temp(self):
+ try:
+ novustemp = NovusTemp()
+ temp = novustemp.getTemp()
+ if self._settings.get(["debug_temperature_log"]) is True:
+ self._logger.debug("Novus PV: %s", temp)
+ return temp
+ except Exception as ex:
+ self._logger.info(
+ "Failed to get Novus temperature")
+ self.log_error(ex)
+ return 0
def read_si7021_temp(self, address, i2cbus):
try:
From eaa8ec78b855dff384e81e44e34ef5fb42fc2bb2 Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 13:09:18 +0100
Subject: [PATCH 05/17] Update __init__.py
---
octoprint_enclosure/__init__.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py
index 075ae2d..b33774c 100644
--- a/octoprint_enclosure/__init__.py
+++ b/octoprint_enclosure/__init__.py
@@ -1025,6 +1025,10 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
temp = self.read_rpi_temp() # rpi CPU Temp
hum = 0
airquality = 0
+ elif sensor['temp_sensor_type'] == "novus1040":
+ temp = self.read_novus_temp() # novus Temp
+ hum = 0
+ airquality = 0
elif sensor['temp_sensor_type'] == "si7021":
temp, hum = self.read_si7021_temp(sensor['temp_sensor_address'], sensor['temp_sensor_i2cbus'])
airquality = 0
From a83dcfef254a940f3a48c8c5ce6be852c70d27bc Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 13:39:06 +0100
Subject: [PATCH 06/17] Update __init__.py
deactivated read for testing
---
octoprint_enclosure/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py
index b33774c..8aa3a2d 100644
--- a/octoprint_enclosure/__init__.py
+++ b/octoprint_enclosure/__init__.py
@@ -1026,7 +1026,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
hum = 0
airquality = 0
elif sensor['temp_sensor_type'] == "novus1040":
- temp = self.read_novus_temp() # novus Temp
+ temp = 69 # self.read_novus_temp() # novus Temp
hum = 0
airquality = 0
elif sensor['temp_sensor_type'] == "si7021":
From fe939b26e9bb29c15db98d6107a62bfea2bde56f Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 13:52:22 +0100
Subject: [PATCH 07/17] Update __init__.py
commented out NovusTemp import
---
octoprint_enclosure/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py
index 8aa3a2d..825dc4a 100644
--- a/octoprint_enclosure/__init__.py
+++ b/octoprint_enclosure/__init__.py
@@ -23,7 +23,7 @@ import json
import copy
from smbus2 import SMBus
from .getPiTemp import PiTemp
-from .novus1040 import NovusTemp
+#from .novus1040 import NovusTemp
import struct
From e01bb023e243a0d37d7a0eb5ea288be7fb0e5b78 Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 13:54:47 +0100
Subject: [PATCH 08/17] Update __init__.py
read_novus_temp(self): commented out
---
octoprint_enclosure/__init__.py | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py
index 825dc4a..095221d 100644
--- a/octoprint_enclosure/__init__.py
+++ b/octoprint_enclosure/__init__.py
@@ -23,7 +23,7 @@ import json
import copy
from smbus2 import SMBus
from .getPiTemp import PiTemp
-#from .novus1040 import NovusTemp
+from .novus1040 import NovusTemp
import struct
@@ -1026,7 +1026,7 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
hum = 0
airquality = 0
elif sensor['temp_sensor_type'] == "novus1040":
- temp = 69 # self.read_novus_temp() # novus Temp
+ temp = self.read_novus_temp() # novus Temp
hum = 0
airquality = 0
elif sensor['temp_sensor_type'] == "si7021":
@@ -1297,17 +1297,18 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
return 0
def read_novus_temp(self):
- try:
- novustemp = NovusTemp()
- temp = novustemp.getTemp()
- if self._settings.get(["debug_temperature_log"]) is True:
- self._logger.debug("Novus PV: %s", temp)
- return temp
- except Exception as ex:
- self._logger.info(
- "Failed to get Novus temperature")
- self.log_error(ex)
- return 0
+ return 69
+ #try:
+ # novustemp = NovusTemp()
+ # temp = novustemp.getTemp()
+ # if self._settings.get(["debug_temperature_log"]) is True:
+ # self._logger.debug("Novus PV: %s", temp)
+ # return temp
+ #except Exception as ex:
+ # self._logger.info(
+ # "Failed to get Novus temperature")
+ # self.log_error(ex)
+ # return 0
def read_si7021_temp(self, address, i2cbus):
try:
From 11cf21e77e97618d62ca87da16d2a2432b7a3275 Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 14:00:36 +0100
Subject: [PATCH 09/17] Update __init__.py
---
octoprint_enclosure/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py
index 095221d..c4d4648 100644
--- a/octoprint_enclosure/__init__.py
+++ b/octoprint_enclosure/__init__.py
@@ -23,7 +23,7 @@ import json
import copy
from smbus2 import SMBus
from .getPiTemp import PiTemp
-from .novus1040 import NovusTemp
+#from .novus1040 import NovusTemp
import struct
From c70d4cd3083552b914213635ff92362037020645 Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 16:06:30 +0100
Subject: [PATCH 10/17] Update novus1040.py
---
octoprint_enclosure/novus1040.py | 5 -----
1 file changed, 5 deletions(-)
diff --git a/octoprint_enclosure/novus1040.py b/octoprint_enclosure/novus1040.py
index 03b7791..5820bb5 100644
--- a/octoprint_enclosure/novus1040.py
+++ b/octoprint_enclosure/novus1040.py
@@ -1,13 +1,9 @@
#!/usr/bin/env python3
import minimalmodbus
-import ctypes
-import struct
-import sys
## setup ##
# port name, slave address (in decimal)
novus = minimalmodbus.Instrument('/dev/ttyACM0', 1)
-
# for Novus 1040 comms documentation see:
# https://www.novusautomation.com/downloads/Arquivos/communication_protocol_n1040_v20x_c_en.pdf
novus.serial.baudrate = 115200
@@ -16,7 +12,6 @@ REG_ADDR = {
'PV': 1,
'dppo': 73
}
-
## Read decimal point precision setting ##
DP = 3 - novus.read_register(REG_ADDR['dppo'], 0)
#print(f'decimal places: {DP}')
From 1b9d04056451af4b24ecdbc698857b5f133d1ef0 Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 16:10:40 +0100
Subject: [PATCH 11/17] Update README.md
---
README.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/README.md b/README.md
index 20cc0a0..a6354b1 100644
--- a/README.md
+++ b/README.md
@@ -130,6 +130,12 @@ Find the address of the sensor:
```
i2cdetect -y 1
```
+#### NOVUS 1040 Contorller sensor
+
+Connect via USB. expected COM port is named '/dev/ttyACM0'
+
+install the minimalmodbus library:
+~/oprint/bin/pip install minimalmodbus
### Neopixel
From b629f5671adb29c13ed5a80dd437b0eb25388b1a Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 16:11:17 +0100
Subject: [PATCH 12/17] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a6354b1..1ae6b44 100644
--- a/README.md
+++ b/README.md
@@ -130,7 +130,7 @@ Find the address of the sensor:
```
i2cdetect -y 1
```
-#### NOVUS 1040 Contorller sensor
+#### NOVUS 1040 Controller sensor
Connect via USB. expected COM port is named '/dev/ttyACM0'
From ad16555454d412c949d5cd3047752292fcb3df30 Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Mon, 2 May 2022 16:14:31 +0100
Subject: [PATCH 13/17] Update __init__.py
---
octoprint_enclosure/__init__.py | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py
index c4d4648..b33774c 100644
--- a/octoprint_enclosure/__init__.py
+++ b/octoprint_enclosure/__init__.py
@@ -23,7 +23,7 @@ import json
import copy
from smbus2 import SMBus
from .getPiTemp import PiTemp
-#from .novus1040 import NovusTemp
+from .novus1040 import NovusTemp
import struct
@@ -1297,18 +1297,17 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
return 0
def read_novus_temp(self):
- return 69
- #try:
- # novustemp = NovusTemp()
- # temp = novustemp.getTemp()
- # if self._settings.get(["debug_temperature_log"]) is True:
- # self._logger.debug("Novus PV: %s", temp)
- # return temp
- #except Exception as ex:
- # self._logger.info(
- # "Failed to get Novus temperature")
- # self.log_error(ex)
- # return 0
+ try:
+ novustemp = NovusTemp()
+ temp = novustemp.getTemp()
+ if self._settings.get(["debug_temperature_log"]) is True:
+ self._logger.debug("Novus PV: %s", temp)
+ return temp
+ except Exception as ex:
+ self._logger.info(
+ "Failed to get Novus temperature")
+ self.log_error(ex)
+ return 0
def read_si7021_temp(self, address, i2cbus):
try:
From bca83a2b9d27f81ed4b513e12c6135dc5db15eab Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Wed, 2 Aug 2023 22:30:20 +0100
Subject: [PATCH 14/17] Create novus1050.py
Update novus1050.py
---
octoprint_enclosure/novus1050.py | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 octoprint_enclosure/novus1050.py
diff --git a/octoprint_enclosure/novus1050.py b/octoprint_enclosure/novus1050.py
new file mode 100644
index 0000000..b479199
--- /dev/null
+++ b/octoprint_enclosure/novus1050.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+import minimalmodbus
+
+## setup ##
+ # port name, slave address (in decimal)
+novus = minimalmodbus.Instrument('/dev/ttyUSB0', 1)
+# for Novus 1050 comms documentation see:
+# https://cdn.novusautomation.com/downloads/registers_table_n1050_v11x_a_en.pdf
+# rs485 to USB adaptor: USB to RS485 TTL Serial Converter Adapter FTDI interface FT232RL 75176 Module
+novus.serial.baudrate = 115200
+REG_ADDR = {
+ 'Active SP': 0,
+ 'PV': 1,
+ 'dppo': 73
+}
+## Read decimal point precision setting ##
+DP = 3 - novus.read_register(REG_ADDR['dppo'], 0)
+#print(f'decimal places: {DP}')
+## set up complete ##
+
+class Novus1050Temp:
+ def getTemp(self):
+ temperature = novus.read_register(REG_ADDR['PV'], DP)
+ return '{0:0.1f}'.format(temperature)
From 2368e47b7ae3ec50d40e936d64ac6a0045ef1d91 Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Wed, 2 Aug 2023 22:34:46 +0100
Subject: [PATCH 15/17] Update __init__.py
Update __init__.py
Update __init__.py
---
octoprint_enclosure/__init__.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py
index b33774c..6ab87c3 100644
--- a/octoprint_enclosure/__init__.py
+++ b/octoprint_enclosure/__init__.py
@@ -24,6 +24,7 @@ import copy
from smbus2 import SMBus
from .getPiTemp import PiTemp
from .novus1040 import NovusTemp
+from .novus1050 import Novus1050Temp
import struct
@@ -1029,6 +1030,10 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
temp = self.read_novus_temp() # novus Temp
hum = 0
airquality = 0
+ elif sensor['temp_sensor_type'] == "novus1050":
+ temp = self.read_novus1050_temp() # novus Temp
+ hum = 0
+ airquality = 0
elif sensor['temp_sensor_type'] == "si7021":
temp, hum = self.read_si7021_temp(sensor['temp_sensor_address'], sensor['temp_sensor_i2cbus'])
airquality = 0
@@ -1309,6 +1314,19 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
self.log_error(ex)
return 0
+ def read_novus1050_temp(self):
+ try:
+ novus1050temp = Novus1050Temp()
+ temp = novus1050temp.getTemp()
+ if self._settings.get(["debug_temperature_log"]) is True:
+ self._logger.debug("Novus PV: %s", temp)
+ return temp
+ except Exception as ex:
+ self._logger.info(
+ "Failed to get Novus temperature")
+ self.log_error(ex)
+ return 0
+
def read_si7021_temp(self, address, i2cbus):
try:
script = os.path.dirname(os.path.realpath(__file__)) + "/SI7021.py "
From b0cf34a362f281f4c221ec472ba3e330b62d37d9 Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Wed, 2 Aug 2023 23:28:16 +0100
Subject: [PATCH 16/17] Revert "Create novus1050.py"
This reverts commit bca83a2b9d27f81ed4b513e12c6135dc5db15eab.
---
octoprint_enclosure/novus1050.py | 24 ------------------------
1 file changed, 24 deletions(-)
delete mode 100644 octoprint_enclosure/novus1050.py
diff --git a/octoprint_enclosure/novus1050.py b/octoprint_enclosure/novus1050.py
deleted file mode 100644
index b479199..0000000
--- a/octoprint_enclosure/novus1050.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python3
-import minimalmodbus
-
-## setup ##
- # port name, slave address (in decimal)
-novus = minimalmodbus.Instrument('/dev/ttyUSB0', 1)
-# for Novus 1050 comms documentation see:
-# https://cdn.novusautomation.com/downloads/registers_table_n1050_v11x_a_en.pdf
-# rs485 to USB adaptor: USB to RS485 TTL Serial Converter Adapter FTDI interface FT232RL 75176 Module
-novus.serial.baudrate = 115200
-REG_ADDR = {
- 'Active SP': 0,
- 'PV': 1,
- 'dppo': 73
-}
-## Read decimal point precision setting ##
-DP = 3 - novus.read_register(REG_ADDR['dppo'], 0)
-#print(f'decimal places: {DP}')
-## set up complete ##
-
-class Novus1050Temp:
- def getTemp(self):
- temperature = novus.read_register(REG_ADDR['PV'], DP)
- return '{0:0.1f}'.format(temperature)
From 08720e7a134f87c6cee89e2289040fd214f88dda Mon Sep 17 00:00:00 2001
From: PeterGribbin <104760870+PeterGribbin@users.noreply.github.com>
Date: Wed, 2 Aug 2023 23:28:22 +0100
Subject: [PATCH 17/17] Revert "Update __init__.py"
This reverts commit 2368e47b7ae3ec50d40e936d64ac6a0045ef1d91.
---
octoprint_enclosure/__init__.py | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/octoprint_enclosure/__init__.py b/octoprint_enclosure/__init__.py
index 6ab87c3..b33774c 100644
--- a/octoprint_enclosure/__init__.py
+++ b/octoprint_enclosure/__init__.py
@@ -24,7 +24,6 @@ import copy
from smbus2 import SMBus
from .getPiTemp import PiTemp
from .novus1040 import NovusTemp
-from .novus1050 import Novus1050Temp
import struct
@@ -1030,10 +1029,6 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
temp = self.read_novus_temp() # novus Temp
hum = 0
airquality = 0
- elif sensor['temp_sensor_type'] == "novus1050":
- temp = self.read_novus1050_temp() # novus Temp
- hum = 0
- airquality = 0
elif sensor['temp_sensor_type'] == "si7021":
temp, hum = self.read_si7021_temp(sensor['temp_sensor_address'], sensor['temp_sensor_i2cbus'])
airquality = 0
@@ -1314,19 +1309,6 @@ class EnclosurePlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplateP
self.log_error(ex)
return 0
- def read_novus1050_temp(self):
- try:
- novus1050temp = Novus1050Temp()
- temp = novus1050temp.getTemp()
- if self._settings.get(["debug_temperature_log"]) is True:
- self._logger.debug("Novus PV: %s", temp)
- return temp
- except Exception as ex:
- self._logger.info(
- "Failed to get Novus temperature")
- self.log_error(ex)
- return 0
-
def read_si7021_temp(self, address, i2cbus):
try:
script = os.path.dirname(os.path.realpath(__file__)) + "/SI7021.py "