Open brianegge opened 5 years ago
This code expects your system has python3 available. First run
sudo apt-get install python3
You can install the dependencies with pip3 install -r requirements.txt
in the project directory.
Then try running ./__main__.py
or /usr/bin/python3 __main__.py
hi, thanks, ive tried the above, the dependencies pull down fine, and phython3 is installed.
when I run the main.py script i still get the following:
_Traceback (most recent call last):
File "main.py", line 4, in
Everything I read points to python2 running and not python3. Try
/usr/bin/python3 —version
On Nov 5, 2018, at 6:08 PM, ralphmackinder notifications@github.com wrote:
hi, thanks, ive tried the above, the dependencies pull down fine, and phython3 is installed.
when I run the main.py script i still get the following:
Traceback (most recent call last): File "main.py", line 4, in from lib.upnp_http_server import UPNPHTTPServer, get_network_interface_ip_address File "/home/pi/upnp-ups-service/lib/upnp_http_server.py", line 1, in from http.server import BaseHTTPRequestHandler, HTTPServer ImportError: No module named http.server
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
pi@raspberrypi:/usr/bin $ python3 --version Python 3.5.3 pi@raspberrypi:/usr/bin $ python2 --version Python 2.7.13
is it an issue to have both running? could that be it?
i think i have it - need to set 3.5.3 to default rather than 2.7.1. will let you know how it goes.
ok, ive set py 3.5 as default. when I run main.py i now get the following;
Traceback (most recent call last):
File "main.py", line 28, in
apologies for all the questions! You have no obligation to answer!
Hi Brian, I have a QNAP TS-253A, I am looking to install your code on it. Could you please help me out a little bit with some instructions? Thanks a lot!
I've fixed the problem with 'logger' missing. I've also tried to address having a different name for your ethernet adapter. Right now the script doesn't have a config file, which is where the network adapter name should probably live. You may need to change wlan0
to the name if your default ethernet found in ifconfig
.
hi, thanks - I think im getting somewhere now. when I run the script main..py I now get the following:
Init SSL without certificate database
Traceback (most recent call last):
File "./main.py", line 36, in
are there any other attributes I need to change. it this because my UPS is an APC model with different outputs in UPSC?
Hi again. better news - I removed part of line 36 from the main.py script as there is no such status on my UPSC output and the script ran!! It found the UPS in smartthings...but, its only showing the basic status 'normal'.. all other fields are blank. I've posted below by UPSC output and the smart app tiles. Could you advise which area I need to change to populate?
I've starred out unique data to the UPS.
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.runtime: 20100
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 27.4
battery.voltage.nominal: 24.0
device.mfr: American Power Conversion
device.model: Smart-UPS 1500
device.serial: AS1
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: APC HID 0.96
driver.version.internal: 0.41
ups.beeper.status: disabled
ups.delay.shutdown: 20
ups.firmware: COM 02.1 / UPS.05.I
ups.mfr: American Power Conversion
ups.mfr.date: 201
ups.model: Smart-UPS 1*
ups.productid: 0
ups.serial: AS11****
ups.status: OL
ups.timer.reboot: -1
ups.timer.shutdown: -1
ups.vendorid: 051d
thanks again for all your help with this
Thanks for the output. I will update the code this weekend to map all of your inputs. I thought the HID interface created standard attributes, but I see multiple ones exist.
-Brian
On Nov 8, 2018, at 10:36 AM, mkdr30 notifications@github.com wrote:
Hi again. better news - I removed part of line 36 from the main.py script as there is no such status on my UPSC output and the script ran!! It found the UPS in smartthings...but, its only showing the basic status 'normal'.. all other fields are blank. I've posted below by UPSC output and the smart app tiles. Could you advise which area I need to change to populate?
I've starred out unique data to the UPS.
battery.charge: 100 battery.charge.low: 10 battery.charge.warning: 50 battery.runtime: 20100 battery.runtime.low: 120 battery.type: PbAc battery.voltage: 27.4 battery.voltage.nominal: 24.0 device.mfr: American Power Conversion device.model: Smart-UPS 1500 device.serial: AS1 device.type: ups driver.name: usbhid-ups driver.parameter.pollfreq: 30 driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.parameter.synchronous: no driver.version: 2.7.4 driver.version.data: APC HID 0.96 driver.version.internal: 0.41 ups.beeper.status: disabled ups.delay.shutdown: 20 ups.firmware: COM 02.1 / UPS.05.I ups.mfr: American Power Conversion ups.mfr.date: 201 ups.model: Smart-UPS 1* ups.productid: 0 ups.serial: AS11**** ups.status: OL ups.timer.reboot: -1 ups.timer.shutdown: -1 ups.vendorid: 051d
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
on that - i'm also going to attempt to update the UPS firmware, have read that nut may output other attributes on more recent firmware versions.
What I really want is input voltage / output voltage to report so I can log it over time.
We have a stable supply but here in the UK it can be anything from 240v to 257v, particularly at time of low demand.
I've update this project to work with the APC, but I have not attempted to update the smart app project yet. I'm not sure how to dynamically add/remove tiles based on the capabilities of each UPS. It does not appear that your APC makes the input/output voltages available through the USB interface.
I think some smart plugs can monitor voltage (and current).
thanks brian - yes ive tried to update the ups firmware but i think it wont work without a network card. oh well. i'll try your code again - thanks again for all your help.
hi, tried the new code - it works but obviously it doesn't show any of the attributes in the smart app, i'll have a look at the device handler but im no expert! thanks
Odd - it should show some of the attributes in the app. I think the APC shows the DC voltage levels.
Separately, I'm working on going from poll to push updates, which should make things respond quicker.
yeh its weird - I can see status, but nothing else. script is running, and the UPS is detected by the service manager app. cant seem to map any attribute on to the tiles.
I'm using a Cyber power CP1000AVRLCD and it's showing the same general sensible output as ralphmackinder. I am getting the same result visually in the device, but the device isn't changing when the battery loses power. Just always says normal. What part of the code can I edit to get the tiles to update?
Can you post the output of upsc myups
. Do you see input/output voltages changing?
Yeah:
With Power:
battery.charge: 100 battery.charge.low: 10 battery.charge.warning: 20 battery.mfr.date: CPS battery.runtime: 5722 battery.runtime.low: 300 battery.type: PbAcid battery.voltage: 13.1 battery.voltage.nominal: 12 device.mfr: CPS device.model: CP1000AVRLCDa device.serial: CTKHV2000436 device.type: ups driver.name: usbhid-ups driver.parameter.pollfreq: 30 driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.parameter.synchronous: no driver.version: 2.7.4 driver.version.data: CyberPower HID 0.4 driver.version.internal: 0.41 input.voltage: 120.0 input.voltage.nominal: 120 output.voltage: 136.0 ups.beeper.status: enabled ups.delay.shutdown: 20 ups.delay.start: 30 ups.load: 7 ups.mfr: CPS ups.model: CP1000AVRLCDa ups.productid: 0501 ups.realpower.nominal: 600 ups.serial: CTKHV2000436 ups.status: OL ups.test.result: No test initiated ups.timer.shutdown: -60 ups.timer.start: -60 ups.vendorid: 0764
Without Power:
battery.charge: 100 battery.charge.low: 10 battery.charge.warning: 20 battery.mfr.date: CPS battery.runtime: 5722 battery.runtime.low: 300 battery.type: PbAcid battery.voltage: 13.1 battery.voltage.nominal: 12 device.mfr: CPS device.model: CP1000AVRLCDa device.serial: CTKHV2000436 device.type: ups driver.name: usbhid-ups driver.parameter.pollfreq: 30 driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.parameter.synchronous: no driver.version: 2.7.4 driver.version.data: CyberPower HID 0.4 driver.version.internal: 0.41 input.voltage: 120.0 input.voltage.nominal: 120 output.voltage: 136.0 ups.beeper.status: enabled ups.delay.shutdown: 20 ups.delay.start: 30 ups.load: 7 ups.mfr: CPS ups.model: CP1000AVRLCDa ups.productid: 0501 ups.realpower.nominal: 600 ups.serial: CTKHV2000436 ups.status: OB DISCHRG ups.test.result: No test initiated ups.timer.shutdown: -60 ups.timer.start: -60 ups.vendorid: 0764
The input voltage reading did change to 0.0 right after i took the grab from putty.
I need to load your settings into my test environment, but I can't do that this weekend. I've made a minor change in the DHT, but haven't tested it yet.
Ok cool.
Any progress? I'm still really interested in getting this going with my CyberPower units.
I've published a few updates. Please update the DTH.
A fixed a few errors and made a couple of improvements. I don't seem to be able to handle coloring the tiles based on the nominal voltage.
Also, the output voltage of 136v seems high.
I still have some work on polling / publishing events. It doesn't seem like the hub will poll the service as often as I would like.
Cool. I published the DTH update, but now the device just says something went wrong and it can't display the screen right now.
Odd, because I used the output you sent me to test. Can you see the REST request on the ups service?
On Dec 19, 2018, at 12:30 PM, riccanet notifications@github.com wrote:
Cool. I published the DTH update, but now the device just says something went wrong and it can't display the screen right now.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I dug a little bit deeper. The DTH is working perfect on iPhones. I have an android device. Not sure if there is something that needs to be modified to make it work on android devices.
Oh, sorry. I don’t have any Android devices to test with. It works fine in the simulator.
On Dec 23, 2018, at 2:30 PM, riccanet notifications@github.com wrote:
I dug a little bit deeper. The DTH is working perfect on iPhones. I have an android device. Not sure if there is something that needs to be modified to make it work on android devices.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/brianegge/upnp-ups-service/issues/1#issuecomment-449658768, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKvOjbvOQ9RxQEiHPVeF1GNu66HXEh8ks5u79nCgaJpZM4YPVXu.
I did some process of elimination troubleshooting. The problem is due to the battery tile. You have the value as "NA" in the first line and Android must not like that. I modified it to this:
valueTile("battery", "device.battery_percent", width: 2, height: 2) { state("battery_percent", label:'Battery ${currentValue}%', backgroundColors:[ [value: '0', color: "#cccccc"], [value: 25, color: "#ff0000"], [value: 45, color: "#ff3b0b"], [value: 60, color: "#fa7616"], [value: 75, color: "#f5b220"], [value: 85, color: "#f1d801"], [value: 90, color: "#b5c811"], [value: 95, color: "#79b821"] ])
Please update the DTH and see if it messes up the Apple app. I don't have an apple device to test with.
Done - sorry I overlooked this one.
I was hoping to grey out the unsupported tiles, but I found the ‘NA’ didn’t work at all. I overlooked this one. Unfortunately, different devices support different features. Some have 12v batteries and other 24v. Unless I created a parent/child device, it’s difficult to customize how it shows up for attributes which aren’t present.
On Dec 30, 2018, at 9:00 PM, riccanet notifications@github.com wrote:
I did some process of elimination troubleshooting. The problem is due to the battery tile. You have the value as "NA" in the first line and Android must not like that. I modified it to this:
valueTile("battery", "device.battery_percent", width: 2, height: 2) { state("battery_percent", label:'Battery ${currentValue}%', backgroundColors:[ [value: '0', color: "#cccccc"], [value: 25, color: "#ff0000"], [value: 45, color: "#ff3b0b"], [value: 60, color: "#fa7616"], [value: 75, color: "#f5b220"], [value: 85, color: "#f1d801"], [value: 90, color: "#b5c811"], [value: 95, color: "#79b821"] ])
Please update the DTM and see if it messes up the Apple app. I don't have an apple device to test with.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/brianegge/upnp-ups-service/issues/1#issuecomment-450601015, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKvOn9f27HliYYRmr2DVsSBAfc-FsJUks5u-W_EgaJpZM4YPVXu.
loaded this up and got it working with my NUT server. Seems to work as intended, but I have 2 issues.
This is exactly what I was searching for though. Great work!
hi, ive had a look at this but somehow still having issues.
i’m running the service and getting the following output:
Traceback (most recent call last):
File “main.py”, line 4, in
from lib.upnp_http_server import UPNPHTTPServer, get_network_interface_ip_address
File “/home/pi/upsmonitor/lib/upnp_http_server.py”, line 1, in
from http.server import BaseHTTPRequestHandler, HTTPServer
ImportError: No module named http.server
only just getting into linux so its a learning curve. am i missing something?