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

Injecting IP address question #37

Closed mobamoba closed 4 years ago

mobamoba commented 4 years ago

Describe the bug This isn't a bug but rather just making sure I understand the documentation. The node requires an IP address for proper configuration. However, I see in the documentation that I can also enter an IP via msg.topic. So are you saying that the msg.topic injection will override whatever I typed in the IP configuration of the device? Also does it matter if the msg.topic IP is formatted as a string or a number?

I'm asking because Kasa doesn't allow static IPs and my router is flaky and sometimes changes the IP even though I explicitly tell it not to. However, I can look up the MAC address via ARP, pull the IP from that, and inject it which would overcome the limitations of my system but I just want to make sure I'm doing the injection properly.

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.

hufftheweevil commented 4 years ago

Good questions.

Yes, the msg.topic will override the configured properties.

IP must be a string, since it contains multiple .s

What kind of router are you using? If you setup DHCP reservations, then it should never change.

mobamoba commented 4 years ago

Sadly my Netgear router firmware just blows. Despite setting a DHCP reservation by MAC address, I've had it randomly reassign my devices to a different IP - and it often won't clear the DHCP even on a reboot. There must be a firmware bug somewhere and since Im guessing Netgear's never going to fix it and since Node Red has an ARP module I figured checking the ARP table then injecting the IP might be the best workaround.

mobamoba commented 4 years ago

Also I just noticed the msg.topic IP injection doesn't work. I tried putting the wrong IP into the configuration then using msg.topic to put in the correct IP and it didn't work at all (couldn't find the device). When I typed the correct IP into the configuration, it worked fine.

hufftheweevil commented 4 years ago

Have you forced update to v1.0.0-alpha.1? Note that @latest (v0.4.3) does not support that feature.

mobamoba commented 4 years ago

Aha. No, I haven't. I installed this via the Node Red Palette Manager so am no entirely clear how I would do that.

hufftheweevil commented 4 years ago

@mobamoba npm i node-red-contrib-tplink@1.0.0-alpha.1

@caseyjhol Yeah, I think it's time to release. It would close all 3 of these open issues.

mobamoba commented 4 years ago

I installed the alpha and everything seems to be working fine. Just a question though: for subscribing to events, would I need to reinject the subscription upon Node Red restart? Or does your node remember that I've subscribed? Same question with deploying, i.e. do I need to reinject the subscription after deploying or does it remember? Thanks.

hufftheweevil commented 4 years ago

You need to re-subscribe in both instances.

caseyjhol commented 4 years ago

v1.0.0 officially released!