0x5e / homebridge-tuya-platform

Make homebridge-tuya-platform great again.
MIT License
206 stars 58 forks source link

Change DP Code not changing the command #422

Open zero1niner opened 6 months ago

zero1niner commented 6 months ago

Prerequisite

Cache

Version

v1.7.0-beta.52

Device Infomation JSON File

{
    "name": "Tuya",
    "options": {
        "projectType": "2",
        "endpoint": "https://openapi.tuyaus.com",
        "accessId": "REMOVED",
        "accessKey": "REMOVED",
        "countryCode": 1,
        "username": "REMOVED",
        "password": "REMOVED",
        "appSchema": "smartlife",
        "deviceOverrides": [
            {
                "id": "REDACTED..6i8ay"
            },
            {
                "id": "REDACTED..fre1f",
                "schema": [
                    {
                        "code": "switch",
                        "newCode": "light"
                    }
                ]
            }
        ],
        "debug": true
    },
    "platform": "TuyaPlatform"
}

Device Control Mode

DP Instructions

Logs

"access_token": "REMOVED",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.52"
}
body = {
  "commands": [
    {
      "code": "switch",
      "value": false
    }
  ]
}
[17/12/2023, 10:47:58] [Tuya] [TuyaOpenAPI] Response:
path = /v1.0/devices/REMOVED/commands
data = {
  "result": true,
  "success": true,
  "t": 1702838878019,
  "tid": "cbd1b50e9d0c11eeb3d41ef8a6fbee67"
}

Other Infomations

Having an issue with the Change DP Code function for an electric fireplace. The code is turning the 'heater' component of the fireplace on and off, but not the actual fireplace lights which is what I want.

Changed the Standard Instructions to DP Instructions. From the IOT tuya dashboard in device debug mode, I can send a JSON command for ' "code": "light", "value": true ', and the fireplace lights turn on (and false turns it off correctly). Following the instructions in the 'Change DP Code' example, which I have done by changing the schema deviceOverrides example by adding "code": "switch" to "newCode": "light", but in the log its still showing 'switch'.

Any idea what I might be doing wrong? Goal is to send a true or false command to the DP code 'light' instead of 'switch'

danglez83 commented 6 months ago

Any luck @zero1niner? I have been trying to get my fireplace working for quite a while. Sounds like you got further than I, any chance you can reach out for some pointers?

zero1niner commented 6 months ago

@danglez83 , I have not had much luck with this plugin. I wish I better understood the structure of the plugin. All of the documentation is written for people with higher skill levels than I have.

I was able to get the fireplace to turn on the light only (not turning on the heater) with homebridge-tuya-platform-local plugin. Its not perfect yet, but at least I was able to control turning on and off the flame lights without turning on the heater, which is how we will use it 98% of the time. Tonight Ill be testing including this device in my Goodnight scene, and making sure it turns off along with the other devices in that scene.

What I did to get that local version working was to see what code was showing in the log when I turned it on and off from the SmarLife app, then added the code '101' to the 'Dp Active' field, and that got the lights only turning on and off.

Ill keep working on this and report back any progress if that helps you at all.

danglez83 commented 6 months ago

Actually, similar to you, turning on the flames is all I want to do. I will never use the heater. All the flame colors and brightness levels are already configured the way I like them, I just want to be able to turn the thing on and off and I would be happy. I’m a web developer and still find the docs a bit vague.

On Dec 20, 2023, at 10:40 PM, zero1niner @.***> wrote:



@danglez83https://github.com/danglez83 , I have not had much luck with this plugin. I wish I understood how the structure of the plugin. All of the documentation is written for people with higher skill levels than I have.

I was able to get the fireplace to turn on the light only (not turning on the heater) with homebridge-tuya-platform-localhttps://github.com/hmenzagh/homebridge-tuya-platform-local plugin. Its not perfect yet, but at least I was able to control turning on and off the flame lights without turning on the heater, which is how we will use it 98% of the time. Tonight Ill be testing including this device in my Goodnight scene, and making sure it turns off along with the other devices in that scene.

What I did to get that local version working was to see what code was showing in the log when I turned it on and off from the SmarLife app, then added the code '101' to the 'Dp Active' field, and that got the lights only turning on and off.

Ill keep working on this and report back any progress if that helps you at all.

— Reply to this email directly, view it on GitHubhttps://github.com/0x5e/homebridge-tuya-platform/issues/422#issuecomment-1865430859, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKAOGK37GYYZ2KNZJS25LGDYKOVR5AVCNFSM6AAAAABAYRNA42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRVGQZTAOBVHE. You are receiving this because you were mentioned.Message ID: @.***>

danglez83 commented 6 months ago

I looked in the Tuya logs for turning my fireplace on and off and this is all it shows:

image

danglez83 commented 6 months ago

Finally got mine working! I needed to overwrite the “open” code, which is what my fireplace uses to toggle power, with “switch” code. And that was it. Wish I could just convert the HomeKit control to a switch UI element as opposed to a heater, but I’ll take it.

On Dec 20, 2023, at 10:45 PM, Rich Ricciardi @.***> wrote:

 Actually, similar to you, turning on the flames is all I want to do. I will never use the heater. All the flame colors and brightness levels are already configured the way I like them, I just want to be able to turn the thing on and off and I would be happy. I’m a web developer and still find the docs a bit vague.

On Dec 20, 2023, at 10:40 PM, zero1niner @.***> wrote:



@danglez83https://github.com/danglez83 , I have not had much luck with this plugin. I wish I understood how the structure of the plugin. All of the documentation is written for people with higher skill levels than I have.

I was able to get the fireplace to turn on the light only (not turning on the heater) with homebridge-tuya-platform-localhttps://github.com/hmenzagh/homebridge-tuya-platform-local plugin. Its not perfect yet, but at least I was able to control turning on and off the flame lights without turning on the heater, which is how we will use it 98% of the time. Tonight Ill be testing including this device in my Goodnight scene, and making sure it turns off along with the other devices in that scene.

What I did to get that local version working was to see what code was showing in the log when I turned it on and off from the SmarLife app, then added the code '101' to the 'Dp Active' field, and that got the lights only turning on and off.

Ill keep working on this and report back any progress if that helps you at all.

— Reply to this email directly, view it on GitHubhttps://github.com/0x5e/homebridge-tuya-platform/issues/422#issuecomment-1865430859, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKAOGK37GYYZ2KNZJS25LGDYKOVR5AVCNFSM6AAAAABAYRNA42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRVGQZTAOBVHE. You are receiving this because you were mentioned.Message ID: @.***>

zero1niner commented 6 months ago

Excellent! Did you get that working in this plugin, or did you get that in the Tuya Local one?

danglez83 commented 6 months ago

I used this one: https://github.com/0x5e/homebridge-tuya-platform

On Dec 21, 2023, at 3:39 PM, zero1niner @.***> wrote:



Excellent! Did you get that working in this plugin, or did you get that in the Tuya Local one?

— Reply to this email directly, view it on GitHubhttps://github.com/0x5e/homebridge-tuya-platform/issues/422#issuecomment-1866901646, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKAOGK7JNMQAQVJBFCRBE4DYKSM55AVCNFSM6AAAAABAYRNA42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRWHEYDCNRUGY. You are receiving this because you were mentioned.Message ID: @.***>

zero1niner commented 6 months ago

You're way ahead of me then. I couldnt get the fireplace to work with that one.

danglez83 commented 6 months ago

What errors were you getting, perhaps I can help?

On Dec 21, 2023, at 4:10 PM, zero1niner @.***> wrote:



You're way ahead of me then. I couldnt get the fireplace to work with that one.

— Reply to this email directly, view it on GitHubhttps://github.com/0x5e/homebridge-tuya-platform/issues/422#issuecomment-1866934148, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKAOGK3XJMG5YEAFIFZCQZ3YKSQTFAVCNFSM6AAAAABAYRNA42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRWHEZTIMJUHA. You are receiving this because you were mentioned.Message ID: @.***>