Skip to content

Add IlluminanceMeasurementSensor to ZHA#14563

Merged
rcloran merged 4 commits intohome-assistant:devfrom
dmulcahey:dm/lux-sensor
May 21, 2018
Merged

Add IlluminanceMeasurementSensor to ZHA#14563
rcloran merged 4 commits intohome-assistant:devfrom
dmulcahey:dm/lux-sensor

Conversation

@dmulcahey
Copy link
Copy Markdown
Contributor

Description:

add support for devices that report illuminance measurements

@fabaff fabaff changed the title zha: add IlluminanceMeasurementSensor Add IlluminanceMeasurementSensor to ZHA May 20, 2018

class IlluminanceMeasurementSensor(Sensor):
"""ZHA lux sensor."""

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 value attribute here?

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.

it's defined as 0 in parent class Sensor

@property
def state(self):
"""Return the state of the entity."""
if self._state is None:
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.

The isn't needed. Just return self._state

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.

Was just following what other sensors were doing already. I can change this though. I’ll get it updated soon.

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 the state is already None this condition is useless.

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.

I get it... hence why I said I'd change it.

Comment thread homeassistant/components/sensor/zha.py Outdated
return None

return round(float(self._state))
return round(float(self._state)) No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

no newline at end of file

Comment thread homeassistant/components/sensor/zha.py Outdated
"""Return the state of the entity."""
return self._state


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

blank line contains whitespace

@rcloran rcloran merged commit a183043 into home-assistant:dev May 21, 2018
dmulcahey added a commit to dmulcahey/home-assistant that referenced this pull request May 26, 2018
* add IlluminanceMeasurementSensor

* address review comment

* Fix whitespace error during merge
fabaff pushed a commit that referenced this pull request May 26, 2018
* Add electrical measurement sensor

* correct state update

* hound fix

* zha: Add metering sensor (#14562)

* Add IlluminanceMeasurementSensor to ZHA (#14563)

* add IlluminanceMeasurementSensor

* address review comment

* Fix whitespace error during merge

* Add electrical measurement sensor

* correct state update

* hound / flake8
@balloob balloob mentioned this pull request Jun 8, 2018
girlpunk pushed a commit to girlpunk/home-assistant that referenced this pull request Sep 4, 2018
* add IlluminanceMeasurementSensor

* address review comment

* Fix whitespace error during merge
girlpunk pushed a commit to girlpunk/home-assistant that referenced this pull request Sep 4, 2018
* Add electrical measurement sensor

* correct state update

* hound fix

* zha: Add metering sensor (home-assistant#14562)

* Add IlluminanceMeasurementSensor to ZHA (home-assistant#14563)

* add IlluminanceMeasurementSensor

* address review comment

* Fix whitespace error during merge

* Add electrical measurement sensor

* correct state update

* hound / flake8
@home-assistant home-assistant locked and limited conversation to collaborators Sep 5, 2018
@dmulcahey dmulcahey deleted the dm/lux-sensor branch December 26, 2018 12:12
@ghost ghost removed the platform: sensor.zha label Mar 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed integration: zha small-pr PRs with less than 30 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants