Comments (17)
I'm surprised and disappointed to find out the power consumption information is not part of the API. I was hoping to feed the power usage information into grafana for closer inspection, but no luck I guess :(
from switchbotapi.
@Minsheng Partially correct in my opinion.
As far as I know, the API can provide the electricCurrent
(Current), voltage
(Voltage), weight
(Power), etc. but not the Energy which is available in the App along with its History (not sure how long those data are stored). Obviously it's possible to constantly (e.g. every 1 min for high resolution) get weight
(Power) and time, put those a DB and calculate the Energy along a timeframe, but it needs more effort than making a single call per day to get the Energy, or better its history.
I am wondering if it's possible to capture the packets and see which API is used by the App to get those. 🤔
EDIT: connection by App and API server seems using TLS resulting on encrypted data (including the API call to get Energy along with its History), so I am not sure if it's possible to retrieve those details easily.
from switchbotapi.
I think so too.
In the app, displayed power consumption(W), voltage(V), and current(A).
I want to get the same data with API.
from switchbotapi.
this is unfortunate if not planning to be added would have expected this to be available considering they clearly are capturing/storing the information. not making it available seems odd considering how useful it would be to get combined home or room total kWh used vs having to calculate it manually from reviewing the app per device and tally it up.
from switchbotapi.
@masterlog80 , @maxlingenfelter , I don't think so that the API returns a power factor. I am using a switcbot plug mini US, and I dont see power-factor being returned in the response.
HERE IS MY SAMPLE RESPONSE
{ "statusCode": 100, "body": { "deviceId": "A0764E357656", "deviceType": "Plug Mini (US)", "hubDeviceId": "A0764E357656", "power": "off", "voltage": 123.1, "weight": 0, "electricityOfDay": 20, "electricCurrent": 0, "version": "V1.5-1.5" }, "message": "success" }
from switchbotapi.
I am also interested in this functionality.
Is there any other way of obtaining these readings directly from the device? e.g. direct access point to the plug in WiFi, while being paired in WiFi setup mode, BLE (not sure if the plug has BT..)
from switchbotapi.
I think so too.
I want to check the operating status of the device by power consumption, so I want to get the power consumption.
from switchbotapi.
I am interested in getting information about consumption too.
I want to know if an appliance is on or off which has only "toggle button" for power on/off.
from switchbotapi.
Is the management team making the API private due to concerns about concentrated access to the system?
from switchbotapi.
Sorry guys, this feature will not be added for SwitchBot Plug. If you happen to have purchased Plug Mini (US) / Plug Mini (JP), u can get the data through the API.
from switchbotapi.
@masterlog80 Based on the documentation, weight
should be exactly what you are looking for, but for whatever reason it seems to return power instead. Not to mention the API returns also a 10x value for the electricCurrent
...
from switchbotapi.
@larpo To better clarify, the weight
is indeed the instant power (not the daily one as mentioned in the documentation which at this point seems to be wrong). However, the power
is considered an instant value and measured in W (Watt), while the energy
is expressed in a specific time frame like KWh (KW per hours).
However on my side all the parameters shown (e.g. electricCurrent
, voltage
, etc.) are correct and legit.
What I am looking for is the energy
and its History (in order to eventually calculate the costs) which indeed can be retrieved from the cloud (the App can do that), but the target API and its output are not available in the documentation.
from switchbotapi.
@larpo & @masterlog80 given the voltage and current you should be able to track power usage over time and get a "energy"
over whatever time frame you want.
Ex:
power = voltage x current = 120V x 5A
If you integrate this API into a home automation software like home assistant you could track the cumulative power usage over an hour and then make a cumulative sum over a day and then you have that day's KWh usage.
from switchbotapi.
@maxlingenfelter
that's actually not correct. To calculate the power on AC, you need to consider also the power factor which is not a static or fixed value. The point here is to get the Energy
and its History
trough the API, in the easiest way as possible.
from switchbotapi.
@masterlog80 , you are right about considering the power factor for accurate power calculations on AC circuits. I apologize for not explicitly mentioning that earlier.
To track power usage over time and calculate energy (KWh) accurately, the formula is:
Real Power (kW) = Apparent Power (VA) × Power Factor
where:
Apparent Power (VA) = Voltage (V) × Current (A)
Since the power factor can vary over time due to different loads, continuously monitoring the power factor and using its real-time value in energy calculations is essential. By doing this and integrating the API into home automation software like Home Assistant, you can track cumulative power usage over time, accounting for fluctuations in the power factor, and obtain a more precise representation of energy consumption in KWh for any desired time frame.
While dedicated energy meters with power factor measurements can provide more accurate results, the API-based approach is still valuable for many monitoring scenarios, as long as the dynamic nature of the power factor is taken into consideration.
from switchbotapi.
I wasn't sure that the power factor can be retrieved by API, I need to check that. However, thanks for your update.
I would suggest you providing some instructions to integrated this into automation software (e.g. Home Assistant, etc.) to get the values required as for not developers this can be pretty troublesome.
Regards,
from switchbotapi.
@kganjoo no it does not, that's the whole point of the back-and-forth @masterlog80 where having.
from switchbotapi.
Related Issues (20)
- Open single curtain (of 2 curtains grouped together) via API HOT 3
- Light Remote color and timer HOT 1
- [Keypad Touch] Send lock codes in response to Get Device Status
- [Keypad Touch] Delete Key command does not work HOT 1
- API Daily Limit HOT 4
- Support for s10 vacuum HOT 3
- Add support for K10+ vacuum HOT 2
- example java script to initiate a bot press
- Expand Switchbot API for Lock Pro HOT 1
- API 190 Error HOT 53
- Expose last update timestamp for device
- More Keypad Touch Webhook Events Required HOT 3
- SwitchBot Lock's webhook often fails to POST to servers
- Keypad Touch: Invalid API calls cause stability issues
- Knowing when a press at a bot was successful
- Parameter Error for the S10 selfClean Command
- batteries status always 100% HOT 1
- Not able to install the adapter HOT 1
- Multiple commands per Request
- ``/v1.0/devices/`` endpoint - device list functionality errored HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from switchbotapi.