Skip to content
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

Draft: Test of handling cost unit as a divisor #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jrouvier
Copy link
Owner

No description provided.

@@ -333,7 +333,7 @@ class EmporiaVueUtility : public Component, public UARTDevice {
}

// Handle if a meter divisor is in effect
watt_hours = (float)watt_hours_raw * (float)meter_div;
watt_hours = (float)watt_hours_raw * ((float)meter_div / ((float)mr->cost_unit / 1000));
Copy link
Contributor

@baudneo baudneo Jun 28, 2023

Choose a reason for hiding this comment

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

watt_hours = (float)watt_hours_raw * (float)meter_div;
ESP_LOGD(TAG, "Wh after multiply by meter divisor (%f): %.3f", (float)meter_div, watt_hours);
watt_hours = watt_hours / (cost_unit / 1000);
ESP_LOGD(TAG, "Wh after divide by cost unit (%d): %.3f", cost_unit / 1000, watt_hours);

@@ -421,7 +421,7 @@ class EmporiaVueUtility : public Component, public UARTDevice {
}

// Handle if a meter divisor is in effect
watts = (float)watts_raw * (float)meter_div;
watts = (float)watts_raw * ((float)meter_div / ((float)mr->cost_unit / 1000));
Copy link
Contributor

@baudneo baudneo Jun 28, 2023

Choose a reason for hiding this comment

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

watts = (float)watts_raw * (float)meter_div;
ESP_LOGD(TAG, "Watts after multiply by meter divisor (%f): %.2f", (float)meter_div, watts);
watts = watts / (cost_unit / 1000);
ESP_LOGD(TAG, "Watts after divide by cost unit (%d): %.2f", cost_unit / 1000, watts);

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.

None yet

2 participants