# 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:
```bash
pip install smartfox
```
## Example get a value:
```python
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**:
```python
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, </br>pv, </br>carCharger, </br>heatPump, </br>power, </br>effectivePower, </br>heatPumpPower, </br>power, </br>effectivePower, </br>heatPumpPower, </br>heatPumpThermPower, </br>batteryPower | - | - | value, unit |
| EnergyValue | energy, </br>returnEnergy, </br>effectiveEnergy, </br>apparentEnergy, </br>dayEnergy, </br>dayReturnEnergy, </br>carChargeCurrentChargeEnergy, </br>carChargeEnergy, </br>heatPumpEnergy, </br>heatPumpThermEnergy | - | - | value, unit |
| VoltageValue| | - | - | value, unit |
| PFValue | | - | - | value, unit |
| CurrentValue| | - | - | value, unit |
| TimeValue | | - | - | value, unit |
| PercentValue| soc | - | - | value, unit |
| TempValue | bufferHot, </br>bufferCold, </br>warmWater | - | - | value, unit |
### Example
```python
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, </br>phase2, </br>phase3 | - | - | voltage: VoltageValue, </br>current: CurrentValue, </br>power: PowerValue, </br>powerFactor: PFValue |
| Relay | relai1, </br>relai2, </br>relai3, </br>relai4 | turnOn(), </br>turnOff() | - | id, </br>remainingTime: TimeValue, </br>overallTime: TimeValue, </br>smartfox: Smartfox |
| AnalogOut| analog | set(value), </br>setAuto(), </br>off() | - | percentage: PercentValue, </br>power: Powervalue |
### Example
```python
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
```
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/jfk344/python-smartfox-sdk",
"name": "smartfox",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "@jfk344",
"author_email": "info@jfk.rocks",
"download_url": "https://files.pythonhosted.org/packages/8f/3b/c111326472b02e62b1ddea2f64aa1516157a64e21426e42beed1ef47dfd6/smartfox-0.0.12.tar.gz",
"platform": null,
"description": "# Smartfox SDK for Python\n\n> **__NOTE:__** This is not an offical Smartfox SDK. Only reverse engineered the browser requests.\n\n\n### This Python Package enables you to develop applications with the Smartfox.\n\n## Install: \n\n```bash\npip install smartfox\n```\n\n## Example get a value:\n\n```python\nfrom smartfox import Smartfox\n\n# Initialize a new smartfox connection\nsmartfox = Smartfox(\"my-smartfox.local\")\n\n# update the values\nsmartfox.getValues()\n\n# print\nprint(smartfox.consumption)\n\n# print the value\nprint(smartfox.consumption.value)\n```\n\n## Example set a **relay** or **analog output**:\n\n```python\nfrom smartfox import Smartfox\n\n# Initialize a new smartfox connection\nsmartfox = Smartfox(\"my-smartfox.local\")\n\nsmartfox.relay1.turnOff() # turn off relay 1\nsmartfox.relay1.turnOn() # turn on relay 1\n\n\nsmartfox.analog.set(10) # set analog output to 10%\nsmartfox.analog.setAuto() # set analog output to auto\nsmartfox.analog.off() # set analog output to off\n```\n\n## Value Objects\n\n| Type | Names | Methods | Args | Class Variables | \n|---------------|-------|----------|--------------|------------------|\n| PowerValue | consumption, </br>pv, </br>carCharger, </br>heatPump, </br>power, </br>effectivePower, </br>heatPumpPower, </br>power, </br>effectivePower, </br>heatPumpPower, </br>heatPumpThermPower, </br>batteryPower | - | - | value, unit |\n| EnergyValue | energy, </br>returnEnergy, </br>effectiveEnergy, </br>apparentEnergy, </br>dayEnergy, </br>dayReturnEnergy, </br>carChargeCurrentChargeEnergy, </br>carChargeEnergy, </br>heatPumpEnergy, </br>heatPumpThermEnergy | - | - | value, unit |\n| VoltageValue| | - | - | value, unit |\n| PFValue | | - | - | value, unit |\n| CurrentValue| | - | - | value, unit |\n| TimeValue | | - | - | value, unit |\n| PercentValue| soc | - | - | value, unit |\n| TempValue | bufferHot, </br>bufferCold, </br>warmWater | - | - | value, unit |\n\n### Example\n```python\nfrom smartfox import Smartfox\n\n# Initialize a new smartfox connection\nsmartfox = Smartfox(\"my-smartfox.local\")\n\n# update the values\nsmartfox.getValues()\n\n# get power\nprint(smartfox.power) # returns string\nprint(smartfox.power.value) # returns power as float\nprint(smartfox.power.unit) # returns the unit of power\n\nResult:\n\n>> power value: 972.0 W\n>> 972.0\n>> W\n```\n\n\n## Objects\n\n| Type | names | Methods | Args | Class Variables | \n|------------|----|----------|-------------|------------------|\n| Phase | phase1, </br>phase2, </br>phase3 | - | - | voltage: VoltageValue, </br>current: CurrentValue, </br>power: PowerValue, </br>powerFactor: PFValue |\n| Relay | relai1, </br>relai2, </br>relai3, </br>relai4 | turnOn(), </br>turnOff() | - | id, </br>remainingTime: TimeValue, </br>overallTime: TimeValue, </br>smartfox: Smartfox |\n| AnalogOut| analog | set(value), </br>setAuto(), </br>off() | - | percentage: PercentValue, </br>power: Powervalue |\n\n\n### Example\n```python\nfrom smartfox import Smartfox\n\n# Initialize a new smartfox connection\nsmartfox = Smartfox(\"my-smartfox.local\")\n\nprint(smartfox.phase1.power) # returns phase1 power\nprint(smartfox.relai4.turnOn()) # turns relai4 on\n```\n",
"bugtrack_url": null,
"license": "mit",
"summary": "An SDK for Smartfox API",
"version": "0.0.12",
"project_urls": {
"Homepage": "https://gitlab.com/jfk344/python-smartfox-sdk"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8f3bc111326472b02e62b1ddea2f64aa1516157a64e21426e42beed1ef47dfd6",
"md5": "1fddf4a72b3c6b7c5bb4514f2106be02",
"sha256": "e1ffedd77693bb4894ba020185cafb25173bea0092e3bf7dec4a9771c05d4fe6"
},
"downloads": -1,
"filename": "smartfox-0.0.12.tar.gz",
"has_sig": false,
"md5_digest": "1fddf4a72b3c6b7c5bb4514f2106be02",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27797,
"upload_time": "2024-02-15T19:28:04",
"upload_time_iso_8601": "2024-02-15T19:28:04.109712Z",
"url": "https://files.pythonhosted.org/packages/8f/3b/c111326472b02e62b1ddea2f64aa1516157a64e21426e42beed1ef47dfd6/smartfox-0.0.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-15 19:28:04",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "jfk344",
"gitlab_project": "python-smartfox-sdk",
"lcname": "smartfox"
}