RFXPwr

Forum about Rfxcom home automation Domotica devices.

Moderator: b_weijenberg

Post Reply
User avatar
Willem4ever
Global Moderator
Global Moderator
Posts: 805
Joined: Mon Oct 30, 2006 3:48 pm
Location: Uithoorn / Netherlands

RFXPwr

Post by Willem4ever »

Maybe it has been asked before .... I'm using so called 'dag en nachttarief' and I'm wondering if it is possible with the homeseer plug-in to actually get two meters showing those tarifs using a RFXPulse counting pulses from the utility meter.
User avatar
b_weijenberg
Forum Moderator
Forum Moderator
Posts: 1746
Joined: Sun May 14, 2006 4:32 pm
Location: Netherlands

RFXPwr

Post by b_weijenberg »

That would be possible. But you have to be sure that the counter value must stay in sync with the LED status.
Use the even/odd counter value to set the parameters in the hspi_RFXCOM.ini to the current cost to be used.

Trigger an event on value change and start a script.
The script must look like this:

if value is odd then
hs.SaveINISetting("RFXPower", "StandardCharge", "0,25", "hspi_RFXCOM.ini")
hs.SaveINISetting("RFXPower", "AlternativeCharge", "0,25", "hspi_RFXCOM.ini")
else
hs.SaveINISetting("RFXPower", "StandardCharge", "0,20", "hspi_RFXCOM.ini")
hs.SaveINISetting("RFXPower", "AlternativeCharge", "0,20", "hspi_RFXCOM.ini")
end if
Alexander
Global Moderator
Global Moderator
Posts: 1532
Joined: Sat Mar 10, 2007 11:19 pm
Location: Netherlands

RFXPwr

Post by Alexander »

Yes, that's is what i'm wondering for, for a long time. Why does the plugin saves the charge into every record in the database? Why not calculate it in the gui when the stats are presented?
User avatar
b_weijenberg
Forum Moderator
Forum Moderator
Posts: 1746
Joined: Sun May 14, 2006 4:32 pm
Location: Netherlands

RFXPwr

Post by b_weijenberg »

Tariffs are changing not only with day/night tariffs but also when changing the contract or at price updates by the contractor.
This is the reason to store the kWh price in the database.
Alexander
Global Moderator
Global Moderator
Posts: 1532
Joined: Sat Mar 10, 2007 11:19 pm
Location: Netherlands

RFXPwr

Post by Alexander »

okay. principal speaking: it's alot of overhead which could be resolved by adding an extra table and defining that attributes. It will cost more time to adjust the scripts. So i can image why you'd choosen for this.

The script/plugin already writes the different charges when you have a night and day charge to the database. So why would you change the ini?
User avatar
b_weijenberg
Forum Moderator
Forum Moderator
Posts: 1746
Joined: Sun May 14, 2006 4:32 pm
Location: Netherlands

RFXPwr

Post by b_weijenberg »

There are several reasons to store the cost in each record and not use a different table. This has been decided in the past based on arguments. What to think of weekend tariff and general holidays.

willem4ever would like to have tariffs based on the displayed status on the utility meter and not on time base as given in the ini. To be able to use the standard sampling scripts it is the most effective way to do it this way. Any better solution is appreciated.
User avatar
Willem4ever
Global Moderator
Global Moderator
Posts: 805
Joined: Mon Oct 30, 2006 3:48 pm
Location: Uithoorn / Netherlands

RFXPwr

Post by Willem4ever »

This applies to the charts only, not quiet what I meant ...
I would like to see 2 counters, 1 counting standard, and 1 counting alternative. Those counters should reflect the counters on my kWh meter. I guess this should be doable with a virtual counter ....
Sooty
Member
Member
Posts: 204
Joined: Sat Mar 22, 2008 11:29 pm
Location: United Kingdom

RFXPwr

Post by Sooty »

Perhaps I don't fully understand the original question.

Do you have just a single meter and the tariff changes at different times? If so, then I suppose the standard scripts will take care of the tariff changes and the cost data.

If you want to chart the day and night units individually, then you will need to use 2 virtual devices and have these incremented depending on the time of day. You could leave the original RFXMeter device as a total. If you are using RFXCharts, I could add the functionality to increment the virtual devices automatically.

I could easily change the recording script to read the 2 virtual devices and treat them as 2 bars on the chart, like using 2 RFXMeters.

Paul..
Alexander
Global Moderator
Global Moderator
Posts: 1532
Joined: Sat Mar 10, 2007 11:19 pm
Location: Netherlands

RFXPwr

Post by Alexander »

Sooty,

Alot of people over here do have a meter with two different tariffs. One for Day and one for Night. Willems asks if it is possible to have two devices like the meter itself. I was wondering about this too. I think the script has to be adjusted to change the records to be written to the database and change the value of the two devices.
Sooty
Member
Member
Posts: 204
Joined: Sat Mar 22, 2008 11:29 pm
Location: United Kingdom

RFXPwr

Post by Sooty »

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by mgizmo</i>
<br />Sooty,

Alot of people over here do have a meter with two different tariffs. One for Day and one for Night. Willems asks if it is possible to have two devices like the meter itself. I was wondering about this too. I think the script has to be adjusted to change the records to be written to the database and change the value of the two devices.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

You can quite easily have 2 Homeseer counter devices for day and night.

Create 2 new status only devices for day and night.
Create a script that is triggered on device value change of the RFXPulse or RFXPwr.

Use an ini file or global variable to hold the RFXMeter's last value. In the script, count the units used since last change, work out if it is day or night and add the used units to the appropriate virtual counter. Finally update the last reading in the ini file or global variable ready for the next update.

The only problem I can forsee is if the RFXMeter is set for a long update interval, then the readings may be wrong around the tariff change times.

Paul..
User avatar
Willem4ever
Global Moderator
Global Moderator
Posts: 805
Joined: Mon Oct 30, 2006 3:48 pm
Location: Uithoorn / Netherlands

RFXPwr

Post by Willem4ever »

Below little script did it for me. Currently it is not taking holidays into account. Trying to get hold of a ripple control receiver to trigger to ripples broadcasted by the utility company.



Imports System.IO
Imports System.Net
Imports System.Text

Sub Main(parms As Object)

const rfxpwr = "]17"
const counter1 = "V10"
const counter2 = "V11"

Dim now As DateTime = DateTime.Now
dim tcounter as long
dim ocounter as long
dim r1counter as long
dim r2counter as long
dim value as long

tcounter = hs.DeviceValue(rfxpwr) ' get current count
'hs.WriteLog ("info", Cstr(tcounter))

ocounter = CLng (hs.GetIniSetting ("RFXPower", "counter", "0" , "hspi_RFXCOM.ini") ) ' get prior count
hs.SaveINISetting("RFXPower", "counter",Cstr( tcounter) , "hspi_RFXCOM.ini") ' save current count

If hs.IsWeekday(now.Date) and now.Hour >= 7 and now.Hour < 23 Then
r1counter = CLng (hs.GetIniSetting ("RFXPower", "r1counter", "0" , "hspi_RFXCOM.ini") ) ' get prior count
value = r1counter + (tcounter - ocounter)
hs.SetDeviceValueEx (counter1, value , False)
hs.SetDeviceString (counter1, "<img src='RFXCOM\images\meter.gif'> " & value/1000 & " kWh", True)
hs.SaveINISetting("RFXPower", "r1counter",Cstr( value) , "hspi_RFXCOM.ini") ' save current count
Else
r2counter = CLng (hs.GetIniSetting ("RFXPower", "r2counter", "0" , "hspi_RFXCOM.ini") ) ' get prior count
value = r2counter + (tcounter - ocounter)
hs.SetDeviceValueEx (counter2, value , False)
hs.SetDeviceString (counter2, "<img src='RFXCOM\images\meter.gif'> " & value/1000 & " kWh", True)
hs.SaveINISetting("RFXPower", "r2counter",Cstr( value) , "hspi_RFXCOM.ini") ' save current count
End If

'hs.WriteLog ("info", Cstr(value))
hs.WriteLog ("info", "Counter1 " & Cstr( hs.DeviceValue(counter1) ) )
hs.WriteLog ("info", "Counter2 " & Cstr( hs.DeviceValue(counter2) ) )

End Sub
Sooty
Member
Member
Posts: 204
Joined: Sat Mar 22, 2008 11:29 pm
Location: United Kingdom

RFXPwr

Post by Sooty »

Thats just about the way I would have done it.

Paul..
User avatar
Willem4ever
Global Moderator
Global Moderator
Posts: 805
Joined: Mon Oct 30, 2006 3:48 pm
Location: Uithoorn / Netherlands

RFXPwr

Post by Willem4ever »

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by sooty</i>
<br />Thats just about the way I would have done it.
Paul..
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

Ideally the timeclause should be replaced with the state of a ripple receiver ... to be fully synchronized with the real world. ( I don't have a tariff state led on my kWh meter, just a LCD display)
Post Reply

Return to “Rfxcom Receivers & Transmitters Forum”