Cossid/TasmotaDeviceGroupsForESPHome

individual relay identification

Opened this issue · 2 comments

I don't think it is needed but if you need some discussion, or some testing this issue can be used.

Feel free to open a separate issue for individual relay identification inside the same group. I can't promise it will ever be resolved, but having discussion would be the first step.

I actually don't think this is needed, the only reason I tried this was because separate groups broke the config at the time.
never the less if you are planning to implement this you need some way to determine the index of the relays,

in config I can think about 2 things you can do

one is add an index(tasmota starts at one, but starting at 0 also could work)

device_groups:
  - group_name: "group1"         # Tasmota device group name
    switches:
      - id: gpio_switch          # ESPHome entity id
        index: 1
      - id: template_switch      # ESPHome entity id
        index: 3
    lights:
      - id: light_rgbww1         # ESPHome entity id
        index: 2

the other options is to put all relays in the same group, then determine the type dynamically

device_groups:
  - group_name: "group1"         # Tasmota device group name
    relays:
      - gpio_switch          # ESPHome entity id
      - light_rgbww1  
      - template_switch      # ESPHome entity id
             # ESPHome entity id

I have never developed a component for espHome before so I don't know if what I suggest would hit any limitation

Cossid commented

Option 2 is out because then you couldn't have a light and relay at the same index paired together. Also I tried something originally like that but the python to c++ layer made it nearly impossible to distinguish the switches from the relays, hence I ended up going with hard-defined lists instead.

Configuration in ESPHome can be tricky, and that is one of the obstacles for sure.

Your option 1 is what I had in mind, but I'm not sure if it's possible to do quite like that. That is what I would try for, but it might end up looking like

device_groups:
  - group_name: "group1"         # Tasmota device group name
    switches:
      -switch:
        id: gpio_switch          # ESPHome entity id
        index: 1
      -switch:
        id: template_switch      # ESPHome entity id
        index: 3
    lights:
      -light:
        id: light_rgbww1         # ESPHome entity id
        index: 2

To clarify, I would like this to be as compatible with Tasmota as possible, but understand I don't really use Tasmota much, so have/may have some incorrect assumptions about how it works in the more extreme cases, and don't fully understand all of the code (specifically this device id masking and commands/events). I do plan on fixing this, but it certainly won't be in the near term, especially with my upcoming vacation schedule. Hopefully sometime within the month of September, but no promises. I'm glad the working multiple group option is a good-enough stop-gap.

Cossid commented

I've added a Known Issues section to the readme and referenced this issue, so it is at least documented. It recommends using so88 to separate groups in the meantime.