Comments (16)
good point... I'll investigate into this over xmas..
I do need to get the damm thing into the main branch of HA.....
Changing task name
from wiserhomeassistantplatform.
Looking at the openhab impl this can be done by using the following patch command
"{"RequestOutput":"" + (outputState ? "On" : "Off") + ""}";
I smell a major enhancement coming on :-)
"data/domain/SmartPlug/ is the endpoint
from wiserhomeassistantplatform.
next on the list. :-)
from wiserhomeassistantplatform.
opened base bug asantaga/wiserheatingapi#11
from wiserhomeassistantplatform.
This is now implemented in branch R1.9Dev. There is still a sync issue so leaving this open but it fundamentally works
from wiserhomeassistantplatform.
Fixed this by forcing the state to be refreshed, seams to work
Line 155 of init.py
self.wiserhub.refreshData()
@msp1974 Is this truely bad in the async world?
from wiserhomeassistantplatform.
Only in the fact you are doing 2 updates one after another. The line after does force an update. The nothrottle=true means it does immediately. I just got one of these plugs tonight and have been looking at it.
Issue you are having is a timing one. When you set the plug to on, there seems to be a delay while the plug actually turns on before the hub reports it as on. Guessing the 2 updates is enough time for this to show correct state. If anything i would copy line 156 twice to see if this works. Alternetive cheat would be to add a small delay using await sleep but think this is frowned upon in HA.
I will have a look at this over weekend and see if there is a better approach.
from wiserhomeassistantplatform.
Also, would be tempted not to call this method set mode as the plug actually has a mode of manual or auto and you can set a schedule on it. Maybe set plug state?
from wiserhomeassistantplatform.
Mm
A) re uodate i suppose i could just issue the update without doing a async call... maybe a very short sleep is the right approach. I could make the sleep itself async so that it relinquishs control back to HA thread
B) ya right there are different modes but i wonder if that should be a api call. So we would have set state and set mode
C) need to implement schedule too....
Finally. Dude u up late as well!!!
from wiserhomeassistantplatform.
Researching some docs, think the right way to do this is as below:
await asyncio.sleep(1)
Time in brackets is in seconds. Think 1 second is more than enough time for this to update to the right status before doing a refresh with async_update. I'll give it a try tonight and see how it works.
Always up late! Only time to get things done! ;-)
from wiserhomeassistantplatform.
Have also noticed that we (he says 'we' like it wasn't his poor coding! )are calling the forced refresh twice when setting away mode and switches. Once in the switch.py file and once in init.py when calling api. Prob shouldn't do this given feedback on stability issues with hub of requesting updates from it too often. Will try and sort tonight or over weekend.
from wiserhomeassistantplatform.
So been playing with this tonight to see if adding a delay works and what length. Seem to have settled on yes this does work and about 0.5 secs does ok. However, seen some very strange behaviour from my brand new smartplug!
Firstly, the 'OutputState' value disappears from the returned json when querying it (seen through Postman) when in an On state. Shows when in off state. There is however and manual state that shows instead which you can test with.
Also, if I turn on, it can stay on for 5 seconds and then turn itself off then on then off again within a couple of seconds. Positive there is nothing being sent from HA. Have you seen anything like this with yours? Not sure if this has updated firmware during today as seemed fine yesterday.
from wiserhomeassistantplatform.
Weird thing about the smart plug missing json attributes.. I'll also confirm on myside and see which is the more reliable attribute for checking the status..
I'll add the await asyncio.sleep(1) to the method and confirm it works fine.
Side note : Like you , totally swamped during the weekdays and only late at night can I do some coding, alas I have a conference next week, a house I need to clean up so not sure how much time I'll get... joys of work , home life and a 4yr old ever wanting attention.....
from wiserhomeassistantplatform.
Have not tried HA control of plug yet (waiting for you guys to "do your thing" with the code first) but using the Android wiser app or the button on the plug mine is behaving fine.
Firefox Rested extension displays the expected json response and plug stays 'on' or 'off' as instructed!
from wiserhomeassistantplatform.
merged it in so its ready for testing.
from wiserhomeassistantplatform.
#62 merged into 1.9Dev
from wiserhomeassistantplatform.
Related Issues (20)
- Question: Can Home Assistant talk to Wiser TRVs without a controller? HOT 1
- Naming sensor.wiser_heathub
- Smart Plugs - ghost entries after name change HOT 2
- Deprecated call `async_add_job` HOT 1
- HEADS UP - Manage Temps Recipe V2 Potentially Causing HA 2024.4 Crashes HOT 2
- Heads up: depreciation warning in Logs HOT 1
- Unable to set Hot Water on or off in automation HOT 1
- [Question] Should "Default Heating Boost Temperature" config option be used in presets? HOT 4
- Connection error HOT 4
- Slow updating of sensor HOT 2
- Allow un-assigning schedule from wiser.assign_schedule service HOT 1
- Consumption of my energy sensors randomly goes to 0 and initiate a new cycle for my energy dashboard by mistake HOT 5
- deprecation warning: integration 'wiser' calls `async_add_job` HOT 1
- False Alert - please delte
- Card font size cannot easily be changes HOT 1
- V3.4.7 : Warning: color mode [stop working in 2025.3] HOT 2
- Boost/Cancel/Toggle Hot Water and Cancel Heating Overides no longer working HOT 5
- HW Climate Functionality Review HOT 2
- Unable to control Hot Water HOT 1
- TransferEncodingError: 400, message='Not enough data for satisfy transfer length header.' HOT 19
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 wiserhomeassistantplatform.