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.12.tar.gz (27.8 kB view details)

Uploaded Source

File details

Details for the file smartfox-0.0.12.tar.gz.

File metadata

  • Download URL: smartfox-0.0.12.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.5

File hashes

Hashes for smartfox-0.0.12.tar.gz
Algorithm Hash digest
SHA256 e1ffedd77693bb4894ba020185cafb25173bea0092e3bf7dec4a9771c05d4fe6
MD5 1fddf4a72b3c6b7c5bb4514f2106be02
BLAKE2b-256 8f3bc111326472b02e62b1ddea2f64aa1516157a64e21426e42beed1ef47dfd6

See more details on using hashes here.

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