after installing (*weewx-GTS extension*) also followed the instructions on 
this post, we have one more question which is how to get these numbers to 
be displayed in *Kilowatt hour* instead of *Watt hour.*
we added the tag *"electricity"* to *current.inc* and it gets generated 
like the image below:

[image: elect.png]
also added the tag *"electricity"* to *NOAA monthly report* and it gets 
generated like the image below:

[image: noaa_report.png]

thank you
On Thursday, September 8, 2022 at 10:21:50 AM UTC+3 gjr80 wrote:

> Judging by the plot you posted earlier and the above database extract 
> those figures are also certainly in kW not kWh. They are certainly not 
> cumulative and to be using 21kWh in a five minute period is is unlikely 
> unless you are talking about some sort of industrial application.
>
> In that case you have a few choices. As kk4468460 mentioned you could 
> install her weewx-GTS extension <https://github.com/roe-dl/weewx-GTS> and 
> it would allow you to use a tag such as $month.electricity.energy_integral 
> to display the month-to-date electricity usage. This would necessitate some 
> changes to the code I provided above. In extensions.py you would now need 
> something like (untested):
>
> import weewx.units
>
> # override the default units for group_power and set to kW
> weewx.units.USUnits['group_power'] = 'kilowatt'
> weewx.units.MetricUnits['group_power'] = 'kilowatt'
> weewx.units.MetricWXUnits['group_power'] = 'kilowatt'
>
> # assign database field electricity to group_power
> weewx.units.obs_group_dict['electricity'] = 'group_power'
>
> This tells WeeWX that field electricity contains power values in kW. The 
> other code that was removed is superfluous given weewx-GTS is being used.
>
> Your template code then becomes (again untested):
>
> #if $month.electricity.has_data and $month.electricity.energy_integral.raw 
> is not None
> #set $mtd_cost = round($month.electricity.energy_integral.raw * 0.20, 2)
> #else
> #set $mtd_cost = '---'
> #end if
> Usage this month: $month.electricity.energy_integral
> Cost this month: $ $mtd_cost
>
> In this case we have substituted $month.electricity.energy_integral.raw 
> of $month.electricity.sum.raw and slightly altered the check for 
> electricity usage data, but otherwise it is largely the same.
>
> I mentioned some other approaches, these will largely involve writing some 
> python code to extend WeeWX or funding some calculations using the WeeWX 
> StdCalibrate service. Despite only a very small part of weewx-GTS being 
> used I think it is a better approach.
>
> Gary
> On Wednesday, 7 September 2022 at 23:14:24 UTC+10 [email protected] wrote:
>
>> the addition to  extensions.py worked this time.
>>
>> regarding the data produced by the SDR driver is in agreement with the 
>> display ( the display shows "kw") 
>>
>> [image: consum.png]
>>
>> in weewx database these numbers are stored there (parts of these data are 
>> below)
>>
>> dateTime     usUnits interval   electricity
>> 1662544500    1    5    11.1180575
>> 1662545100    1    5    3.4304875
>> 1662545700    1    5    18.377194
>> 1662546000    1    5    6.157195
>> 1662546300    1    5    14.887015
>> 1662546600    1    5    15.50398667
>> 1662546900    1    5    11.88355667
>> 1662547200    1    5    11.76374833
>> 1662547500    1    5    11.74191333
>> 1662547800    1    5    11.86812
>> 1662548100    1    5    4.113761667
>> 1662548400    1    5    20.969465
>> 1662548700    1    5    0.551613333
>> 1662549000    1    5    13.065745
>> 1662549300    1    5    14.59239833
>> 1662549600    1    5    3.075086667
>> 1662549900    1    5    18.3986
>> 1662550200    1    5    9.164375
>> 1662550500    1    5    12.008095
>> 1662550800    1    5    10.84667833
>> 1662551100    1    5    14.874585
>> 1662551400    1    5    0.549743333
>> 1662551700    1    5    14.52300667
>> 1662552000    1    5    0.55561
>> 1662552300    1    5    7.805838333
>> 1662552600    1    5    21.9475575
>> 1662552900    1    5    8.644086
>> 1662553200    1    5    13.64986333
>> 1662553500    1    5    10.8020275
>> 1662553800    1    5    13.393798
>> 1662554100    1    5    11.498542
>>
>> we need to calculate the monthly kw used and regarding the cost issue , 
>> excel with some future calibration to data should make it close enough for 
>> our like
>>
>> thank you
>>
>>
>> On Wednesday, September 7, 2022 at 3:22:46 PM UTC+3 gjr80 wrote:
>>
>>> My mistake, I forgot an import. Try adding the following line before the 
>>> extensions.py code I listed previously:
>>>
>>> import weewx.units
>>>
>>> As for what is being stored in WeeWX field electricity it's not clear 
>>> to me whether it is kW or kWh. The former is a measure of power and the 
>>> latter a measure of energy (or power used over a period of time) - quite 
>>> different things. Your first post was not clear, your second post seemed to 
>>> confirm it was kWh and the last post seems to indicate it is kW. You need a 
>>> value in kWh otherwise you Efergy display and WeeWX may agree, but your 
>>> cost calculation will be nonsense.
>>>
>>> Gary
>>>
>>> On Wednesday, 7 September 2022 at 21:45:00 UTC+10 [email protected] 
>>> wrote:
>>>
>>>> The sensor signal contain Amps reading which is analyzed by *rtl_433* 
>>>> but we adjusted the *SDR driver* to convert and send *KW* instead, 
>>>> which is what the lcd display is showing and the *SDR driver* is 
>>>> sending KW reading to weewx every 20 seconds, we should have mentioned 
>>>> this 
>>>> earlier (our apology).
>>>>
>>>> the 1st part of Gary suggestion was added to current.inc but the 2nd 
>>>> part crashed weewx when we added the code to extensions.py
>>>> we stopped weewx and run it again but failed to start with following 
>>>> error:
>>>>
>>>> Sep  7 13:00:02 Mks systemd[1]: Starting LSB: weewx weather system...
>>>> Sep  7 13:00:02 Mks weewx[28024]: Starting weewx weather system: weewx
>>>> Sep  7 13:00:02 Mks weewx[28034]: Traceback (most recent call last):
>>>> Sep  7 13:00:02 Mks weewx[28034]:   File "/usr/share/weewx/weewxd", 
>>>> line 29, in <module>
>>>> Sep  7 13:00:02 Mks weewx[28034]:     import user.extensions
>>>> Sep  7 13:00:02 Mks weewx[28034]:   File 
>>>> "/usr/share/weewx/user/extensions.py", line 20, in <module>
>>>> Sep  7 13:00:02 Mks weewx[28034]:     
>>>> weewx.units.USUnits['group_energy'] = 'kilo_watt_hour'
>>>> Sep  7 13:00:02 Mks weewx[28034]: NameError: name 'weewx' is not defined
>>>> Sep  7 13:00:02 Mks weewx[28035]:  failed!
>>>> Sep  7 13:00:02 Mks systemd[1]: weewx.service: Control process exited, 
>>>> code=exited, status=1/FAILURE
>>>> Sep  7 13:00:02 Mks systemd[1]: weewx.service: Failed with result 
>>>> 'exit-code'.
>>>>
>>>> we appreciate you all for your usual help and support.
>>>> On Wednesday, September 7, 2022 at 1:46:32 PM UTC+3 [email protected] 
>>>> wrote:
>>>>
>>>>> [email protected] schrieb am Mittwoch, 7. September 2022 um 05:01:53 
>>>>> UTC+2:
>>>>>
>>>>>> yes it is kilowatt-hours (kw) the kit is made by efergy
>>>>>
>>>>>
>>>>> kilowatt-hours and kw is not the same.
>>>>>
>>>>> power: kilowatt kW 
>>>>> energy: kilowatt-hours kWh 
>>>>>
>>>>> It is essential to know what of them the device supplies, because the 
>>>>> calculation is quite different if you have one or the other. In case it 
>>>>> is 
>>>>> *energy* (in kilowatt-hours kWh) you need to sum up the values as 
>>>>> said by Tom and Gary. In case it is *accumulated energy* (in 
>>>>> kilowatt-hours kWh, too) you need to calculate the difference as 
>>>>> described 
>>>>> by Tom and Gary, too. In case it is *power* you need to *integrate* the 
>>>>> readings over time to get the total energy. The latter can be done by 
>>>>> energy_integral aggregation type provided by the weewx-GTS extension.
>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/62a129b6-35bb-4c68-ad25-df466f6caf69n%40googlegroups.com.

Reply via email to