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

No updates when used with Single Phase meter #2

Open
unifiedcommsguy opened this issue Jun 27, 2021 · 1 comment
Open

No updates when used with Single Phase meter #2

unifiedcommsguy opened this issue Jun 27, 2021 · 1 comment

Comments

@unifiedcommsguy
Copy link

unifiedcommsguy commented Jun 27, 2021

Had issues where single phase meter would not work as it would error when trying to retrieve the second phase details.

Amended def _update(self) as follows to zero out said variables for single phase meters:

def _update(self):
URL = "http://x.x.x.x/solar_api/v1/GetMeterRealtimeData.cgi?Scope=Device&DeviceId=0&DataCollection=MeterRealtimeData"
meter_r = requests.get(url = URL)
meter_data = meter_r.json()
MeterModel = meter_data['Body']['Data']['Details']['Model']

if str(MeterModel) == 'Smart Meter 63A-1':
MeterConsumption = meter_data['Body']['Data']['PowerReal_P_Sum']
self._dbusservice['/Ac/Power'] = MeterConsumption # positive: consumption, negative: feed into grid
self._dbusservice['/Ac/L1/Voltage'] = meter_data['Body']['Data']['Voltage_AC_Phase_1']
self._dbusservice['/Ac/L2/Voltage'] = 0
self._dbusservice['/Ac/L3/Voltage'] = 0
self._dbusservice['/Ac/L1/Current'] = meter_data['Body']['Data']['Current_AC_Phase_1']
self._dbusservice['/Ac/L2/Current'] = 0
self._dbusservice['/Ac/L3/Current'] = 0
self._dbusservice['/Ac/L1/Power'] = meter_data['Body']['Data']['PowerReal_P_Phase_1']
self._dbusservice['/Ac/L2/Power'] = 0
self._dbusservice['/Ac/L3/Power'] = 0
self._dbusservice['/Ac/Energy/Forward'] = meter_data['Body']['Data']['EnergyReal_WAC_Sum_Consumed']
self._dbusservice['/Ac/Energy/Reverse'] = meter_data['Body']['Data']['EnergyReal_WAC_Sum_Produced']
else:
MeterConsumption = meter_data['Body']['Data']['PowerReal_P_Sum']
self._dbusservice['/Ac/Power'] = MeterConsumption # positive: consumption, negative: feed into grid
self._dbusservice['/Ac/L1/Voltage'] = meter_data['Body']['Data']['Voltage_AC_Phase_1']
self._dbusservice['/Ac/L2/Voltage'] = meter_data['Body']['Data']['Voltage_AC_Phase_2']
self._dbusservice['/Ac/L3/Voltage'] = meter_data['Body']['Data']['Voltage_AC_Phase_3']
self._dbusservice['/Ac/L1/Current'] = meter_data['Body']['Data']['Current_AC_Phase_1']
self._dbusservice['/Ac/L2/Current'] = meter_data['Body']['Data']['Current_AC_Phase_2']
self._dbusservice['/Ac/L3/Current'] = meter_data['Body']['Data']['Current_AC_Phase_3']
self._dbusservice['/Ac/L1/Power'] = meter_data['Body']['Data']['PowerReal_P_Phase_1']
self._dbusservice['/Ac/L2/Power'] = meter_data['Body']['Data']['PowerReal_P_Phase_2']
self._dbusservice['/Ac/L3/Power'] = meter_data['Body']['Data']['PowerReal_P_Phase_3']
self._dbusservice['/Ac/Energy/Forward'] = meter_data['Body']['Data']['EnergyReal_WAC_Sum_Consumed']
self._dbusservice['/Ac/Energy/Reverse'] = `meter_data['Body']['Data']['EnergyReal_WAC_Sum_Produced']

logging.info("House Consumption: %s" % (MeterConsumption))
return True

@RalfZim
Copy link
Owner

RalfZim commented Mar 24, 2022

@unifiedcommsguy Just implemented and pushed a modified fix.
Please check if this works for you.
If so, please close this issue.

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

No branches or pull requests

2 participants