Connecting Wifi devices to ZHA using existing wifi router

I have HA running on a linux box and a Sonoff zigbee USB dongle which talks to my zigbee network. I also have some wifi devices and I was considering getting a wifi bridge but since the linux box is already connected to the wifi router, is there a way to use that within HA? I’m using ZHA.

These wifi devices can simply connect to you wifi network (your router and wifi access point)

The router shows up in HA but there’s no ‘add device’.

If there is no “Specific” integration for your Router " Brand " , then Upnp wil discover ur router, and create some sensors, “Trackers” and few other simple … As for your other Wifi Device you can find integration for some “very known” brands, othervice there is and integration “local_tuya” which support a bunch of brands ( Plugs, switches, lights ) , install Local:_Tuya and it will auto discover, , but unfortunately the “native” HA Tuya will also try to Claim “ownership”, thou you should just click “Ignore” on this … unless you are iphone-fan, then maybe you have other ideas :slight_smile: :grinning_face_with_smiling_eyes:

I may be confused…

Why do you need to use (or even mention) ZHA at all to connect wifi based devices to your HA system.

the two have nothing to do with each other.

as mentioned above the wifi devices should connect directly to your router and then to HA.

ONLY IF (!!!) those wifi devices have an integration (either built-in or custom) created to allow HA to talk to the devices.

You don’t add wifi devices thru the router integration. The router integration is only for connecting the router itself to HA.

if the devices are Tuya then use the Tuya integration, I have a wifi capable printer so I use the IPP integration for that, if they are some other integration then use that integration.

Thanks all. Looks like the answer is to use the appropriate ‘integration’. I’m still not familiar with all the terms. Currently the wifi devices are on the Tuya network but I’ve also used them with an app called ‘Home Assist’. It has a similar icon to the homeassistant app but not sure if they’re related.

I am finding it very difficult to find useful info on HA/zigbee in general. There are a huge number of low-quality ‘click-bait’ youtube videos and then some very detailed info in datasheets e.g. on the NXP website, but nothing in between.

The Zigbee integrations come in the form of ZHA and Zigbee2MQTT in HA.
You need t figure out which one you want to use.

I would say the forums here are probably the best place to answer your questions and enrich your knowledge that you may have gained on the HA documentation pages.

https://www.zigbee2mqtt.io/

Thanks. Yes, I’ve worked out how to use basic ZHA. Pretty much a random choice between that and Z2MQTT. The Zigbee network is working, with commercial devices at least. I have a couple of CC2531 USB sticks which I was able to flash with the right software and they’re also working ok. I have some XBees which work as Zigbee devices but not with ZHA, I assume because they’re missing some higher level of the protocol stack. Information is sparse to put it mildly!

With Zigbee the protocol is not complete locked down, so manufactures can come up with their variants and then you need quirks to make it work.
Works is something like a driver for Zigbee.

The only integration appears to be ‘Tuya’ and when I try to add it, HA gives an error " Config flow could not be loaded: {“message”:“Invalid handler specified”} "

Do yo have HACS installed ?

LocalTuya is a Custom_Component

So either you install it through HACS, or manually

Thanks. I installed HACS ok (on Ubuntu) but following the instructions at Initial Configuration | HACS, when I try to add HACS as an integration, it comes up with the same error as before: " Config flow could not be loaded: {“message”:“Invalid handler specified”} "

Some progress. Looks like this was a common issue a couple of months ago and is now fixed. Required manually updating the snap to the latest version.

I now have Local Tuya installed. It detects the device (a Wifi socket) and I can configure it but it doesn’t work. I’m able to access it locally using tuyapower from the command line so I know I have the correct ID and local key.
There wasn’t an option for ‘socket’ so I used ‘switch’. Is this going to work? I’m thinking sockets may not be supported yet. The switch does appear in HA but it has no effect. After turning it on, it turns itself back off after a few seconds (this is all within HA, the device itself doesn’t respond). The log has various messages but they don’t correspond to the state of the device. I suspect it’s just logging events from the setup process.

There were various fields for ‘voltage’, ‘current’ etc. but the options were just numbers, nothing meaningful. I tried a couple of options at random but no difference.

I did try manually installing the socket, specifying the DPS as ‘1’ but all that happened was it installed the devices with no controls. It was also impossible to delete (just came up with an error) so I had to delete the LocalTuya integration completely and then re-install it.

Looks like the problem was a bug/issue with HACS. Updated today to 1.30.1 and it now works. I followed the guidance here: Known working and non working devices · rospogrigio/localtuya Wiki · GitHub

None of my devices were listed on the wiki but the locations (register addresses?) are the same i.e. switch=1, current=18, power=19, voltage=20.