caseyjhol / node-red-contrib-tplink

A collection of Node-RED nodes for TP-Link Smart Home devices
https://www.npmjs.com/package/node-red-contrib-tplink-iot
MIT License
16 stars 15 forks source link

Shows Online but does nothing #35

Closed mobamoba closed 3 years ago

mobamoba commented 4 years ago

Describe the bug I've had a few instances with a few different Smart Plugs where the device shows as Online but switching it on/off via Node Red (as opposed to manually) does absolutely nothing. The only way to fix this is to re-deploy the flow at which point things start working again.

This bug is random. Presumably if it's Online then that also means commands should be working but that's not the case nor am I sure why re-deploying somehow fixes it when literally else has changed in the system, but that's what happens and any help would be appreciated thanks.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

caseyjhol commented 4 years ago

What version of node-red-contrib-tplink are you using? Please try the latest release (v1.0.0-alpha.1) if not already on it and report back.

mobamoba commented 4 years ago

I installed from the Node Red palette manager which lists .43 as the latest.

caseyjhol commented 4 years ago

Right, it's tagged as the "next" release. It's still in alpha, so it isn't automatically installed.

mobamoba commented 4 years ago

Ah okay. I guess I can just wait until the alpha moves to stable and gets pushed out and see if the problem persists at that point.

caseyjhol commented 4 years ago

What model smart plugs are you using?

mobamoba commented 4 years ago

Mostly HS103s and a few HS110s.

hufftheweevil commented 3 years ago

@mobamoba Was this issue resolved by moving to 1.0.0? And can you confirm if the HS103s and HS110s are working with it?

mobamoba commented 3 years ago

Not really. The other day I had a device that looked like it was perfectly fine according to the little status info beneath the node (green light, told me it was Off, the power usage (it's an HS110)); however the log was filled with msg.error for that device due to a failure to sync the time. I don't know why it couldn't time sync since it also showed itself as connected to the internet nor do I know why that error would cause the device to cease working entirely, but the node itself gave zero information that it was having any kind of problem.

I solved it by removing the device and adding it back. All of my devices are LAN only with no account or remote connection and I'm not entirely clear on why a time sync error would prevent the node from working but it did and the node didn't show itself as having a problem, which is the equivalent of showing "Online" in the prior version while not really working at all.

hufftheweevil commented 3 years ago

What was the exact error message? It specifically mentioned "failure to sync the time"?

mobamoba commented 3 years ago

Here's the msg.error - it says err_msg:"time not sync"

Sep 19 08:17:08 galliumos Node-RED[16831]: 19 Sep 08:17:08 - [error] ResponseError: err_code response: {"emeter":{"get_realtime":{"current":0.012564,"voltage":122.15692,"power":0,"total":0.001,"err_code":0}},"schedule":{"get_next_action":{"err_code":-11,"err_msg":"time not sync"}},"system":{"get_sysinfo":{"err_code":0,"sw_ver":"1.2.5 Build 171206 Rel.085954","hw_ver":"1.0","type":"IOT.SMARTPLUGSWITCH","model":"HS110(US)","mac":"50:C7:BF:00:96:14","deviceId":"800646AD56B506EA38E1924B31D8D05516E3A58F","hwId":"60FF6B258734EA6880E186F8C96DDC61","fwId":"00000000000000000000000000000000","oemId":"FFF22CFF774A0B89F7624BFC6F50D5DE","alias":"TP-LINK_Smart Plug_9614","dev_name":"Wi-Fi Smart Plug With Energy Monitoring","icon_hash":"","relay_state":0,"on_time":0,"active_mode":"none","feature":"TIM:ENE","updating":0,"rssi":-71,"led_off":0,"latitude":0,"longitude":0}},"cnCloud":{"get_info":{"username":"","server":"devs.tplinkcloud.com","binded":0,"cld_connection":0,"illegalType":-1,"stopConnect":-1,"tcspStatus":-1,"fwDlPage":"","tcspInfo":"","fwNotifyType":0,"err_code":0}}} command: {"emeter":{"get_realtime":{}},"schedule":{"get_next_action":{}},"system":{"get_sysinfo":{}},"cnCloud":{"get_info":{}}}

hufftheweevil commented 3 years ago

That error appears to only be associated with the schedule of the plug. I don't think it should hinder the operation of it.

Did you disable Connection Polling by setting that Interval to 0? If that is disabled, then you won't get Online/Offline updates.

mobamoba commented 3 years ago

It did hinder the operation - the plug status showed as fine but it wouldn't turn on or off until that error resolved so there was a mismatch between the plug's ability to operate and the status indicator on the node.

And maybe I'm misunderstanding what Online/Offline means. I'm assuming that it means the plug is reachable by Node Red in which case I want that information since I want to know if my plug is unreachable by NR, for example if it randomly lost Wifi or somesuch. Does Connection Polling do something else?

hufftheweevil commented 3 years ago

Sorry for getting back so late, but yes, collection polling is just checking to make sure the devices are still reachable. Have you seen that "time not sync" error again?

mobamoba commented 3 years ago

I haven't seen that error again and I think it had to do with the the plugs trying to reach the Kasa server and getting blocked somewhere along the way rather than anything with your node.

hufftheweevil commented 3 years ago

Great! Let us know if you have any other issues