8000 Add emeter support for strip sockets by bdraco · Pull Request #203 · python-kasa/python-kasa · GitHub
[go: up one dir, main page]

Skip to content

Add emeter support for strip sockets #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Sep 23, 2021

Conversation

bdraco
Copy link
Member
@bdraco bdraco commented Sep 21, 2021

Continuation of #154

Fixes #64

@bdraco bdraco changed the title Add support for plugs with emeters. Add support for plugs with emeters Sep 21, 2021
@codecov-commenter
Copy link
codecov-commenter commented Sep 21, 2021

Codecov Report

Merging #203 (e6a6b16) into master (47a1405) will increase coverage by 1.41%.
The diff coverage is 98.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #203      +/-   ##
==========================================
+ Coverage   75.04%   76.45%   +1.41%     
==========================================
  Files          11       12       +1     
  Lines        1250     1270      +20     
  Branches      181      183       +2     
==========================================
+ Hits          938      971      +33     
+ Misses        273      264       -9     
+ Partials       39       35       -4     
Impacted Files Coverage Δ
kasa/smartstrip.py 92.14% <97.29%> (+10.46%) ⬆️
kasa/smartdevice.py 82.52% <100.00%> (-0.20%) ⬇️
kasa/utils.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47a1405...e6a6b16. Read the comment docs.

@bdraco bdraco marked this pull request as ready for review September 21, 2021 21:21
@bdraco
Copy link
Member Author
bdraco commented Sep 21, 2021

testing

DEBUG:kasa.smartdevice:Initializing 192.168.211.210 of type <class 'kasa.smartstrip.SmartStrip'>
DEBUG:asyncio:Using selector: KqueueSelector
DEBUG:kasa.smartdevice:Performing the initial update to obtain sysinfo
DEBUG:kasa.protocol:> (33) {"system": {"get_sysinfo": null}}
DEBUG:kasa.protocol:< (1210) {'system': {'get_sysinfo': {'alias': 'TP-LINK_Power Strip_5C33',
                            'child_num': 6,
                            'children': [{'alias': 'Plug 1',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031900',
                                          'next_action': {'type': -1},
                                          'on_time': 5624,
                                          'state': 1},
                                         {'alias': 'Plug 2',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031901',
                                          'next_action': {'type': -1},
                                          'on_time': 5745,
                                          'state': 1},
                                         {'alias': 'Plug 3',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031902',
                                          'next_action': {'type': -1},
                                          'on_time': 6765,
                                          'state': 1},
                                         {'alias': 'Plug 4',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031903',
                                          'next_action': {'type': -1},
                                          'on_time': 6765,
                                          'state': 1},
                                         {'alias': 'Plug 5',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031904',
                                          'next_action': {'type': -1},
                                          'on_time': 6765,
                                          'state': 1},
                                         {'alias': 'Plug 6',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031905',
                                          'next_action': {'type': -1},
                                          'on_time': 6765,
                                          'state': 1}],
                            'deviceId': '8006AF35494E7DB13DDE9B8F40BF2E001E770319',
                            'err_code': 0,
                            'feature': 'TIM:ENE',
                            'hwId': '955F433CBA24823A248A59AA64571A73',
                            'hw_ver': '2.0',
                            'latitude_i': 297852,
                            'led_off': 0,
                            'longitude_i': -954074,
                            'mac': 'C0:06:C3:42:5C:33',
                            'mic_type': 'IOT.SMARTPLUGSWITCH',
                            'model': 'HS300(US)',
                            'oemId': '32BD0B21AA9BF8E84737D1DB1C66E883',
                            'rssi': -42,
                            'status': 'new',
                            'sw_ver': '1.0.3 Build 201203 Rel.165457',
                            'updating': 0}}}
DEBUG:kasa.smartdevice:The device has emeter, querying its information along sysinfo
DEBUG:kasa.protocol:> (143) {"system": {"get_sysinfo": null}, "emeter": {"get_realtime": null, "get_monthstat": {"year": 2021}, "get_daystat": {"month": 9, "year": 2021}}}
DEBUG:kasa.protocol:< (1497) {'emeter': {'get_daystat': {'day_list': [{'day': 21,
                                          'energy_wh': 0,
                                          'month': 9,
                                          'year': 2021}],
                            'err_code': 0},
            'get_monthstat': {'err_code': 0,
                              'month_list': [{'energy_wh': 0,
                                              'month': 9,
                                              'year': 2021}]},
            'get_realtime': {'current_ma': 0,
                             'err_code': 0,
                             'power_mw': 0,
                             'slot_id': 0,
                             'total_wh': 0,
                             'voltage_mv': 120721}},
 'system': {'get_sysinfo': {'alias': 'TP-LINK_Power Strip_5C33',
                            'child_num': 6,
                            'children': [{'alias': 'Plug 1',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031900',
                                          'next_action': {'type': -1},
                                          'on_time': 5624,
                                          'state': 1},
                                         {'alias': 'Plug 2',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031901',
                                          'next_action': {'type': -1},
                                          'on_time': 5745,
                                          'state': 1},
                                         {'alias': 'Plug 3',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031902',
                                          'next_action': {'type': -1},
                                          'on_time': 6765,
                                          'state': 1},
                                         {'alias': 'Plug 4',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031903',
                                          'next_action': {'type': -1},
                                          'on_time': 6765,
                                          'state': 1},
                                         {'alias': 'Plug 5',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031904',
                                          'next_action': {'type': -1},
                                          'on_time': 6765,
                                          'state': 1},
                                         {'alias': 'Plug 6',
                                          'id': '8006AF35494E7DB13DDE9B8F40BF2E001E77031905',
                                          'next_action': {'type': -1},
                                          'on_time': 6765,
                                          'state': 1}],
                            'deviceId': '8006AF35494E7DB13DDE9B8F40BF2E001E770319',
                            'err_code': 0,
                            'feature': 'TIM:ENE',
                            'hwId': '955F433CBA24823A248A59AA64571A73',
                            'hw_ver': '2.0',
                            'latitude_i': 297852,
                            'led_off': 0,
                            'longitude_i': -954074,
                            'mac': 'C0:06:C3:42:5C:33',
                            'mic_type': 'IOT.SMARTPLUGSWITCH',
                            'model': 'HS300(US)',
                            'oemId': '32BD0B21AA9BF8E84737D1DB1C66E883',
                            'rssi': -42,
                            'status': 'new',
                            'sw_ver': '1.0.3 Build 201203 Rel.165457',
                            'updating': 0}}}
DEBUG:kasa.smartstrip:Initializing 6 child sockets
DEBUG:kasa.smartdevice:Initializing 192.168.211.210 of type <class 'kasa.smartstrip.SmartStripPlug'>
DEBUG:kasa.smartdevice:Initializing 192.168.211.210 of type <class 'kasa.smartstrip.SmartStripPlug'>
DEBUG:kasa.smartdevice:Initializing 192.168.211.210 of type <class 'kasa.smartstrip.SmartStripPlug'>
DEBUG:kasa.smartdevice:Initializing 192.168.211.210 of type <class 'kasa.smartstrip.SmartStripPlug'>
DEBUG:kasa.smartdevice:Initializing 192.168.211.210 of type <class 'kasa.smartstrip.SmartStripPlug'>
DEBUG:kasa.smartdevice:Initializing 192.168.211.210 of type <class 'kasa.smartstrip.SmartStripPlug'>
DEBUG:asyncio:Using selector: KqueueSelector
DEBUG:kasa.protocol:> (108) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031900"]}, "emeter": {"get_realtime": null}}
DEBUG:kasa.protocol:< (115) {'emeter': {'get_realtime': {'current_ma': 0,
                             'err_code': 0,
                             'power_mw': 0,
                             'slot_id': 0,
                             'total_wh': 0,
                             'voltage_mv': 120722}}}
DEBUG:kasa.protocol:> (108) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031901"]}, "emeter": {"get_realtime": null}}
DEBUG:kasa.protocol:< (119) {'emeter': {'get_realtime': {'current_ma': 14,
                             'err_code': 0,
                             'power_mw': 1326,
                             'slot_id': 1,
                             'total_wh': 9,
                             'voltage_mv': 120698}}}
DEBUG:kasa.protocol:> (108) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031902"]}, "emeter": {"get_realtime": null}}
DEBUG:kasa.protocol:< (115) {'emeter': {'get_realtime': {'current_ma': 0,
                             'err_code': 0,
                             'power_mw': 0,
                             'slot_id': 2,
                             'total_wh': 0,
                             'voltage_mv': 120820}}}
DEBUG:kasa.protocol:> (108) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031903"]}, "emeter": {"get_realtime": null}}
DEBUG:kasa.protocol:< (115) {'emeter': {'get_realtime': {'current_ma': 0,
                             'err_code': 0,
                             'power_mw': 0,
                             'slot_id': 3,
                             'total_wh': 0,
                             'voltage_mv': 120808}}}
DEBUG:kasa.protocol:> (108) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031904"]}, "emeter": {"get_realtime": null}}
DEBUG:kasa.protocol:< (115) {'emeter': {'get_realtime': {'current_ma': 0,
                             'err_code': 0,
                             'power_mw': 0,
                             'slot_id': 4,
                             'total_wh': 0,
                             'voltage_mv': 120896}}}
DEBUG:kasa.protocol:> (108) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031905"]}, "emeter": {"get_realtime": null}}
DEBUG:kasa.protocol:< (115) {'emeter': {'get_realtime': {'current_ma': 0,
                             'err_code': 0,
                             'power_mw': 0,
                             'slot_id': 5,
                             'total_wh': 0,
                             'voltage_mv': 120900}}}
{'current_ma': 14.0,
 'power_mw': 1326.0,
 'slot_id': 15.0,
 'total_wh': 9.0,
 'voltage_mv': 120807}
DEBUG:kasa.protocol:> (129) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031900"]}, "emeter": {"get_daystat": {"month": 9, "year": 2021}}}
DEBUG:kasa.protocol:< (101) {'emeter': {'get_daystat': {'day_list': [{'day': 21,
                                          'energy_wh': 0,
                                          'month': 9,
                                          'year': 2021}],
                            'err_code': 0}}}
DEBUG:kasa.protocol:> (129) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031901"]}, "emeter": {"get_daystat": {"month": 9, "year": 2021}}}
DEBUG:kasa.protocol:< (101) {'emeter': {'get_daystat': {'day_list': [{'day': 21,
                                          'energy_wh': 9,
                                          'month': 9,
                                          'year': 2021}],
                            'err_code': 0}}}
DEBUG:kasa.protocol:> (129) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031902"]}, "emeter": {"get_daystat": {"month": 9, "year": 2021}}}
DEBUG:kasa.protocol:< (101) {'emeter': {'get_daystat': {'day_list': [{'day': 21,
                                          'energy_wh': 0,
                                          'month': 9,
                                          'year': 2021}],
                            'err_code': 0}}}
DEBUG:kasa.protocol:> (129) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031903"]}, "emeter": {"get_daystat": {"month": 9, "year": 2021}}}
DEBUG:kasa.protocol:< (101) {'emeter': {'get_daystat': {'day_list': [{'day': 21,
                                          'energy_wh': 0,
                                          'month': 9,
                                          'year': 2021}],
                            'err_code': 0}}}
DEBUG:kasa.protocol:> (129) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031904"]}, "emeter": {"get_daystat": {"month": 9, "year": 2021}}}
DEBUG:kasa.protocol:< (101) {'emeter': {'get_daystat': {'day_list': [{'day': 21,
                                          'energy_wh': 0,
                                          'month': 9,
                                          'year': 2021}],
                            'err_code': 0}}}
DEBUG:kasa.protocol:> (129) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031905"]}, "emeter": {"get_daystat": {"month": 9, "year": 2021}}}
DEBUG:kasa.protocol:< (101) {'emeter': {'get_daystat': {'day_list': [{'day': 21,
                                          'energy_wh': 0,
                                          'month': 9,
                                          'year': 2021}],
                            'err_code': 0}}}
{21: 0.009}
DEBUG:kasa.protocol:> (119) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031900"]}, "emeter": {"get_monthstat": {"year": 2021}}}
DEBUG:kasa.protocol:< (96) {'emeter': {'get_monthstat': {'err_code': 0,
                              'month_list': [{'energy_wh': 0,
                                              'month': 9,
                                              'year': 2021}]}}}
DEBUG:kasa.protocol:> (119) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031901"]}, "emeter": {"get_monthstat": {"year": 2021}}}
DEBUG:kasa.protocol:< (96) {'emeter': {'get_monthstat': {'err_code': 0,
                              'month_list': [{'energy_wh': 9,
                                              'month': 9,
                                              'year': 2021}]}}}
DEBUG:kasa.protocol:> (119) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031902"]}, "emeter": {"get_monthstat": {"year": 2021}}}
DEBUG:kasa.protocol:< (96) {'emeter': {'get_monthstat': {'err_code': 0,
                              'month_list': [{'energy_wh': 0,
                                              'month': 9,
                                              'year': 2021}]}}}
DEBUG:kasa.protocol:> (119) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031903"]}, "emeter": {"get_monthstat": {"year": 2021}}}
DEBUG:kasa.protocol:< (96) {'emeter': {'get_monthstat': {'err_code': 0,
                              'month_list': [{'energy_wh': 0,
                                              'month': 9,
                                              'year': 2021}]}}}
DEBUG:kasa.protocol:> (119) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031904"]}, "emeter": {"get_monthstat": {"year": 2021}}}
DEBUG:kasa.protocol:< (96) {'emeter': {'get_monthstat': {'err_code': 0,
                              'month_list': [{'energy_wh': 0,
                                              'month': 9,
                                              'year': 2021}]}}}
DEBUG:kasa.protocol:> (119) {"context": {"child_ids": ["8006AF35494E7DB13DDE9B8F40BF2E001E77031905"]}, "emeter": {"get_monthstat": {"year": 2021}}}
DEBUG:kasa.protocol:< (96) {'emeter': {'get_monthstat': {'err_code': 0,
                              'month_list': [{'energy_wh': 0,
                                              'month': 9,
                                              'year': 2021}]}}}
{9: 0.009}
<DeviceType.Strip model HS300(US) at 192.168.211.210 (TP-LINK_Power Strip_5C33), is_on: True - dev specific: {'LED state': True, 'Childs count': 6, 'On since': datetime.datetime(2021, 9, 21, 15, 9, 14, 735558)}>

@bdraco
Copy link
Member Author
bdraco commented Sep 21, 2021
import asyncio
from kasa import SmartStrip
import logging

logging.basicConfig(level=logging.DEBUG)

strip = SmartStrip("192.168.211.210")
import pprint

async def print_eme():
    res = await strip.get_emeter_realtime()
    pprint.pprint(dict(res))    
    res = await strip.get_emeter_daily(year=2021, month=9)
    pprint.pprint(dict(res))    
    res = await strip.get_emeter_monthly(year=2021)
    pprint.pprint(dict(res))    



asyncio.run(strip.update())
asyncio.run(print_eme())

pprint.pprint(strip)

Copy link
Member
@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and the cleanups you made alongside! I added some comments inline, what I'd like to see is to see is containing the emeter query inside the SmartStripPlug, which will allow downstreams to directly use the same API (i.e., simply using the emeter_* properties) for accessing the emeter information as is done on the smartplugs.

Copy link
Member
@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 👍 I'm a bit hesitant on creating a separate, generic utils module for the methods that are only used in a single module though.

@rytilahti
Copy link
Member

Looking at the emeter requests from your test output, did you check if single sockets also deliver daily/monthly information now?

bdraco and others added 2 commits September 23, 2021 10:49
Co-authored-by: Teemu R. <tpr@iki.fi>
@bdraco
Copy link
Member Author
bdraco commented Sep 23, 2021

Looking at the emeter requests from your test output, did you check if single sockets also deliver daily/monthly information now?

Yes

import asyncio
from kasa import SmartStrip
import logging

# logging.basicConfig(level=logging.DEBUG)

strip = SmartStrip("192.168.211.210")
import pprint


async def print_eme():
    pprint.pprint(["emeter_this_month", strip.emeter_this_month])
    pprint.pprint(["emeter_today", strip.emeter_today])
    pprint.pprint(["emeter_realtime", strip.emeter_realtime])
    res = await strip.get_emeter_realtime()
    pprint.pprint(dict(res))
    res = await strip.get_emeter_daily(year=2021, month=9)
    pprint.pprint(dict(res))
    res = await strip.get_emeter_monthly(year=2021)
    pprint.pprint(dict(res))
    for plug in strip.children:
        pprint.pprint(await plug.get_emeter_daily(year=2021, month=9))


asyncio.run(strip.update())
asyncio.run(print_eme())

pprint.pprint(strip)

output

['emeter_this_month', 0.034]
['emeter_today', 0.0]
['emeter_realtime',
 {'current_ma': 39.0,
  'err_code': 0.0,
  'power_mw': 4030.0,
  'slot_id': 15.0,
  'total_wh': 0.0,
  'voltage_mv': 121576}]
{'current_ma': 39.0,
 'power_mw': 3994.0,
 'slot_id': 15.0,
 'total_wh': 0.0,
 'voltage_mv': 121595}
{21: 0.019, 22: 0.015, 23: 0.0}
{9: 0.034}
{23: 0.0}
{21: 0.019, 22: 0.015, 23: 0.0}
{23: 0.0}
{23: 0.0}
{23: 0.0}
{23: 0.0}

@rytilahti
Copy link
Member
rytilahti commented Sep 23, 2021

I mean using the property getters, so something like:

import asyncio

async def check_strip_children(s):
    await s.update()
    for child in s.children:
        await child.update()
        print(f"{child.emeter_realtime=} {child.emeter_today=} {child.emeter_this_month=}")

asyncio.run(check_strip(SmartStrip(...))

@bdraco
Copy link
Member Author
bdraco commented Sep 23, 2021

I mean using the property getters, so something like:

import asyncio

async def check_strip_children(s):
    await s.update()
    for child in s.children:
        await child.update()
        print(f"{child.emeter_realtime=} {child.emeter_today=} {child.emeter_this_month=}")

asyncio.run(check_strip(SmartStrip(...))
child.emeter_realtime=<EmeterStatus power=0.0 voltage=121.046 current=0.0 total=0.0> child.emeter_today=0.0 child.emeter_this_month=0.0
child.emeter_realtime=<EmeterStatus power=0.0 voltage=121.046 current=0.0 total=0.0> child.emeter_today=0.0 child.emeter_this_month=0.034
child.emeter_realtime=<EmeterStatus power=0.0 voltage=121.196 current=0.0 total=0.0> child.emeter_today=0.0 child.emeter_this_month=0.0
child.emeter_realtime=<EmeterStatus power=4.0 voltage=121.153 current=0.039 total=0.002> child.emeter_today=0.002 child.emeter_this_month=0.002
child.emeter_realtime=<EmeterStatus power=0.0 voltage=121.215 current=0.0 total=0.0> child.emeter_today=0.0 child.emeter_this_month=0.0
child.emeter_realtime=<EmeterStatus power=0.0 voltage=121.215 current=0.0 total=0.0> child.emeter_today=0.0 child.emeter_this_month=0.0

@rytilahti rytilahti changed the title Add support for plugs with emeters Add emeter support for strip sockets Sep 23, 2021
@rytilahti
Copy link
Member

Yay, great! 🎉 Let's get this merged and I'll prepare a new dev release.

@rytilahti rytilahti merged commit 94e5a90 into python-kasa:master Sep 23, 2021
@rytilahti rytilahti added the enhancement New feature or request label Sep 23, 2021
rytilahti added a commit to rytilahti/python-kasa that referenced this pull request Sep 23, 2021
* Add support for plugs with emeters.

* Tweaks for emeter

* black

* tweaks

* tweaks

* more tweaks

* dry

* flake8

* flake8

* legacy typing

* Update kasa/smartstrip.py

Co-authored-by: Teemu R. <tpr@iki.fi>

* reduce

* remove useless delegation

* tweaks

* tweaks

* dry

* tweak

* tweak

* tweak

* tweak

* update tests

* wrap

* preen

* prune

* prune

* prune

* guard

* adjust

* robust

* prune

* prune

* reduce dict lookups by 1

* Update kasa/smartstrip.py

Co-authored-by: Teemu R. <tpr@iki.fi>

* delete utils

* isort

Co-authored-by: Brendan Burns <brendan.d.burns@gmail.com>
Co-authored-by: Teemu R. <tpr@iki.fi>
rytilahti added a commit to rytilahti/python-kasa that referenced this pull request Sep 23, 2021
The most important enhancements in this release are:
* Support for emeter on strip sockets
* Fix discovery and update() on some devices that do not support multi-module queries (e.g., HS200)
* Improved support for bulbs

[Full Changelog](python-kasa/python-kasa@0.4.0.dev3...0.4.0.dev4)

**Implemented enhancements:**

- HS300 Children plugs have emeter [\python-kasa#64](python-kasa#64)
- Improve emeterstatus API, move into own module [\python-kasa#205](python-kasa#205) ([rytilahti](https://github.com/rytilahti))
- Avoid temp array during encrypt and decrypt [\python-kasa#204](python-kasa#204) ([bdraco](https://github.com/bdraco))
- Add emeter support for strip sockets [\python-kasa#203](python-kasa#203) ([bdraco](https://github.com/bdraco))
- Add own device type for smartstrip children [\python-kasa#201](python-kasa#201) ([rytilahti](https://github.com/rytilahti))
- bulb: allow set\_hsv without v, add fallback ct range [\python-kasa#200](python-kasa#200) ([rytilahti](https://github.com/rytilahti))
- Improve bulb support \(alias, time settings\) [\python-kasa#198](python-kasa#198) ([rytilahti](https://github.com/rytilahti))
- Improve testing harness to allow tests on real devices [\python-kasa#197](python-kasa#197) ([rytilahti](https://github.com/rytilahti))
- cli: add human-friendly printout when calling temperature on non-supported devices [\python-kasa#196](python-kasa#196) ([JaydenRA](https://github.com/JaydenRA))

**Fixed bugs:**

- KL430: Throw error for Device specific information [\python-kasa#189](python-kasa#1
10000
89)
- dump\_devinfo: handle latitude/longitude keys properly [\python-kasa#175](python-kasa#175) ([rytilahti](https://github.com/rytilahti))

**Closed issues:**

- Feature Request - Toggle Command [\python-kasa#188](python-kasa#188)
- Is It Compatible With HS105? [\python-kasa#186](python-kasa#186)
- Cannot use some functions with KP303 [\python-kasa#181](python-kasa#181)
- Help needed - awaiting game  [\python-kasa#179](python-kasa#179)
- Version inconsistency between CLI and pip [\python-kasa#177](python-kasa#177)
- Release 0.4.0.dev3? [\python-kasa#169](python-kasa#169)
- Discover does not support specifying network interface [\python-kasa#167](python-kasa#167)
- Can't command or query HS200 v5 switch [\python-kasa#161](python-kasa#161)

**Merged pull requests:**

- More CI fixes [\python-kasa#208](python-kasa#208) ([rytilahti](https://github.com/rytilahti))
- Fix CI dep installation [\python-kasa#207](python-kasa#207) ([rytilahti](https://github.com/rytilahti))
- Use github actions instead of azure pipelines [\python-kasa#206](python-kasa#206) ([rytilahti](https://github.com/rytilahti))
- Add KP115 fixture [\python-kasa#202](python-kasa#202) ([rytilahti](https://github.com/rytilahti))
- Perform initial update only using the sysinfo query [\python-kasa#199](python-kasa#199) ([rytilahti](https://github.com/rytilahti))
- Add real kasa KL430\(UN\) device dump [\python-kasa#192](python-kasa#192) ([iprodanovbg](https://github.com/iprodanovbg))
- Use less strict matcher for kl430 color temperature [\python-kasa#190](python-kasa#190) ([rytilahti](https://github.com/rytilahti))
- Add EP10\(US\) 1.0 1.0.2 fixture [\python-kasa#174](python-kasa#174) ([nbrew](https://github.com/nbrew))
- Add a note about using the discovery target parameter [\python-kasa#168](python-kasa#168) ([leandroreox](https://github.com/leandroreox))
@rytilahti rytilahti mentioned this pull request Sep 23, 2021
rytilahti added a commit to rytilahti/python-kasa that referenced this pull request Sep 23, 2021
The most important enhancements in this release are:
* Support for emeter on strip sockets
* Fix discovery and update() on some devices that do not support multi-module queries (e.g., HS200)
* Improved support for bulbs

[Full Changelog](python-kasa/python-kasa@0.4.0.dev3...0.4.0.dev4)

**Implemented enhancements:**

- HS300 Children plugs have emeter [\python-kasa#64](python-kasa#64)
- Improve emeterstatus API, move into own module [\python-kasa#205](python-kasa#205) ([rytilahti](https://github.com/rytilahti))
- Avoid temp array during encrypt and decrypt [\python-kasa#204](python-kasa#204) ([bdraco](https://github.com/bdraco))
- Add emeter support for strip sockets [\python-kasa#203](python-kasa#203) ([bdraco](https://github.com/bdraco))
- Add own device type for smartstrip children [\python-kasa#201](python-kasa#201) ([rytilahti](https://github.com/rytilahti))
- bulb: allow set\_hsv without v, add fallback ct range [\python-kasa#200](python-kasa#200) ([rytilahti](https://github.com/rytilahti))
- Improve bulb support \(alias, time settings\) [\python-kasa#198](python-kasa#198) ([rytilahti](https://github.com/rytilahti))
- Improve testing harness to allow tests on real devices [\python-kasa#197](python-kasa#197) ([rytilahti](https://github.com/rytilahti))
- cli: add human-friendly printout when calling temperature on non-supported devices [\python-kasa#196](python-kasa#196) ([JaydenRA](https://github.com/JaydenRA))

**Fixed bugs:**

- KL430: Throw error for Device specific information [\python-kasa#189](python-kasa#189)
- dump\_devinfo: handle latitude/longitude keys properly [\python-kasa#175](python-kasa#175) ([rytilahti](https://github.com/rytilahti))

**Closed issues:**

- Feature Request - Toggle Command [\python-kasa#188](python-kasa#188)
- Is It Compatible With HS105? [\python-kasa#186](python-kasa#186)
- Cannot use some functions with KP303 [\python-kasa#181](python-kasa#181)
- Help needed - awaiting game  [\python-kasa#179](python-kasa#179)
- Version inconsistency between CLI and pip [\python-kasa#177](python-kasa#177)
- Release 0.4.0.dev3? [\python-kasa#169](python-kasa#169)
- Discover does not support specifying network interface [\python-kasa#167](python-kasa#167)
- Can't command or query HS200 v5 switch [\python-kasa#161](python-kasa#161)

**Merged pull requests:**

- More CI fixes [\python-kasa#208](python-kasa#208) ([rytilahti](https://github.com/rytilahti))
- Fix CI dep installation [\python-kasa#207](python-kasa#207) ([rytilahti](https://github.com/rytilahti))
- Use github actions instead of azure pipelines [\python-kasa#206](python-kasa#206) ([rytilahti](https://github.com/rytilahti))
- Add KP115 fixture [\python-kasa#202](python-kasa#202) ([rytilahti](https://github.com/rytilahti))
- Perform initial update only using the sysinfo query [\python-kasa#199](python-kasa#199) ([rytilahti](https://github.com/rytilahti))
- Add real kasa KL430\(UN\) device dump [\python-kasa#192](python-kasa#192) ([iprodanovbg](https://github.com/iprodanovbg))
- Use less strict matcher for kl430 color temperature [\python-kasa#190](python-kasa#190) ([rytilahti](https://github.com/rytilahti))
- Add EP10\(US\) 1.0 1.0.2 fixture [\python-kasa#174](python-kasa#174) ([nbrew](https://github.com/nbrew))
- Add a note about using the discovery target parameter [\python-kasa#168](python-kasa#168) ([leandroreox](https://github.com/leandroreox))
rytilahti added a commit that referenced this pull request Sep 23, 2021
* Release 0.4.0.dev4

The most important enhancements in this release are:
* Support for emeter on strip sockets
* Fix discovery and update() on some devices that do not support multi-module queries (e.g., HS200)
* Improved support for bulbs

[Full Changelog](0.4.0.dev3...0.4.0.dev4)

**Implemented enhancements:**

- HS300 Children plugs have emeter [\#64](#64)
- Improve emeterstatus API, move into own module [\#205](#205) ([rytilahti](https://github.com/rytilahti))
- Avoid temp array during encrypt and decrypt [\#204](#204) ([bdraco](https://github.com/bdraco))
- Add emeter support for strip sockets [\#203](#203) ([bdraco](https://github.com/bdraco))
- Add own device type for smartstrip children [\#201](#201) ([rytilahti](https://github.com/rytilahti))
- bulb: allow set\_hsv without v, add fallback ct range [\#200](#200) ([rytilahti](https://github.com/rytilahti))
- Improve bulb support \(alias, time settings\) [\#198](#198) ([rytilahti](https://github.com/rytilahti))
- Improve testing harness to allow tests on real devices [\#197](#197) ([rytilahti](https://github.com/rytilahti))
- cli: add human-friendly printout when calling temperature on non-supported devices [\#196](#196) ([JaydenRA](https://github.com/JaydenRA))

**Fixed bugs:**

- KL430: Throw error for Device specific information [\#189](#189)
- dump\_devinfo: handle latitude/longitude keys properly [\#175](#175) ([rytilahti](https://github.com/rytilahti))

**Closed issues:**

- Feature Request - Toggle Command [\#188](#188)
- Is It Compatible With HS105? [\#186](#186)
- Cannot use some functions with KP303 [\#181](#181)
- Help needed - awaiting game  [\#179](#179)
- Version inconsistency between CLI and pip [\#177](#177)
- Release 0.4.0.dev3? [\#169](#169)
- Discover does not support specifying network interface [\#167](#167)
- Can't command or query HS200 v5 switch [\#161](#161)

**Merged pull requests:**

- More CI fixes [\#208](#208) ([rytilahti](https://github.com/rytilahti))
- Fix CI dep installation [\#207](#207) ([rytilahti](https://github.com/rytilahti))
- Use github actions instead of azure pipelines [\#206](#206) ([rytilahti](https://github.com/rytilahti))
- Add KP115 fixture [\#202](#202) ([rytilahti](https://github.com/rytilahti))
- Perform initial update only using the sysinfo query [\#199](#199) ([rytilahti](https://github.com/rytilahti))
- Add real kasa KL430\(UN\) device dump [\#192](#192) ([iprodanovbg](https://github.com/iprodanovbg))
- Use less strict matcher for kl430 color temperature [\#190](#190) ([rytilahti](https://github.com/rytilahti))
- Add EP10\(US\) 1.0 1.0.2 fixture [\#174](#174) ([nbrew](https://github.com/nbrew))
- Add a note about using the discovery target parameter [\#168](#168) ([leandroreox](https://github.com/leandroreox))

* replace pypy3 with pypy-3.7 as we do not support python3.6 anyway

* skip pypy-3.7 on windows to avoid flaky ci
rytilahti added a commit to rytilahti/python-kasa that referenced this pull request Oct 11, 2021
* Add support for plugs with emeters.

* Tweaks for emeter

* black

* tweaks

* tweaks

* more tweaks

* dry

* flake8

* flake8

* legacy typing

* Update kasa/smartstrip.py

Co-authored-by: Teemu R. <tpr@iki.fi>

* reduce

* remove useless delegation

* tweaks

* tweaks

* dry

* tweak

* tweak

* tweak

* tweak

* update tests

* wrap

* preen

* prune

* prune

* prune

* guard

* adjust

* robust

* prune

* prune

* reduce dict lookups by 1

* Update kasa/smartstrip.py

Co-authored-by: Teemu R. <tpr@iki.fi>

* delete utils

* isort

Co-authored-by: Brendan Burns <brendan.d.burns@gmail.com>
Co-authored-by: Teemu R. <tpr@iki.fi>
rytilahti added a commit to rytilahti/python-kasa that referenced this pull request Oct 11, 2021
* Release 0.4.0.dev4

The most important enhancements in this release are:
* Support for emeter on strip sockets
* Fix discovery and update() on some devices that do not support multi-module queries (e.g., HS200)
* Improved support for bulbs

[Full Changelog](python-kasa/python-kasa@0.4.0.dev3...0.4.0.dev4)

**Implemented enhancements:**

- HS300 Children plugs have emeter [\python-kasa#64](python-kasa#64)
- Improve emeterstatus API, move into own module [\python-kasa#205](python-kasa#205) ([rytilahti](https://github.com/rytilahti))
- Avoid temp array during encrypt and decrypt [\python-kasa#204](python-kasa#204) ([bdraco](https://github.com/bdraco))
- Add emeter support for strip sockets [\python-kasa#203](python-kasa#203) ([bdraco](https://github.com/bdraco))
- Add own device type for smartstrip children [\python-kasa#201](python-kasa#201) ([rytilahti](https://github.com/rytilahti))
- bulb: allow set\_hsv without v, add fallback ct range [\python-kasa#200](python-kasa#200) ([rytilahti](https://github.com/rytilahti))
- Improve bulb support \(alias, time settings\) [\python-kasa#198](python-kasa#198) ([rytilahti](https://github.com/rytilahti))
- Improve testing harness to allow tests on real devices [\python-kasa#197](python-kasa#197) ([rytilahti](https://github.com/rytilahti))
- cli: add human-friendly printout when calling temperature on non-supported devices [\python-kasa#196](python-kasa#196) ([JaydenRA](https://github.com/JaydenRA))

**Fixed bugs:**

- KL430: Throw error for Device specific information [\python-kasa#189](python-kasa#189)
- dump\_devinfo: handle latitude/longitude keys properly [\python-kasa#175](python-kasa#175) ([rytilahti](https://github.com/rytilahti))

**Closed issues:**

- Feature Request - Toggle Command [\python-kasa#188](python-kasa#188)
- Is It Compatible With HS105? [\python-kasa#186](python-kasa#186)
- Cannot use some functions with KP303 [\python-kasa#181](python-kasa#181)
- Help needed - awaiting game  [\python-kasa#179](python-kasa#179)
- Version inconsistency between CLI and pip [\python-kasa#177](python-kasa#177)
- Release 0.4.0.dev3? [\python-kasa#169](python-kasa#169)
- Discover does not support specifying network interface [\python-kasa#167](python-kasa#167)
- Can't command or query HS200 v5 switch [\python-kasa#161](python-kasa#161)

**Merged pull requests:**

- More CI fixes [\python-kasa#208](python-kasa#208) ([rytilahti](https://github.com/rytilahti))
- Fix CI dep installation [\python-kasa#207](python-kasa#207) ([rytilahti](https://github.com/rytilahti))
- Use github actions instead of azure pipelines [\python-kasa#206](python-kasa#206) ([rytilahti](https://github.com/rytilahti))
- Add KP115 fixture [\python-kasa#202](python-kasa#202) ([rytilahti](https://github.com/rytilahti))
- Perform initial update only using the sysinfo query [\python-kasa#199](python-kasa#199) ([rytilahti](https://github.com/rytilahti))
- Add real kasa KL430\(UN\) device dump [\python-kasa#192](python-kasa#192) ([iprodanovbg](https://github.com/iprodanovbg))
- Use less strict matcher for kl430 color temperature [\python-kasa#190](python-kasa#190) ([rytilahti](https://github.com/rytilahti))
- Add EP10\(US\) 1.0 1.0.2 fixture [\python-kasa#174](python-kasa#174) ([nbrew](https://github.com/nbrew))
- Add a note about using the discovery target parameter [\python-kasa#168](python-kasa#168) ([leandroreox](https://github.com/leandroreox))

* replace pypy3 with pypy-3.7 as we do not support
7CFC
 python3.6 anyway

* skip pypy-3.7 on windows to avoid flaky ci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HS300 Children plugs have emeter
4 participants
0