#########################################
# AdafruitIna219.py
# description: Adafruit INA219 Voltage and Current sensor Service
# categories: [sensor]
#########################################
# This script shows how to use the AdafruitIna219 service
#
# This section shows is if you use the Arduino i2c pins
arduino = Runtime.start("Arduino","Arduino")
arduino.connect("COM3")
raspi = Runtime.start("RasPi","RasPi")
ina219 = Runtime.start("AdafruitIna219","AdafruitIna219")
# From version 1.0.2316 use attach instead of setController
# ina219.setController(arduino,"1","0x40")'
ina219.attach(arduino,"1","0x40")
# 
# This section shows is if you use the GPIO i2c pins on the RaspBerry Pi directly
raspi = Runtime.start("RasPi","RasPi")
ina219 = Runtime.start("AdafruitIna219","AdafruitIna219")
# From version 1.0.2316 use attach instead of setController
# ina219.setController(raspi,"1","0x40")
ina219.attach(raspi,"1","0x40")
#
# This sections shows how to get the values from the service
ina219.refresh()
print ina219.busVoltage," mV bus voltage"
print ina219.shuntResistance, "Ohms shunt resistance"
print ina219.shuntVoltage ," mV accross the shunt resistor"
print ina219.current, " mA current"
print ina219.power, " mW power"

#########################################
# AdafruitIna219.py
# description: Adafruit INA219 Voltage and Current sensor Service
# categories: [sensor]
#########################################
# This script shows how to use the AdafruitIna219 service
#
# config
port = "COM3"
# Code to be able to use this script with virtalArduino
if ('virtual' in globals() and virtual):
    virtualArduino = Runtime.start("virtualArduino", "VirtualArduino")
    virtualArduino.connect(port)
# 
ina219 = Runtime.start("AdafruitIna219","AdafruitIna219")
#
# This section shows is if you use the Arduino i2c pins
# Comment three lines if you don't use the Arduino
arduino = Runtime.start("Arduino","Arduino")
arduino.connect(port)
ina219.attach(arduino,"1","0x40")
# 
# This section shows is if you use the GPIO i2c pins on the RaspBerry Pi directly
# Uncomment two lines if you use the RasPi
# raspi = Runtime.start("RasPi","RasPi")
# ina219.attach(raspi,"1","0x40")
#
# This sections shows how to get the values from the service
ina219.refresh()
print ina219.busVoltage," mV bus voltage"
print ina219.shuntResistance, "Ohms shunt resistance"
print ina219.shuntVoltage ," mV accross the shunt resistor"
print ina219.current, " mA current"
print ina219.power, " mW power"

Update AdafruitIna219.py