Troubleshooting Milesight WS523-915M portable socket

Hello, and advance apologies if my post causes some angst amongst more knowledgeable users! I’ve recently purchased a Milesight WS523-915M portable socket, and my original intention was to use it as a remotely switchable power source for a project that I volunteer on. I must admit to still being a ‘newbie’ when it comes to LoRaWAN, but I assumed that I would be able to utilise this socket using a community gateway on the Things Network. I certainly never imagined (and am still hoping?) that I’d also need to set-up a gateway as well? I live in Perth, Western Australia and it would appear from the coverage map on the Perth page ( that there are certainly gateways in range of the proposed end location. Currently, I have plugged the device in at home; I’ve set up an account and registered it using the information gleaned by using NFC on my mobile (cell) phone. That appears to have been successful, and I can see ‘Accept - Join request’ and ‘Forward Join - Accept message’ data on my TN page. So, does this mean - as I’m assuming - that it is ‘connected’ to one of the local gateways that I can see ‘cover’ my home? And if so, where do I go from here? Obviously, I need to be able to send a - very simple - message to the device - ‘on’ or ‘off’. (It has other facilities, but I’m really not that interested in them - just the remote ability to turn it on or off). I’m conversant with MQTT and not unfamiliar with JSON - but how do I work out if I really am getting a connection, and then send a message to the device so it will do as I wish. Oh, and all this, of course, without having to purchase and set up another gateway! Or isn’t this within the sphere of TTN? Am I completely wrong in my thinking? Any advice very gratefully received!! Regards - Mike :slightly_smiling_face:

If you go to the application you set up.

On the left there is a menu. One of the items is “Integration”, select it and you will see “MQTT” and other items.

If you select one of these items it look at the bottom right, you will see “Documentation”, select that and in the documentation there are excellent explanations of how to.

An also search on the forum, there is quit a bit information on MQTT, Webhooks an ways to do the integration and applications

Thanks Johan. I’d already set that up; got the API key etc, and use ‘mqtt-spy’ to see if any messages are being sent to the TTN MQTT server. It certainly appears to connect OK, but subscribing to # (all messages) shows nothing! So do you believe, from my previous post, that I am actually connected? I guess that’s the first thing I need to understand! Regards - Mike

The topic is “v3/+/devices/+/up”

What appears in the console?

Needs to be something like below, these are successful messages.


I’ve tried that. It certainly says I am subscribed to the TTN MQTT server (status: connected) but there are NO messages at all. Normally, of course, if I subscribe to #, I’ll see everything. I’ve tried your suggestion and others using the documentation examples, but all to no avail. So, again, does this mean that I’m really not connected? I did ‘update’ the MQTT API (actually, just hit save again) and this gave me a message: ‘Console - stream connection closed’ followed by ‘Console - Stream reconnected’
(The Console was able to reconnect to the internet and resumed the event stream. Subsequent event data will be received and displayed. Note that event data which was possibly emitted during the network disruption will not be re-delivered.). So, that sounds promising, yes? Thanks for your very speedy assistance!!

You need to look in the console - application - end devices - “select the device” - live data. What do you see there?

Trust me the topic needs to be correct, this is for all devices in the application-

I’ve taken a screen-shot of the tab you suggest and here it is:

Screenshot 2022-03-25 154809

(Ive blanked out the ID. Is that necessary? Oh and it is 15:50 here…)

Just a thought, Johan. There are two MQTT - a public address and a public TLS address

I’m using the public address (port 1883). Is that correct? (I assume so as I connect OK). But still NO content (subscribed to v3/+/mw001/+/up - and v3/mw001/up just in case…)

Most likely your device didn’t hear the join accept message - the gateways usually have good antenna’s - anything plugged in to a socket is going to be small & low down, both not good.

Also, the concept of range is rather variable - it all depends on what is between the device & the gateway.

Also, we’re not keen on anything that needs regular downlinks - the Fair Use Policy is for 10 a day, we ask people to think in terms of 1 per fortnight - a gateway can’t hear any uplinks from any device whilst it is transmitting.

Thanks Nick. Yes, I can certainly see what you are suggesting. I understand the ‘Fair Use’ policy, and I was under the - possibly false? - assumption that, once connected, the device would only need to have the - very occasional! - ON or OFF message. I’ll try the socket (and it is the socket itself that is a LoRaWAN device - not what is plugged into it) in an external GPO and see if that makes a difference ie no brick walls (and all Perth houses are double brick!!). There is, apparently, a gateway just about 1Km away. More to follow… and many thanks for your advice. I’m learning fast!

Only you would know how often you will need to turn something on or off remotely so it’s up to you to see how it fits in to the community usage.

You should also consider that downlinks only happen when an uplink is made and that neither are guaranteed - so if something important or expensive to run or similar is plugged in, you may experience some unintended consequences in the future!

If the intended end location has any form of WiFi, I’d use that - LoRaWAN is fantastic for sensors uplinking a small (~25 bytes) payload every 15 minutes (or longer), running on batteries - anything else needs a good evaluation to see what any downsides of the technology may bring to the use case.

Rather use this one.

Also for now use v3/+/devices/+/up until you know it works, can make it device specific later.

These sockets are class C so should listen for downlinks all the time. (Power is not an issue for sockets)

Given the repeated joins there seems to be a RF issue for data to the socket. Given that such a socket is inherently near mains wiring that could well be an issue. You could try by plugging it into an extension lead and position it in such a way that there is no wiring close to the top.

Mine works fine like this:
However I do have 5 TTN gateways within 40 meters so it’s hardly representative for a normal deployment.

How far are you from the gateway?

Put it on a extension cord like @kersing suggested, and if the gateway is some distance, stick it in the window.

Thanks to both Jan and Johan. I’m thinking you are both correct - it appears the socket isn’t connecting to the local gateway. I’m in an suburban area, and - from the map - the nearest gateway is about 1Km away. As I’ve mentioned before, we do have a problem here in Perth - we build all our houses of double brick, so wireless transmission generally can be a problem! (And if you aren’t in Australia, which I suspect, we are the only city that does that. Everywhere else it is wooden framed. Why? Lost in the mists of time!!). I did suggest in a post yesterday that I’d try putting he socket into an outdoor plug - I’ve a convenient one at waist height on a wall that would have ‘line of sight’ to the gateway position. Of course, what I really need to do - and ultimately will - is to plug the socket in where I’m intending it to be used, and see what connection is like there. It might well be I am chasing an impossible dream! But we’ll see… Kind regards for your very helpful assistance. - Mike

Thanks, Nick, for your comments, but wifi isn’t really an option. In fact, it is the problem I’m trying to solve! Let me explain - and maybe you can advise me if I’m chasing a rainbow! I have some responsibility for a wifi network that is used by a large number of volunteers. I don’t have any responsibility (and as a volunteer myself, nor should I) for administration of the (‘corporate’) network infrastructure that this runs on. Occasionally, the volunteer network ‘fails’, and we have determined that the best and simplest way for us to get it up and running again is to power-cycle the AP. I fully accept that’s not what you’d probably do if you had admin responsibility for the network equipment, but it works - and we don’t! Now, the complication is that the power board for the AP is both about 3m high and inside a building that isn’t always open. So, currently, someone has to climb a ladder and cycle the AP and gateway router power (and that’s if the building is open) - if the network (which is reticulated via a VLAN over a wide area ) fails. So, in my dreams, I assumed we could power the AP and router via the LoRaWAN socket which, by definition, doesn’t need an active wifi signal. A bit of a chicken and egg issue! Then, if the wifi network failed, someone could - even from outside the building, and without risking life and limb climbing a ladder! - remotely power cycle the equipment and voila! A working network again! So now, perhaps you understand my dilemma? I had hoped (assumed?) we could use an app on a mobile phone to do this, but that may be way off beam. And it could be that I need to go back to the drawing board and determine a Plan B… :smiley:

Kind regards (and thanks for reading so far!!) - Mike

Jac - I will also add that you have given me great confidence in seeing another WS52 socket and knowing that it works!!

Thanks so much!


LOL, sure, but only in an over engineering sense!

Plan B - ESP8266 + relay - when no WiFi, turn on relay, wait 5 seconds, turn off relay. Relay is, of course, on the low power lead to the AP. [You can put it on the mains side if you know about mains]

This will solve the problem automagically without anyone having to get an alert to act on (or forget to do).

Although you may want to investigate why the AP goes off line and/or fundraise for a reliable one.

Thanks Nick. I like your Plan V! Not sure if fundraising for a new AP is a valid concept, though…LOL! You’d understand why if I told you more!! Kind regards - Mike

OK, me again! I took the socket to where I’d intended it to go, and left it plugged in, close to a window. And I seem to be seeing some ‘action’. From the TN map, I can see that I should be in range of at least a couple of gateways, and the messages I can see (see attached screen shot)
do seem to be different than those I saw when the socket was at home.

Screenshot 2022-04-03 152954

I still cannot see anything in the TTN MQTT server, even subscribing to v3/+/devices/+/up as suggested - and that’s a worry. So, is the socket doing ‘anything’? (Of course, I don’t currently have physical access to it - it’s in a locked building). So, am I getting a connection, or just still fooling myself? And if I am, why no information in the MQTT server, as Johan suggests? Thanks again for all the help…