Skip to content

0.9.0 - API change for stick - #55

Merged
brefra merged 78 commits into
mainfrom
refactor_stick_api
Jan 23, 2021
Merged

brefra merged 78 commits into
mainfrom
refactor_stick_api

Conversation

@brefra

@brefra brefra commented Dec 31, 2020 •

Copy link
Copy Markdown
Contributor

This PR is based on #53, so that one needs to be merged first.

  • Improvement: Debounce relay state
  • Improvement: Prioritize request so requests like switching a relay get send out before power measurement requests.
  • Improvement: Dynamically change the refresh interval based on the actual discovered nodes with power measurement capabilities
  • Added: New property attributes for USB-stick.
    The old methods are still available but will give a deprecate warning
    • Stick
      • devices (dict) - All discovered and supported plugwise devices with the MAC address as their key
      • joined_nodes (integer) - Total number of registered nodes at Plugwise Circle+
      • mac (string) - The MAC address of the USB-Stick
      • network_state (boolean) - The state (on-line/off-line) of the Plugwise network.
      • network_id (integer) - The ID of the Plugwise network.
      • port (string) - The port connection string
    • All plugwise devices
      • available (boolean) - The current network availability state of the device
      • battery_powered (boolean) - Indicates if device is battery powered
      • features (tuple) - List of supported attribute IDs
      • firmware_version (string) - Firmware version device is running
      • hardware_model (string) - Hardware model name
      • hardware_version (string) - Hardware version of device
      • last_update (datetime) - Date/time stamp of last received update from device
      • mac (string) - MAC address of device
      • measures_power (boolean) - Indicates if device supports power measurement
      • name (string) - Name of device based om hardware model and MAC address
      • ping (integer) - Network roundtrip time in milliseconds
      • rssi_in (DBm) - Inbound RSSI level
      • rssi_out (DBm) - Outbound RSSI level based on the received inbound RSSI level of the neighbor node
    • Scan devices
      • motion (boolean) - Current detection state of motion.
    • Sense devices
      • humidity (integer) - Last reported humidity value.
      • temperature (integer) - Last reported temperature value.
    • Circle/Circle+/Stealth devices
      • current_power_usage (float) - Current power usage (Watts) during the last second
      • current_power_usage_8_sec (float) - Current power usage (Watts) during the last 8 seconds
      • power_consumption_current_hour (float) - Total power consumption (kWh) this running hour
      • power_consumption_previous_hour (float) - Total power consumption (kWh) during the previous hour
      • power_consumption_today (float) - Total power consumption (kWh) of today
      • power_consumption_yesterday (float) - Total power consumption (kWh) during yesterday
      • power_production_current_hour (float) - Total power production (kWh) this hour
      • relay_state (boolean) - State of the output power relay. Setting this property will operate the relay
    • Switch devices
      • switch (boolean) - Last reported state of switch

@codecov

codecov Bot commented Dec 31, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #55 (6e9e962) into main (b0bb0be) will not change coverage.
The diff coverage is 96.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #55   +/-   ##
=======================================
  Coverage   96.28%   96.28%           
=======================================
  Files           4        4           
  Lines        1588     1588           
=======================================
  Hits         1529     1529           
  Misses         59       59           
Impacted Files Coverage Δ
plugwise/smile.py 94.20% <80.00%> (ø)
plugwise/constants.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 b0bb0be...6e9e962. Read the comment docs.


env:
CACHE_VERSION: 1
CACHE_VERSION: 2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's double check on merge as one of the other PRs has this set as well

Comment thread plugwise/nodes/sense.py
def _process_sense_report(self, message):
""" process sense report message to extract current temperature and humidity values """
"""process sense report message to extract current temperature and humidity values."""
if message.temperature.value != 65535:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe start with a return, loosening on complexity?

if message.temperature == 65535 or ...humidity == :
  return

Comment thread plugwise/smile.py Resolved
Comment thread plugwise/smile.py Resolved
Comment thread plugwise/stick.py Resolved
Comment thread plugwise/stick.py
if self._plugwise_nodes.get(mac):
self._plugwise_nodes[mac].message_for_node(message)
return True
if discover:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If not discover return false (returning early)

@CoMPaTech CoMPaTech left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No full review (as in rather large) but left some small naggs, but they can be ignored (they might apply on other parts of the code though)

@brefra
brefra force-pushed the refactor_stick_api branch from cb01bf4 to 4852972 Compare January 11, 2021 19:39
Comment thread plugwise/nodes/__init__.py Resolved
@brefra
brefra marked this pull request as ready for review January 23, 2021 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants