question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

measure_v2 error trying hass measurement

See original GitHub issue

everything looks normal until the script tries to get the watt usage from my shelly

python3 measure.py 
light controller hass
powermeter shelly
? Select the color mode?  hs
? Do you want to generate model.json?  Yes
? Specify the full light model name  Living Colors Gen3 Iris
? Which device (manufacturer, model) do you use to take the measurement?  signify
? Do you want to gzip CSV files?  No
? Specify the entity_id of your light in HA?  light.livingcolors_1
? What is the model_id of your light? for example LWA004  LLC006
Measuring standby usage. Waiting for 5 seconds...
Taking sample 0
Traceback (most recent call last):
  File "measure.py", line 330, in <module>
    measure.start()
  File "measure.py", line 94, in start
    standby_usage = self.measure_standby_usage()
  File "measure.py", line 179, in measure_standby_usage
    return self.take_power_measurement(start_time)
  File "measure.py", line 141, in take_power_measurement
    measurement = self.power_meter.get_power()
  File "/home/media/pcalc/homeassistant-powercalc/utils/measure_v2/powermeter/shelly.py", line 16, in get_power
    json = r.json()
  File "/home/media/pcalc/homeassistant-powercalc/utils/measure_v2/measure2/lib/python3.8/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I do get these warnings during “pip install -r requirements.txt” or “pip3 install -r requirements.txt”

Building wheels for collected packages: asyncclick, gensim, phue, PyInquirer
  Building wheel for asyncclick (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/media/pcalc/homeassistant-powercalc/utils/measure_v2/measure2/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kvvg2dmk/asyncclick/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kvvg2dmk/asyncclick/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-rb5_05di
       cwd: /tmp/pip-install-kvvg2dmk/asyncclick/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help
  
  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for asyncclick
  Running setup.py clean for asyncclick
  Building wheel for gensim (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/media/pcalc/homeassistant-powercalc/utils/measure_v2/measure2/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kvvg2dmk/gensim/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kvvg2dmk/gensim/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-kl_ty487
       cwd: /tmp/pip-install-kvvg2dmk/gensim/
  Complete output (7 lines):
  WARNING: The wheel package is not available.
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help
 ----------------------------------------
  ERROR: Failed building wheel for gensim
  Running setup.py clean for gensim
  Building wheel for phue (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/media/pcalc/homeassistant-powercalc/utils/measure_v2/measure2/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kvvg2dmk/phue/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kvvg2dmk/phue/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-qk8hcv1y
       cwd: /tmp/pip-install-kvvg2dmk/phue/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help
  
  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for phue
  Running setup.py clean for phue
  Building wheel for PyInquirer (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/media/pcalc/homeassistant-powercalc/utils/measure_v2/measure2/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kvvg2dmk/PyInquirer/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kvvg2dmk/PyInquirer/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-p8yqf165
       cwd: /tmp/pip-install-kvvg2dmk/PyInquirer/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
 ----------------------------------------
  ERROR: Failed building wheel for gensim
  Running setup.py clean for gensim
  Building wheel for phue (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/media/pcalc/homeassistant-powercalc/utils/measure_v2/measure2/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kvvg2dmk/phue/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kvvg2dmk/phue/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-qk8hcv1y
       cwd: /tmp/pip-install-kvvg2dmk/phue/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help
  
  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for phue
  Running setup.py clean for phue
  Building wheel for PyInquirer (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/media/pcalc/homeassistant-powercalc/utils/measure_v2/measure2/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kvvg2dmk/PyInquirer/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kvvg2dmk/PyInquirer/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-p8yqf165
       cwd: /tmp/pip-install-kvvg2dmk/PyInquirer/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
wormiedkcommented, Sep 6, 2021

Seems VERY stable. Measuring on day 2 of my Livingcolors Gen3 iris…

Some sort of tutorial on how to set delays might be usefull. I thought of running a measurement with loads of measurements per change and see how quickly they stabilize, however only thought of that AFTER starting measuring my iris lamp

1reaction
wormiedkcommented, Sep 4, 2021

This code works with the Shelly 1PM:

from __future__ import annotations
import datetime
import requests
from .powermeter import PowerMeasurementResult, PowerMeter

class ShellyPowerMeter(PowerMeter):
    def __init__(self, shelly_ip):
        self.meter_uri = "http://{}/status/".format(shelly_ip)

    def get_power(self) -> PowerMeasurementResult:
        r = requests.get(self.meter_uri)
        json = r.json()
        return PowerMeasurementResult(
            float(json["meters"][0]["power"]),
            float(json["meters"][0]["timestamp"]),
        )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Measurements and Error Analysis
Measurement errors may be classified as either random or systematic, depending on how the measurement was obtained (an instrument could cause a random...
Read more >
Lecture note #2, Physical Measurements, PHYS 201L
A systematic error is an effect that changes all measurements by the same amount or by the same percentage. For example, a ruler...
Read more >
Measurement Error (Observational Error)
Measurement Error (also called Observational Error) is the difference between a measured quantity and its true value. It includes random error (naturally ...
Read more >
Standard error vs. Standard error of measurement - Shiken
As your question suggests, the standard error of estimate is often confused with the standard error of measurement that is reported by some...
Read more >
Errors in Measurement
When your instrument measures in "1"s then any value between 6½ and 7½ is measured as "7", accuracy 1: 6.5 to 7.5. When...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found