Telnet Switch Unique ID, how?

Hi,

I have a telnet switch in my configuration.yaml

switch:
  - platform: telnet
    switches:
      divaled:
        resource: 192.168.1.39
        port: 2210
        command_on: "set ledprofilevideo 1 \n"
        command_off: "set ledprofilevideo 0 \n"

as per Telnet - Home Assistant

The switch itself works, but I would like to assign a unique id so I can assign the switch to an area, however it seems this platform doesn’t allow unique_id (the documentation doesn’t list it as an option and with it inserted in my configuration.yaml it fails config check). Is there some way to set this up differently such that I can give it a unique id? Thanks

The Telnet Switch integration does not support this option at this time.

1 Like

Just so nobody else wastes their time … Out of curiosity I copied this entity and set “unique_id” through “customize.yaml”, but alas although it looks ok in Dev Tools, it does not trick the system into allowing the area to be set.

1 Like

Yes I understand this and already said this in my initial post. I was asking if there is some work around, do you know?

No, because it is not supported.

Hi, are there any work arounds I could employ you are aware of like creating some other entity type that fires of this one or maybe some automation type affair but where I have a switch for the front end.

You could try creating a template switch that turns on/off your telnet switch. Then you can put the template switch in the area you want.

1 Like

Perfect thanks. Bit of extra leg work for all the telnet switches but it works well. Thanks.

For anyone else later, here are my switches:

switch:
  - platform: telnet
    switches:
      divaled:
        resource: 192.168.1.39
        port: 2210
        command_on: "set ledprofilevideo 1\n"
        command_off: "set ledprofilevideo 0\n"
        command_state: "get ledprofilevideo\n"
        value_template: "{{ 'ledprofilevideo 1' in value }}"

  - platform: template
    switches:
      divaledtemplate:
        unique_id: divatemplateswitch
        turn_on:
          service: switch.turn_on
          target:
            entity_id: switch.divaled
        turn_off:
          service: switch.turn_off
          target:
            entity_id: switch.divaled

I had trouble with the value_template in the telnet switch. I validated in nodered with tcp request node that ‘get ledprofilevideo\n’ returned ‘ledprofilevideo 1\n’ but it simply refuses to evaluate as true. I assume its something to do with how the carriage return is being treated, maybe to evaluate equivalence in template \n is not the correct term (I tried \r\n, \n but neither works). So in the end I resorted to the above.