Skip to content

[switch.wemo] Fix mW to kW conversion.#6826

Merged
pvizeli merged 2 commits into
devfrom
fix-wemo
Mar 28, 2017
Merged

[switch.wemo] Fix mW to kW conversion.#6826
pvizeli merged 2 commits into
devfrom
fix-wemo

Conversation

@lwis
Copy link
Copy Markdown
Member

@lwis lwis commented Mar 28, 2017

Description:

Conversion was wrong.

8954105 mW should convert to 8.954105 kW, not 8954.105 kW.

@mention-bot
Copy link
Copy Markdown

@lwis, thanks for your PR! By analyzing the history of the files in this pull request, we identified @pavoni, @balloob and @fabaff to be potential reviewers.

Comment thread homeassistant/components/switch/wemo.py Outdated
"""Today total energy usage in kWh."""
if self.insight_params:
return convert(self.insight_params['todaymw'], float, 0.0) / 1000.0
return convert(self.insight_params['todaymw'], float, 0.0) / 1000000.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (82 > 79 characters)

@pvizeli pvizeli merged commit 6dba05c into dev Mar 28, 2017
@pavoni
Copy link
Copy Markdown
Contributor

pavoni commented Mar 28, 2017

This was certainly wrong - but don't think this completely fixes it.

Hadn't finished digging - but I think wemo reports this in milliwatt minutes. So I think we probably also need to multiply by 60.

@lwis
Copy link
Copy Markdown
Member Author

lwis commented Mar 28, 2017

@pavoni I'm not sure I understand. That'll turn this calculation into 537 kW which is also very wrong.

@pavoni
Copy link
Copy Markdown
Contributor

pavoni commented Mar 28, 2017

Sorry my description was wrong

    @property
    def today_energy_kwh(self):
        """Today total energy usage in kWh."""
        if self.insight_params:
            return convert(self.insight_params['todaymw'], float, 0.0) / (1000.0 * 1000.0 * 60)

@lwis
Copy link
Copy Markdown
Member Author

lwis commented Mar 28, 2017

@pavoni that looks much better, 0.14kW.

@lwis lwis deleted the fix-wemo branch March 29, 2017 16:06
@fabaff fabaff mentioned this pull request Apr 6, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Jul 17, 2017
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.

6 participants