Raw code
sygys opened this issue · 5 comments
Hi @ee02217
We spoke a while back about the integration and putting it in node red. At the moment i use node red and turn on the zb1 heater using this code with a special xiaomi node that fills in the ip and token. I was wondering if you know what the raw json code would be if i wanted to post a turn off command directly from home assistant using a rest command. I guess the token and ip need to go in the header? But how should this be formatted? Could you please help me?
So this what i post in the msg.payload but how would a rest command look if i also include the ip and token?
{
"cmd": "miio",
"method": "get_properties",
"value": [
{
"siid": 2,
"piid": 2
}
]
}
We also spoke about the integration giving delays in home assistant when running. I havent figured it out yet but today i was thinking... Could it be that because you didnt set a "SCAN_INTERVAL =" the integration runs continuously causing home assistant to ocasionally freeze for a second? I have no idea what the scan interval is when it is not set.
Wow this is a very active github with loads of support! (sarcasm off)
I guess the problems with delays created in HA had something to do with this:
make device detection in code persistent (instead of querying device everytime).
For the last couple years i made my own little code in node red to control the heater. its always nicer to have it integrated the nice way so i looked at the repository and saw you updated something 3 months ago and i read this: "instead of querying device everytime"
After testing i think this querying was indeed the cause of HA freezing for a second every now and then. So kudos! I can now finally use this integration.
I see its still not fixed. Once per minute there is a freeze now. YOu can easily reproduce this by opening a camera stream in HA and watch it. you will see the video freeze for about 4 seconds every minute. when removing the mii heater integration fixes these freezes. Something in this integration creates a tremendous lag in HA. even on my NUC i7 10th gen. Its a shame because i love the idea of having a climate entity for this heater. but this integration is broken somewhere.
I also have A CPU load entity that refreshes 1 per second. i can see this entity also not updating in this 4 second freeze. So whole home assistant freezes for about 4 seconds every minute with this integration. lights wont react, automations wont run...
There is seriously something wrong with this integration. Its like its polling every minute or tries to make a connection every minute and lets whole HA freeze until it gets a respond. The logs show no errors though.
I would love to receive help in the form of a merge request :)
As I mentioned before, I am not a developer or expert coder… there are lots of improvements I would like to do, but simply don’t know how…
Been wishing for 2 years that this was just a temporary workaround until someone integrated it natively in HA.
I have the same problem. i dont know how to do this either. I dont have enough time to learn all this either. there are so much things to learn thats its impossible to do it all.