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/4425c2a4-0faf-4f36-9c74-9439e097ee7cn%40googlegroups.com.

Reply via email to