Skip to content

Add additional Netatmo public data sensors#16671

Merged
Danielhiversen merged 1 commit intohome-assistant:devfrom
GP8x:additional-netatmo-public
Sep 25, 2018
Merged

Add additional Netatmo public data sensors#16671
Danielhiversen merged 1 commit intohome-assistant:devfrom
GP8x:additional-netatmo-public

Conversation

@GP8x
Copy link
Copy Markdown
Contributor

@GP8x GP8x commented Sep 17, 2018

Description:

I updated the pyatmo library to expose additional conditions from the Netatmo GetPublicData API in this PR: jabesq/netatmo-api-python#15

This PR extends the HomeAssistant Netatmo Public sensor to monitor the following conditions:

  • temperature
  • pressure
  • humidity
  • rain
  • windstrength
  • guststrength

In order to change from a single value sensor to multi-value I made a breaking change to the configuration to add in a monitored_conditions list for each "area". At the same time I also changed the current optional type configuration property to mode as type to me didn't accurately describe the function the value performs (switching between avg and max sensor data processing). I realize breaking configuration changes are generally not a good thing but believe the above approach is more extensible for the future and better aligns the sensor configuration with other multi-condition sensors (e.g. Yahoo Weather).

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#6303

Example entry for configuration.yaml (if applicable):

sensor:
  - platform: netatmo_public
    areas:
      - lat_ne: 40.719
        lon_ne: -73.735
        lat_sw: 40.552
        lon_sw: -74.105
        monitored_conditions:
          - temperature
          - pressure
          - humidity
          - rain
          - windstrength
          - guststrength

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.

Copy link
Copy Markdown
Member

@Danielhiversen Danielhiversen left a comment

Choose a reason for hiding this comment

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

Great 🎉

LON_NE=self.lon_ne,
LAT_SW=self.lat_sw,
LON_SW=self.lon_sw,
filtering=True)
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.

What is filtering?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Filtering makes the API response exclude abnormal sensor readings. For example if someone installs an outside sensor indoors.

@Danielhiversen
Copy link
Copy Markdown
Member

@colinfrei Any comments?

@Danielhiversen Danielhiversen merged commit 03bce84 into home-assistant:dev Sep 25, 2018
@ghost ghost removed the in progress label Sep 25, 2018

if self.netatmo_data.data is None:
_LOGGER.warning("No data found for %s", self._name)
self._state = STATE_UNKNOWN
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.

We should use None to represent unknown state.

@colinfrei
Copy link
Copy Markdown
Contributor

Hi - sorry for the late response.
Looks good to me, and the breaking change makes sense. I'm probably the wrong person to evaluate the code itself though :)
Happy to see this expanded on - thanks @GP8x!

@balloob balloob mentioned this pull request Oct 12, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Feb 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants