Home Assistant release with the issue:
0.99.1
Last working Home Assistant release (if known):
Also 0.99.1 - not sure what could have triggered the change.
Operating environment (Hass.io/Docker/Windows/etc.):
Docker on Linux (Dockerfile
as follows), using host mode networking
FROM homeassistant/home-assistant:latest
RUN apk add --no-cache bash
RUN adduser -u 109 -s /bin/bash -S homeassistant
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing nut
Component/platform:
tuya
Description of problem:
Home Assistant server is making huge numbers of repeated DNS requests for px1.tuyaeu.com
.
Every second, it will make an A request and an AAAA request, and this continues for several seconds, then it stops making requests for a few seconds, then starts back up again and the cycle repeats. It's been averaging about 30 requests per minute.
The devices all seem to work perfectly, though I'm slightly concerned about whatever it is that's constantly being retried.
Problem-relevant configuration.yaml
entries and (fill out even if it seems unimportant):
tuya:
username: ***
password: ***
country_code: 44
Traceback (if applicable):
Additional information:
I believe this is the same issue as #16109 - the DNS query is different there, but I think that's down to the different country code selection.
This started happening overnight, and it's easy to see when it started:
The purple section here is my HA server.
The time this started happening exactly matches the time that my auto-update script runs overnight, however according to the log there were no changes, so it just removed the container and recreated it from the same image, so it should have been identical. Clearly something's ended up different when it restarted, but I'm at a loss as to what.
I'm not sure if it's coincidence that the original reporter and I are both using a Pi-hole server; it could be just that Pi-hole's logging makes it visible, or it could be that somehow HA doesn't like Pi-hole's responses. If I docker exec
into the container and run dig
manually, the A record looks normal (with a 60s TTL), and there is no AAAA record, which I believe is correct.
There's only one slightly unusual thing: dig AAAA px1.tuyaeu.com @8.8.8.8
includes an authority section, whereas if I query my router or the Pi-hole that section is missing. Since this is the only anomaly I can see, that's my next line of investigation.
Just done a bit of extra testing:
I've switched the HA server to use 8.8.8.8 as its DNS resolver and confirmed with tcpdump that it's still making the same requests, so that rules out the missing authority section from Pi-hole and my router's DNS servers.
Still racking my brains trying to think what might have changed yesterday to cause this behaviour to start so suddenly overnight. So far the only thing I can come up with is that I enabled IPv6 on the router yesterday, although I didn't actually enable it on the system that's hosting HA so I don't really see how that could affect it. On the off chanhce, I've just tried enabling IPv6 on that machine and that hasn't made a difference. When the internet connection's not being used by everyone I'll try turning IPv6 off again just in case it's related.
Everything I've found on this topic makes it sound like this is an inevitable outcome of using requests
, which uses httplib
in turn, because those libraries don't do any DNS caching and therefore need to perform a new DNS lookup for every request (double the latency, double the fun!). Except the fact that it wasn't happening yesterday makes that explanation hard to swallow...
I'm now fairly convinced that this is httplib
business as usual, not an indication of a real problem, so I'm not going to worry about it.
I don't have a good answer to why it started so suddenly, but I'm guessing that maybe I had some kind of admin error that meant that system wasn't actually using the Pi-hole for its DNS, and I somehow inadvertently fixed it yesterday.
I'm closing this now then; if anyone else has the same problem and just wants to get it out of the way so that it stops dominating the DNS dashboard, I'd suggest pointing the HA server at another DNS server. In my case since I'm using Docker and my Pi-hole's upstream DNS server is my router, it's a simple case of adding --dns=<router IP>
to the Docker command line to have it just skip the Pi-hole with no other effects. If you're running outside of a container, you might end up having to change the DNS config for the whole machine I suppose.
Pretty sure this is an issue with the Tuya component itself. Changing the DNS will indeed prevent the requests from going through your Pi-Hole but it won't make them not happen.
I have 9 curtain switches in my home and I'm getting roughly 50k requests per day if Tuya is enabled on my installation (0.99.2) ; disabled it for now for obvious reasons.
A way to set the polling request to the Tuya servers would be very much appreciated.
I just found this on my server tonight too. It's out of control.
px1.tuyaeu.com is getting smashed endlessly.
I wonder if I can just remove logging for this thing from my pihole. The data is presumably, trusted.
I had similar problems with tuya component, pihole and homeassistant.
It makes my raspberrypi network stop working and need to restart it.
Can we re-open this, specifically for the Tuya-Component? My pihole is running slow due to this integration pinging it endlessly. Pointing home-assistant to a different dns is not a true fix, it's just masking the problem.
Also experiencing this issue, about 50k/day as well.
Same issue here.
15k requests/day and smart switches were not even plugged in.
Removed tuya integration from configuration.
37000 requests.
I wanted to keep the integration, but I was annoyed with this as well, so:
Since I'm running home-assistant in a docker container, I've:
urllib3
within integration not to do any IPv6 DNS queries (see https://stackoverflow.com/a/46972341)px1.tuyaeu.com
)Results are as expected:
Of course, this will work only until container is upgraded (it would need manual intervention once again).
I think this can or should be sorted within Tuya integration itself (ping @PaulAnnekov).
Still getting a crazy amount of DNS requests 171k over the last 7 days. Tuya component is the only one doing requests this frequently. Out of the 192k requests from my home assistant, 171k of them are tuya
I also suffer the same fate, as my Pi-Hole is getting overwhelmed with Tuya requests.
Here's a gist of my docker-compose and (updated) workaround https://gist.github.com/kornrunner/6a6f15c8836585572044c2f6eb3ea0e4
Im running HA in Proxmox with PiHole as DNS. Have the same error. Can someone please have a look at the tuya integration? Would be great.
Most helpful comment
I wanted to keep the integration, but I was annoyed with this as well, so:
Since I'm running home-assistant in a docker container, I've:
urllib3
within integration not to do any IPv6 DNS queries (see https://stackoverflow.com/a/46972341)px1.tuyaeu.com
)Results are as expected:

Of course, this will work only until container is upgraded (it would need manual intervention once again).
I think this can or should be sorted within Tuya integration itself (ping @PaulAnnekov).