Skip to main content

An SDK for Smartfox API

Project description

Smartfox SDK for Python

NOTE: This is not an offical Smartfox SDK. Only reverse engineered the browser requests.

This Python Package enables you to develop applications with the Smartfox.

Install:

pip install smartfox

Example get a value:

from smartfox import Smartfox

# Initialize a new smartfox connection
smartfox = Smartfox("my-smartfox.local")

# update the values
smartfox.getValues()

# print
print(smartfox.consumption)

# print the value
print(smartfox.consumption.value)

Example set a relay or analog output:

from smartfox import Smartfox

# Initialize a new smartfox connection
smartfox = Smartfox("my-smartfox.local")

smartfox.relay1.turnOff() # turn off relay 1
smartfox.relay1.turnOn() # turn on relay 1


smartfox.analog.set(10) # set analog output to 10%
smartfox.analog.setAuto() # set analog output to auto
smartfox.analog.off()  # set analog output to off

Value Objects

Type Names Methods Args Class Variables
PowerValue consumption,
pv,
carCharger,
heatPump,
power,
effectivePower,
heatPumpPower,
power,
effectivePower,
heatPumpPower,
heatPumpThermPower,
batteryPower
- - value, unit
EnergyValue energy,
returnEnergy,
effectiveEnergy,
apparentEnergy,
dayEnergy,
dayReturnEnergy,
carChargeCurrentChargeEnergy,
carChargeEnergy,
heatPumpEnergy,
heatPumpThermEnergy
- - value, unit
VoltageValue - - value, unit
PFValue - - value, unit
CurrentValue - - value, unit
TimeValue - - value, unit
PercentValue soc - - value, unit
TempValue bufferHot,
bufferCold,
warmWater
- - value, unit

Example

from smartfox import Smartfox

# Initialize a new smartfox connection
smartfox = Smartfox("my-smartfox.local")

# update the values
smartfox.getValues()

# get power
print(smartfox.power) # returns string
print(smartfox.power.value) # returns power as float
print(smartfox.power.unit) # returns the unit of power

Result:

>> power value: 972.0 W
>> 972.0
>> W

Objects

Type names Methods Args Class Variables
Phase phase1,
phase2,
phase3
- - voltage: VoltageValue,
current: CurrentValue,
power: PowerValue,
powerFactor: PFValue
Relay relai1,
relai2,
relai3,
relai4
turnOn(),
turnOff()
- id,
remainingTime: TimeValue,
overallTime: TimeValue,
smartfox: Smartfox
AnalogOut analog set(value),
setAuto(),
off()
- percentage: PercentValue,
power: Powervalue

Example

from smartfox import Smartfox

# Initialize a new smartfox connection
smartfox = Smartfox("my-smartfox.local")

print(smartfox.phase1.power) # returns phase1 power
print(smartfox.relai4.turnOn()) # turns relai4 on

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smartfox-0.0.6.tar.gz (24.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page