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

Trying to use Tuya IR devices with SmartIT #1314

Open
Wingman2 opened this issue Sep 11, 2024 · 1 comment
Open

Trying to use Tuya IR devices with SmartIT #1314

Wingman2 opened this issue Sep 11, 2024 · 1 comment

Comments

@Wingman2
Copy link

Hi
I was able to use IR devices from Tuya using local Tuya.

Devices like: https://www.zigbee2mqtt.io/devices/ZS06.html
I have the Wifi only. so no mqtt

I am able to send and record IR commands in 2 different models.
I could setup a basic UI to send IR commands with no problem.
Using Local Tuya
2024.9.0
@xZetsubou

I am trying to integrate SmartIR because of the nice UI.

Here is where problems begin.

When trying to send using SmartIR I get this errors in the logs. The values to send look ok.

Error executing service: <ServiceCall remote.send_command (c:01J7E4VNCSQAP3D4KMNVE9KYG1): entity_id=['remote.smart_ir'], command=['b64:GhEaESYCXQYmAiYCJgJdBiYCXQYmAiYCJgImAiYCXQYmAiYCJgImAiYCXQYmAiYCJgImAiYCXQYmAl0GJgImAiYCXQYmAl0GJgImAjDyXQYmAl0GJgJdBiYCXQYmAl0GJgJdBiYCJgImAl0GJgImAiYCJgImAiYCJgImAiYCJgImAiYCJgImAiYCJgImAiYCJgJdBiYCJgImAiYCJgImAiYCJgImAl0GJgJdBiYCXQYmAiYCJgJdBiYCXQYmAl0GJgJdBiYCZRQaERoRJgJdBiYCJgImAl0GJgJdBiYCJgImAiYCJgJdBiYCJgImAiYCJgJdBiYCJgImAiYCJgJdBiYCXQYmAiYCJgJdBiYCXQYmAiYCJgJdBiYCXQYmAl0GJgJdBiYCXQYmAl0GJgImAiYCXQYmAiYCJgImAiYCJgImAiYCJgImAiYCJgImAiYCJgImAiYCJgImAl0GJgImAiYCJgImAiYCJgImAiYCXQYmAl0GJgJdBiYCJgImAl0GJgJdBiYCXQYmAl0GJgIwdQ=='], delay_secs=0.5, num_repeats=1, hold_secs=0.0>

homeassistant.exceptions.ServiceValidationError: Missing required fields

Sending this works in the Actions tab for developers
Local Tuya looks like it uses device ID

action: remote.send_command
target:
device_id: 71fa5ada67cd3dde3c8bb5884c7be8db
data:
command: Apagar !!!Here it uses the "command" to point to the IR code.
num_repeats: 1
delay_secs: 0.4
hold_secs: 0
device: Aire_Zoe !Here it point to the device.

This codes are saved in localtuya_remotes_codes in a different way.

{
"version": 1,
"minor_version": 1,
"key": "localtuya_remotes_codes",
"data": {
"ebe3e460ee7566fb97vut1": { <------- IR device ID
"Aire_Oficina": { <------- device ID name for TV, HVAC or "bedroom tv"
"Encender": "8SB3EDIC/wUyAucBMgLnATIC5wEyAv8FMgLnATIC5wEyAucBMgLnATIC5wEyAucBMgLnATIC5wEyAv8FMgLnATIC5wEyAv8FMgLnATIC/wUyAv8FMgLnATIC5wEyAv8FMgLnATIC5wEyAucBMgLnATIC/wUyAjB1",
"Modo_Calefaccion": "0SB3EDIC/gUyAvABMgLwATIC8AHwAf4FMgLwATIC8AEyAvABMgLwATIC8AEyAvABMgLwATIC/gUyAv4FMgLwATIC8AHwAf4FMgLwATIC/gUyAv4FMgLwATIC8AEyAvABMgLwATIC8AEyAv4FMgL+BTIC/gUyAjB1",

My problem is making smartIR to send this IR commands.

I did try to copy the IR codes in a device json but I can´t get it to send it.

Home Assistant

Core 2024.9.1
Supervisor 2024.08.0
Operating System 13.1
Frontend 20240906.0

SmartIR
1.17.9
@smartHomeHub

SmartIR configuration
smartir:

climate:

  • platform: smartir
    name: AC Comedor
    unique_id: ac_comedor
    device_code: 1070
    controller_data: remote.smart_ir
    temperature_sensor: sensor.smart_ir_temperatura
    humidity_sensor: sensor.smart_ir_humedad

Sensors are working with no problem.

Sample code
Code 1070 with custom codes.
{
"manufacturer":"LG",
"supportedModels":[
"PC09SQ NSJ"
],
"commandsEncoding":"Base64",
"supportedController":"Broadlink",
"minTemperature":17,
"maxTemperature":30,
"precision":1,
"device":"Aire_Zoe",
"operationModes":[
"cool",
"heat",
"dry",
"fan_only",
"auto"
],
"fanModes":[
"auto",
"low",
"mid",
"high"
],
"commands":{
"off":"Apagar",
"cool":{
"auto":{
"17":"FxEXEScCWgYnAicCJwJaBicCWgYnAicCJwInAicCWgYnAicCJwInAicCWgYnAicCJwInAicCWgYnAloGJwInAicCWgYnAloGJwInAicCWgYnAloGJwJaBicCWgYnAloGJwJaBicCJwInAloGJwInAicCJwInAicCJwInAicCJwInAicCJwInAicCJwInAicCJwInAicCJwInAicCJwInAicCJwInAloGJwJaBicCWgYnAloGJwJaBicCWgYnAloGJwJaBicCZBQXERcRJwJaBicCJwInAloGJwJaBicCJwInAicCJwJaBicCJwInAicCJwJaBicCJwInAicCJwJaBicCWgYnAicCJwJaBicCWgYnAicCJwJaBicCWgYnAloGJwJaBicCWgYnAloGJwInAicCWgYnAicCJwInAicCJwInAicCJwInAicCJwInAicCJwInAicCJwInAicCJwInAicCJwInAicCJwInAicCWgYnAloGJwJaBicCWgYnAloGJwJaBicCWgYnAloGJwIwdQ==",
"18":"GhEaESYCXQYmAiYCJgJdBiYCXQYmAiYCJgImAiYCXQYmAiYCJgImAiYCXQYmAiYCJgImAiYCXQYmAl0GJgImAiYCXQYmAl0GJgImAjDyXQYmAl0GJgJdBiYCXQYmAl0GJgJdBiYCJgImAl0GJgImAiYCJgImAiYCJgImAiYCJgImAiYCJgImAiYCJgImAiYCJgJdBiYCJgImAiYCJgImAiYCJgImAl0GJgJdBiYCXQYmAiYCJgJdBiYCXQYmAl0GJgJdBiYCZRQaERoRJgJdBiYCJgImAl0GJgJdBiYCJgImAiYCJgJdBiYCJgImAiYCJgJdBiYCJgImAiYCJgJdBiYCXQYmAiYCJgJdBiYCXQYmAiYCJgJdBiYCXQYmAl0GJgJdBiYCXQYmAl0GJgImAiYCXQYmAiYCJgImAiYCJgImAiYCJgImAiYCJgImAiYCJgImAiYCJgImAl0GJgImAiYCJgImAiYCJgImAiYCXQYmAl0GJgJdBiYCJgImAl0GJgJdBiYCXQYmAl0GJgIwdQ==",
"19":"DxEPESgCVwYoAigCKAJXBigCVwYoAigCKAIoAigCVwYoAigCKAIoAigCVwYoAigCKAIoAigCVwYoAlcGKAIoAigCVwYoAigCKAJXBigCVwYoAlcGKAJXBigCKAIoAlcGKAJXBigCVwYoAigCKAIoAigCKAIoAigCKAJXBigCKAIoAigCKAJXBigCVwYoAlcGKAIoAigCKAIoAigCKAIoAigCKAIoAigCKAIoAigCKAIoAlcGKAJXBigCVwYoAlcGKAJXBigCghQPEQ8RKAJXBigCKAIoAlcGKAJXBigCKAIoAigCKAJXBigCKAIoAigCKAJXBigCKAIoAigCKAJXBigCVwYoAigCKAJXBigCKAIoAlcGKAJXBigCVwYoAlcGKAIoAigCVwYoAlcGKAJXBigCKAIoAigCKAIoAigCKAIoAlcGKAIoAigCKAIoAlcGKAJXBigCVwYoAigCKAIoAigCKAIoAigCKAIoAigCKAIoAigCKAIoAigCVwYoAlcGKAJXBigCVwYoAlcGKAIwdQ==",
"20":"JgBAAGgAAUQQNBESEBIQEhA0EBIPEw8TDxMPEw8TDxMPEhASEBIQEhASEDQPEw80EBIQMxESEDQQNBASEDUPEhAADQUAAAAAAAAAAA==",
"21":"JgBAAGkAAUQQNBATDxIQEw80EBIQEhASEBIQEhASEBIPEw8TDxMPEw8TDzQQNA8TDxMPNBASEDUPNQ8SEDUPNBAADQUAAAAAAAAAAA==",
"22":"JgBAAGkAAUQQNBASEBIQEhA0DxMPEw8SERIPEw8TDxIQEw8TDxIQEhASEDQQNA81EBIQNBASEDQQNBA0DxMPEw8ADQUAAAAAAAAAAA==",
"23":"JgBAAGoAAUMQNBESEBIQEREzERERERERERERERASEBIQEhASEBEREREzEREQEhASEBERMxESEDMRMxEzEhARMxAADQUAAAAAAAAAAA==",
"24":"JgBAAGoAAUMQNBIREBIQEhAzERIQEhAREREREREREBIRERASEBIQEREzERERERA0EBERMxEREjMQMxEzETMREBIADQUAAAAAAAAAAA==",
"25":"JgBAAGsAAUESMhMQEhASEBIyEhARERERERASEBIQEhASEBEREREQEhEzEREQNBIQEhASMhERETISMhIzETISMhIADQUAAAAAAAAAAA==",
"26":"JgBAAG4AAUMSMhEREREREREyEhERERERERASEBEREREREREREREPExEyEhARMxA0EBISMhEREjIQEg8TEREREREADQUAAAAAAAAAAA==",
"27":"JgBAAGwAAUQSMhASERMOEw81DxMPEhASEBIQEg8TDxMPEw8SEBIQEhA1DzUPEhASERIPNQ8TDzQQEhASEBIPNQ8ADQUAAAAAAAAAAA==",


I was trying to find a way to see if I can add the missing field in some way. So I can continue experimenting. 

Thanks!.
@Wingman2
Copy link
Author

Wingman2 commented Sep 11, 2024

Following this changes
1167e8f

I was able to add the device. Just hard coded the device name and it works

in controller.py


class TuyaController(AbstractController):
    """Controls a Tuya device."""

    def check_encoding(self, encoding):
        """Check if the encoding is supported by the controller."""
        if encoding not in TUYA_COMMANDS_ENCODING:
            raise Exception("The encoding is not supported "
                            "by the Tuya controller.")

    async def send(self, command):
        """Send a command."""
        service_data = {
            ATTR_ENTITY_ID: self._controller_data,
            'command':  command,
            'delay_secs': self._delay,
            **"device": "Aire_Zoe"**    <---- hard coded.
        }

        await self.hass.services.async_call(
            'remote', 'send_command', service_data)


New config file json
{
"manufacturer":"LG",
"supportedModels":[
"PC09SQ NSJ"
],
"commandsEncoding":"Tuya",
"supportedController":"Tuya",
"minTemperature":17,
"maxTemperature":25,
"precision":1,
"device":"Aire_Zoe",
"operationModes":[
"cool",
"heat",
"dry",
"fan_only",
"auto"
],
"fanModes":[
"auto",
"low",
"mid",
"high"
],
"commands":{
"off":"Apagar",
"cool":{
"auto":{
"17":"Cool_Auto_17",
"18":"Cool_Auto_18",
"19":"Cool_Auto_19",
"20":"Cool_Auto_20",
"21":"Cool_Auto_21",
"22":"Cool_Auto_22",
"23":"Cool_Auto_23",
"24":"Cool_Auto_24",
"25":"Cool_Auto_25"
},

in tuya remtes codes file It saves the codes like


 "Aire_Zoe": {
        "Apagar": "TBEmERMCeAYTAjICFAJ4B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WgYnAicCJwJaBicCWgYnAicCJwJaBicCWgYnAloGJwJaBicCWgYnAloGJwInAicCWgYnAicCJwInAicCJwInAicCJwInAicCJwInAloGJwJaBicCJwInAicCJwInAicCJwInAicCJwInAicCJwInAicCJwJaBicCWgYnAloGJwJaBicCWgYnAloGJwIwdQ=="
      }

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

No branches or pull requests

1 participant