jasonacox / powermonitor

Monitor power usage through WiFi Smart Plug
MIT License
63 stars 7 forks source link

Doesn't work with these Tuya smart sockets #5

Open oriwheb opened 4 years ago

oriwheb commented 4 years ago

Both docker and native options didn't yield any information for me for this product: https://www.aliexpress.com/item/32975898978.html?spm=a2g0s.9042311.0.0.27424c4dtPBf8A

My output is as follows:

PS C:\Users\...\Desktop\powermonitor-master> docker run -t -e PLUGID='44563025d8f15bc2f8b6' -e PLUGIP="<Device's Local IP Address>" jasonacox/powermonitor
Polling Device 44563025d8f15bc2f8b6 at <Device's Local IP Address> with key 0123456789abcdef
Unexpected status() payload=b''
Dictionary b''
Unexpected status() payload=b''
Dictionary b''
Unexpected status() payload=b''
Dictionary b''
ERROR: No response from plug 44563025d8f15bc2f8b6 [<Device's Local IP Address>].

I tried with my Global IP Address as well just to make sure I did not misunderstand and that's what the script expects:

PS C:\Users\...\Desktop\powermonitor-master> docker run -t -e PLUGID='44563025d8f15bc2f8b6' -e PLUGIP="<My Global IP Address>" jasonacox/powermonitor
Polling Device 44563025d8f15bc2f8b6 at <My GlobalIP Address> with key 0123456789abcdef
ERROR: No response from plug 44563025d8f15bc2f8b6 [<My Global IP Address>].
jasonacox commented 4 years ago

The IP address needs to the IP address of the plug, not your computer. The smart plug will join your wireless network and will be assigned an IP address by your router. To poll the smart plug, you will need to determine what IP address your network assigned to the Smart Plug - tools like arp-scan can help identify devices on your network. WiFi Routers often have a list of devices connected as well. Look for devices with a name like "ESP_xxxxxx".

oriwheb commented 4 years ago

I know. That is what I entered. I gave the device a static IP. Sorry for making it seem like I entered my computer's IP.

jasonacox commented 4 years ago

Ha! Sorry about making the assumption. So to keep investigating, I would probably try:

     jason@minecraft3:~$ telnet 10.0.1.55 6668
     Trying 10.0.1.55...
     Connected to 10.0.1.55.
     Escape character is '^]'.
     U?3.183931e422d087d9fUvzFUQaCsTA77LvyI6cBhqmo3da37cvaaO0ZO5DHEz4EjKsLKyl6om7n35tccBsH7yLO3KP2kzqNByHJ5ymTLvBXLewy0eAeb+gOJsbK6ZvCjgfb915N+8QLHALZMkWM???U

If the plug is not listening on that port or it is blocked, it would return something like this:

    jason@minecraft3:~$ telnet 10.0.1.55 6668
    Trying 10.0.1.55...
    telnet: Unable to connect to remote host: Connection refused

If it isn't responding on port 6668, check your local system or network to make sure it isn't blocking that port.

oriwheb commented 4 years ago

So I double (by this time it's quadruple...) checked my device ID. No idea what you mean by "function".

I tried using Putty to connect to the device and got this Network error: Software caused connection abort

I checked my firewall and my router settings - nothing seems to be blocked anywhere (I turned my firewall off completely to be double sure while testing).

Could it simply be an issue of a different port being used for the sockets made for Israel?

codeclinic commented 4 years ago

@oriwheb Not all Tuya based devices report the energy stats, it's up to the manufacturer of the device to enable this. Looking at the link for the product, I can't see anywhere that hose switches do give energy data output.

Do your devices report power stats in the Tuya / Smart Life app? If not, then you -presumably- won't be able to grab them via this library either.