smarthomej / addons

SmartHome/J addons for openHAB
Eclipse Public License 2.0
59 stars 23 forks source link

DP 17 add_ele updates not being received #534

Closed tglanfield closed 4 months ago

tglanfield commented 7 months ago

I'm not receiving regular DP 17 add_ele from my Tuya devices. I can see the updates on Tuya IoT site so know the device is working. I'm receiving the other DP IDs on a regular basis.

Log file deleting and reconfiguring one of my devices. https://pastebin.com/2AiGZWr3

I can provoke an update of all DPs by changing the interval: https://pastebin.com/Fg10W6jg

I'm running OpenHAB 4.0.4.

openhab> bundle:list | grep Smart
bundle:list | grep Smart
247 │ Resolved │  80 │ 4.0.0                  │ SmartHome/J Add-ons :: Bundles :: Tuya Binding
248 │ Resolved │  80 │ 4.0.0                  │ SmartHome/J Add-ons :: Bundles :: Common Components
323 │ Active   │  80 │ 4.0.1                  │ SmartHome/J Add-ons :: Bundles :: Tuya Binding
324 │ Active   │  80 │ 4.0.1                  │ SmartHome/J Add-ons :: Bundles :: Common Components
UID: tuya:tuyaDevice:bf75ebe95676c927d3cxal
label: Mains Trip 1 - Downstairs Lights
thingTypeUID: tuya:tuyaDevice
configuration:
  pollingInterval: 0
  productId: cipuwutzfuqk3iru
  deviceId: bf75ebe95676c927d3cxal
  localKey: -_/H0hBen+}7Levb
channels:
  - id: light_mode
    channelTypeUID: tuya:string
    label: light_mode
    description: null
    configuration:
      dp: 40
      range: relay,pos,none,on
  - id: cur_voltage
    channelTypeUID: tuya:number
    label: cur_voltage
    description: null
    configuration:
      dp: 20
      max: 5000
      min: 0
  - id: cur_power
    channelTypeUID: tuya:number
    label: cur_power
    description: null
    configuration:
      dp: 19
      max: 34500
      min: 0
  - id: test_bit
    channelTypeUID: tuya:number
    label: test_bit
    description: null
    configuration:
      dp: 21
      max: 5
      min: 0
  - id: electric_coe
    channelTypeUID: tuya:number
    label: electric_coe
    description: null
    configuration:
      dp: 23
      max: 1000000
      min: 0
  - id: relay_status
    channelTypeUID: tuya:string
    label: relay_status
    description: null
    configuration:
      dp: 38
      range: power_off,power_on,last
  - id: cur_current
    channelTypeUID: tuya:number
    label: cur_current
    description: null
    configuration:
      dp: 18
      max: 100000
      min: 0
  - id: temp_value
    channelTypeUID: tuya:dimmer
    label: temp_value
    description: null
    configuration:
      dp: 47
      max: 999
      min: 0
  - id: add_ele
    channelTypeUID: tuya:number
    label: add_ele
    description: null
    configuration:
      dp: 17
      max: 50000
      min: 0
  - id: switch
    channelTypeUID: tuya:switch
    label: switch
    description: null
    configuration:
      dp: 1
  - id: electricity_coe
    channelTypeUID: tuya:number
    label: electricity_coe
    description: null
    configuration:
      dp: 25
      max: 1000000
      min: 0
  - id: power_coe
    channelTypeUID: tuya:number
    label: power_coe
    description: null
    configuration:
      dp: 24
      max: 1000000
      min: 0
  - id: voltage_coe
    channelTypeUID: tuya:number
    label: voltage_coe
    description: null
    configuration:
      dp: 22
      max: 1000000
      min: 0
  - id: countdown_1
    channelTypeUID: tuya:number
    label: countdown_1
    description: null
    configuration:
      dp: 9
      max: 86400
      min: 0
​
tglanfield commented 7 months ago

As an attempt to work around this lack of updates, I've introduced rules that modify the thing's Polling Interval on a regular interval. This forces the channel to the device to be closed and a refresh obtained from the device that includes all of the DP IDs.

This works up to a point and I'm getting the information but after a while I'm getting these sort of errors:

[WARN ] [nding.tuya.internal.local.TuyaDevice] - bfc952e2bb967bf1ednhqz: Refreshing status failed. Device is not connected.

Here is a trace showing this happening: https://pastebin.com/tvaYPVhc

After a little while longer I'm seeing my Tuya things go offline requiring a restart to get them back again.

J-N-K commented 7 months ago

The devices requiring a restart is probably a bug in the device firmware. A lot of Tuya devices are really crappy.

What functionality is "add_ele"? Some are not refreshed on a regular basis (and no one knows why...).

tglanfield commented 7 months ago

I'm not restarting the device, just reconnecting to it, which, as I understand it, is a byproduct of changing the Polling Interval.

add_ele is the electricity used in the last period, since this counter was last reset, which appears to be every half hour or so. This DP is being updated on the Tuya IoT site and I have no reason to doubt that the information is available in the device. It's just a matter of getting hold of it.

stale[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.