XBOS Docs
Search…
PV Meter
Interface: i.xbos.pv_meter
Description: Standard XBOS photovoltaic interface
PONUM: 2.1.1.6

Properties

Name
Type
Description
Units
Required
current_power
double
Current power generated
W
true
time
integer
nanoseconds since the Unix epoch
ns
true
total_energy_lifetime
double
Energy produced over Enphase lifetime
Wh
false
total_energy_today
double
Energy produced today
Wh
false

Signals

    info:
      current_power
      total_energy_lifetime
      total_energy_today
      time

Slots

Interfacing in Go

1
package main
2
3
import (
4
"fmt"
5
bw2 "gopkg.in/immesys/bw2bind.v5"
6
)
7
8
func main() {
9
client := bw2.ConnectOrExit("")
10
client.OverrideAutoChainTo(true)
11
client.SetEntityFromEnvironOrExit()
12
13
base_uri := "PV Meter uri goes here ending in i.xbos.pv_meter"
14
15
// subscribe
16
type signal struct {
17
Current_power float64 `msgpack:"current_power"`
18
Total_energy_lifetime float64 `msgpack:"total_energy_lifetime"`
19
Total_energy_today float64 `msgpack:"total_energy_today"`
20
Time int64 `msgpack:"time"`
21
}
22
c, err := client.Subscribe(&bw2.SubscribeParams{
23
URI: base_uri + "/signal/info",
24
})
25
if err != nil {
26
panic(err)
27
}
28
29
for msg := range c {
30
var current_state signal
31
po := msg.GetOnePODF("2.1.1.6/32")
32
err := po.(bw2.MsgPackPayloadObject).ValueInto(&current_state)
33
if err != nil {
34
fmt.Println(err)
35
} else {
36
fmt.Println(current_state)
37
}
38
}
39
}
Copied!

Interfacing in Python

1
import time
2
import msgpack
3
4
from bw2python.bwtypes import PayloadObject
5
from bw2python.client import Client
6
7
bw_client = Client()
8
bw_client.setEntityFromEnviron()
9
bw_client.overrideAutoChainTo(True)
10
11
def onMessage(bw_message):
12
for po in bw_message.payload_objects:
13
if po.type_dotted == (2,1,1,6):
14
print msgpack.unpackb(po.content)
15
16
bw_client.subscribe("PV Meter uri ending in i.xbos.pv_meter/signal/info", onMessage)
17
18
print "Subscribing. Ctrl-C to quit."
19
while True:
20
time.sleep(10000)
Copied!
Last modified 1yr ago