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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
smartfox-1.0.0.tar.gz
(27.7 kB
view details)
File details
Details for the file smartfox-1.0.0.tar.gz.
File metadata
- Download URL: smartfox-1.0.0.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e969baf383bc2d0b0fb542be5cd1cf69312b7ec13441097825d57e12067bd61
|
|
| MD5 |
dd515113589b3fccfe6156ef909c6149
|
|
| BLAKE2b-256 |
0aebbd6bab0dc86d0219937990d64b1c4e05227ab512d8e693483bb7ba62b187
|