subzero79 / node-red-contrib-tuya-local

NodeRED node to control tuya devices locally. Based on tuyapi module
29 stars 17 forks source link

Is This really Local? Power values are shown Nan When internet is disconnected. #28

Open ceaswaran opened 4 years ago

ceaswaran commented 4 years ago

I managed to configure this node in node-red for my PowerMonitoring Plug It works fine. I am able to Turn ON/OFF view the Voltage/ Current/Watts value.

But When I disconnect the internet access for the device (Plug). I am able to control (ON/OFF) the device locally thru lan, but not see the Voltage/ Current/Watts values.

These power values are always Nan when the Internet to the device is disconnected. image

I tried to make the Nodred config simple as below:

image

HA Config as follows:

switch :
  - platform: mqtt
    name: "3D Printer Tuya Local"
    state_topic: "hass/tlsw01"
    command_topic: "hass/tlsw01/set"
    payload_on: "true"
    payload_off: "false"
    state_on: "true"
    state_off: "false"
    optimistic: false
    qos: 0
    retain: true   

sensor:
   - platform: mqtt
     name: "3D Printer Watts"
     state_topic: "hass/tlsw01/watts"
     unit_of_measurement: W
     value_template: "{{ value | round(1) }}"
   - platform: mqtt
     name: "3D Printer Current"
     state_topic: "hass/tlsw01/amps"
     unit_of_measurement: A
     value_template: "{{ value | round(1) }}"
   - platform: mqtt
     name: "3D Printer Voltage"
     state_topic: "hass/tlsw01/volts"
     unit_of_measurement: V
     value_template: "{{ value | round(1) }}"

Please help

subzero79 commented 4 years ago

The interaction is totally local. However the behavior you see is expected from my experience and from reading around tuyapi related issues on google. Blame It on tuya fw. Best choice is to flash to esphome or tasmota. I can’t recall if this happens using the tuya app.

ceaswaran commented 4 years ago

Thanks, @subzero79 I tried this method because I cannot flashTasmoto or esphome to the device as the product that I bought (Without knowing I bought) uses TW-02-based (WinnerMicro W600-based) micro chip & not ESP 8266 based.

stevoh6 commented 3 years ago

Hi, there is couple of details why only "local" power statistics doesn't work and also possible solution with command 18. https://github.com/codetheweb/tuyapi/issues/417 https://github.com/jasonacox/tinytuya/issues/8

joe-sydney commented 3 years ago

Great job with this node! Is there a way to send Command 18 via the node? I have the same issue with power values not refreshing when the internet is blocked (intentionally) from the plug.

Also, is there a way to poll a particular dps for current value?

cheers Joe