Added ELEC5 paket type #48

Merged
merged 14 commits into from Feb 11, 2017

Projects

None yet

2 participants

@diplix
diplix commented Feb 9, 2017 edited

regarding: #47

unfortunatly the addidion doesn’t work, though i think it should. can’t find the error, but i get this in the home assistant logs:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/ix/.homeassistant/deps/RFXtrx/__init__.py", line 690, in _connect
    event = self.transport.receive_blocking()
  File "/Users/ix/.homeassistant/deps/RFXtrx/__init__.py", line 603, in receive_blocking
    return self.parse(pkt)
  File "/Users/ix/.homeassistant/deps/RFXtrx/__init__.py", line 547, in parse
    obj = SensorEvent(pkt)
  File "/Users/ix/.homeassistant/deps/RFXtrx/__init__.py", line 415, in __init__
    self.values['Battery numeric'] = pkt.battery
  File "/Users/ix/.homeassistant/deps/RFXtrx/lowlevel.py", line 134, in __getattr__
    raise AttributeError(name)
AttributeError: battery

also added this in __init__.py' row 410:

        if isinstance(pkt, lowlevel.Energy5):
            self.values['Energy usage'] = pkt.currentwatt
            self.values['Total usage'] = pkt.totalwatthours
diplix added some commits Feb 9, 2017
@diplix diplix added ELEC5 paket type
regarding: #47

unfortunatly the addidion doesn’t work, though i think it should. can’t find the error, but i get this in the home assistant logs:

``` 
  File "/Users/ix/.homeassistant/deps/RFXtrx/__init__.py", line 693, in _connect
  File "/Users/ix/.homeassistant/deps/RFXtrx/__init__.py", line 606, in receive_blocking
  File "/Users/ix/.homeassistant/deps/RFXtrx/__init__.py", line 550, in parse
  File "/Users/ix/.homeassistant/deps/RFXtrx/__init__.py", line 418, in __init__
  File "/Users/ix/.homeassistant/deps/RFXtrx/lowlevel.py", line 134, in __getattr__
 ```
also added this in __init__.py row 410:
```
        if isinstance(pkt, lowlevel.Energy5):
            self.values['Energy usage'] = pkt.currentwatt
            self.values['Total usage'] = pkt.totalwatthours
```
b655df6
@diplix diplix added battery
with that he battery attribute i got rid of the errors and it basically works now.
fd8e1f5
@diplix diplix add attributes for energy5
447a384
@diplix
diplix commented Feb 9, 2017

ok. that seems to work now. total usage in in watt meters, energy usage in watt, current in ampere.

bildschirmfoto 2017-02-09 um 21 54 56

diplix added some commits Feb 10, 2017
@diplix diplix remove battery for revolt meter f6a8a02
@diplix diplix remove battery for revolt meter
d63521e
@diplix diplix initial try to test Elec5
ded33e5
@diplix
diplix commented Feb 10, 2017

i guess i need some help with the tests. otherwise ELEC5 is working fine.

@Danielhiversen
Owner

Thanks.
Great work.

For the test, the code is calculating the voltage to be 189, but you have specified that it should be 185.
https://travis-ci.org/Danielhiversen/pyRFXtrx/jobs/200255825#L247
So you have either specified a wrong value in the test or there is something wrong in the calculations.
Is it possible to capture a packet and read the correct values from an external display?

@diplix
diplix commented Feb 10, 2017 edited

i think i’m going to change the value. actual readings are a little difficult, because the device is busily sending data every 3-5 seconds. i saw that the rfxtrx-pyRFXtrx-HA-chain is always laging a little behind the actual packets, so matching the raw output and the displayed values is just as much guesswork.

@diplix diplix correct voltage
825facd
@diplix diplix changed the title from [WIP] added ELEC5 paket type to Added ELEC5 paket type Feb 10, 2017
@diplix
diplix commented Feb 10, 2017 edited

:(
test failed again. i’ll try matching packets and readings later.

diplix added some commits Feb 10, 2017
@diplix diplix another try to get the right values
3c7f9f8
@diplix diplix this should fix the tests
0f8b480
@diplix diplix remove trailing whitespace
8df9d1d
@diplix diplix fix blank lines and long lines
79baee2
@diplix diplix fix redundant backslash
114b9a0
@diplix diplix fix trailing whitespace
540fbf2
@diplix
diplix commented Feb 10, 2017

ok. tests are passing now, what i still need to do: check if all data actually gets converted to the right values and possibly get a real packet to use for testing.

@diplix diplix use actual packet and values for testing
c6bd410
@diplix
diplix commented Feb 11, 2017

@Danielhiversen i’m done.
the values add up, for a while i thought the current value in ampere was too high, but energy5 returns exactly the same values as the RFXmngr app.
can’t figure out what to do about the failed coverall test.

@Danielhiversen
Owner

Great. Good job.
I will update Home Assistant, so your code will soon be part of the official release.

@Danielhiversen Danielhiversen merged commit e25ed00 into Danielhiversen:master Feb 11, 2017

1 of 2 checks passed

coverage/coveralls Coverage decreased (-0.2%) to 92.521%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@diplix diplix deleted the diplix:patch-1 branch Feb 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment