Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to invert the shutter state #7737

Closed
1 task done
sanluca opened this issue May 1, 2024 · 8 comments · Fixed by #7739
Closed
1 task done

to invert the shutter state #7737

sanluca opened this issue May 1, 2024 · 8 comments · Fixed by #7739

Comments

@sanluca
Copy link

sanluca commented May 1, 2024

Is there already an existing issue for this?

  • I have searched the existing issues and there is none for my device

Product name

roller shutter

Manufacturer

_TZ3000_iaxvag8w

Model identifier

TS130F

Device type to add

Other

Node info

I'm using a _TZ3000_iaxvag8w roller shutter module produced by TS130F. However, I'm facing an issue with OpenHAB. The roller shutter module indicates a fully open state as 100% and a closed state as 0%. Conversely, OpenHAB interprets the states differently: 0% indicates an open shutter and 100% indicates a closed one. Is there a way to invert the state of the Zigbee module?
thanks

Endpoints and clusters

.

Basic

basic

Further relevant clusters

Power Configuration

On/Off

Level Control

Color Control

Thermostat

Simple Metering

Electrical Measurement

Any other cluster of relevance/interest

@sanluca
Copy link
Author

sanluca commented May 1, 2024

This is the DDF file

{ "schema": "devcap1.schema.json", "manufacturername": "_TZ3000_iaxvag8w", "modelid": "TS130F", "product": "TS130F", "sleeper": false, "status": "Draft", "subdevices": [ { "type": "$TYPE_WINDOW_COVERING_DEVICE", "restapi": "/lights", "uuid": [ "$address.ext", "0x01" ], "items": [ { "name": "attr/id" }, { "name": "attr/lastannounced" }, { "name": "attr/lastseen" }, { "name": "attr/manufacturername" }, { "name": "attr/modelid" }, { "name": "attr/name" }, { "name": "attr/swversion" }, { "name": "attr/type" }, { "name": "attr/uniqueid" }, { "name": "state/bri", "description": "The current brightness.", "refresh.interval": 5 }, { "name": "state/lift", "description": "The lift state of a roller blind.", "refresh.interval": 300, "default": 0 }, { "name": "state/on", "description": "True when device is on; false when off.", "refresh.interval": 5 }, { "name": "state/open", "description": "True when open is detected." }, { "name": "state/reachable" } ] } ], "bindings": [ { "bind": "unicast", "src.ep": 1, "dst.ep": 1, "cl": "0x0102", "report": [ { "at": "0x0008", "dt": "0x20", "min": 1, "max": 300, "change": "0x00000001" } ] } ] }

@Smanar
Copy link
Collaborator

Smanar commented May 1, 2024

OpenHAB interprets the states differently: 0% indicates an open shutter and 100% indicates a closed one

Same for deconz ^^

shutter closed
on = true
bri = 255
open = false
lift = 100%

Can you try this DDF

{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZ3000_iaxvag8w",
  "modelid": "TS130F",
  "product": "TS130F",
  "sleeper": false,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_WINDOW_COVERING_DEVICE",
      "restapi": "/lights",
      "uuid": [
        "$address.ext",
        "0x01"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "tuya_swversion.js"},
          "read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "state/lift",
          "parse": {
            "at": "0x0008",
            "cl": "0x0102",
            "ep": 5,
            "eval": "Item.val = 100 - Attr.val;",
            "fn": "zcl:attr"
          }
        },
        {
          "name": "state/open",
          "parse": {
            "at": "0x0008",
            "cl": "0x0102",
            "ep": 5,
            "eval": "Item.val = Attr.val > 1",
            "fn": "zcl:attr"
          }
        },
        {
          "name": "state/reachable"
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "dst.ep": 1,
      "cl": "0x0102",
      "report": [
        {
          "at": "0x0008",
          "dt": "0x20",
          "min": 1,
          "max": 300,
          "change": "0x00000001"
        }
      ]
    }
  ]
}

For information;

  • Have reversed return for "state/lift" and " state/open", you can see the convertion on code.
  • Have removed state/on and state/bri, now deprecated for covering, It's fine on OpenHAB ATM.
  • Have removed "refresh.interval" to use only bind/report or native poll value
  • Have added the tuya swversion, you can miss it if you don't put the file on the good folder (relative path), but it don't prevent the DDF to work.

@sanluca
Copy link
Author

sanluca commented May 1, 2024

I'm trying to find the file to modify it, but the strange thing is that the GUI tells me that the file doesn't exist. How can I do it? I'm attaching screenshots, thanks.

Immagine

@sanluca
Copy link
Author

sanluca commented May 1, 2024

Ok, I managed to do it, I created the file and renamed it as you can see in the screenshot, only that if I do it on Phoscon it doesn't update the status, it always stays closed.

Immagine
Immagine2
Immagine3

@Smanar
Copy link
Collaborator

Smanar commented May 1, 2024

On openHAB you probably have a classic OS

All DDF provided directly with deCONZ typically reside in /usr/share/deCONZ/devices/ on a Linux system and are loaded first. However, files residing in the home directory of the user running deCONZ (e.g. /home//.local/share/dresden-elektronik/deCONZ/devices) will override the pre-packaged files to allow users to amend and keep their own files if desired.

This DDF is a new one, so you need to create a text file called what_you_want.json with this contain (in a "devices" folder, the tuya one is perefct).

On your capture it seem fine (the name in editor)

For test, can you try with OpenHAB, it think it have a better suppport than Phoscon for covering.

And BTW I have used the bad ep in my DDF, sorry, have corrected it

{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZ3000_iaxvag8w",
  "modelid": "TS130F",
  "product": "TS130F",
  "sleeper": false,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_WINDOW_COVERING_DEVICE",
      "restapi": "/lights",
      "uuid": [
        "$address.ext",
        "0x01"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "tuya_swversion.js"},
          "read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "state/lift",
          "parse": {
            "at": "0x0008",
            "cl": "0x0102",
            "ep": 1,
            "eval": "Item.val = 100 - Attr.val;",
            "fn": "zcl:attr"
          }
        },
        {
          "name": "state/open",
          "parse": {
            "at": "0x0008",
            "cl": "0x0102",
            "ep": 1,
            "eval": "Item.val = Attr.val > 1",
            "fn": "zcl:attr"
          }
        },
        {
          "name": "state/reachable"
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "dst.ep": 1,
      "cl": "0x0102",
      "report": [
        {
          "at": "0x0008",
          "dt": "0x20",
          "min": 1,
          "max": 300,
          "change": "0x00000001"
        }
      ]
    }
  ]
}

@sanluca
Copy link
Author

sanluca commented May 1, 2024

Perfect, now it works! I use a Linux system (Ubuntu) with OpenHAB 4.1.2, I put the file in the tuya directory, as in the screenshot, now OpenHAB reads the status correctly, and Phoscon also updates, even if it no longer appears closed, but it doesn't matter.

Will this file be added in the new update?

Thank you for your time.

@Smanar
Copy link
Collaborator

Smanar commented May 2, 2024

Np, you have spend more time than me ^^.
PR submited here #7739

Copy link
Contributor

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants