Ways to detect if a "dumb" device is on or off. (ideas needed)

Hey everyone,

The issue arises from my old but beloved logitech z5500 set.

It’s an old set of speakers that I control through IR and unfortunately does not accept different IR codes for on/off (or at least I have not found them online yet).
This does not allow me to surely know the state of the speakers at any given time.

If I had separate on & off IR codes (supposing IR transmission worked 100%) I could know the state of the speakers.

  • Anyone know if there are separate on/off IR codes for Z5500 available?

So I’m trying to find ways to report the status of my speakers to add as an extra sensor.
So far I have thought / read about the following but I’m looking for extra input and ideas:

Easy ones:

  1. Smart plug with consumption sensor (where I’ll figure out the average standby / working consumption and create a sensor) - not sure if the standby VS on but idle consumptions will be much different though.
  2. Smart plug to just turn them on and off - which i’d like to avoid as their fuse has proven to blow easily with abrupt power changes.
  3. Light sensor: Stick a cheap light sensor with an esp chip on the screen of the speaker controller to detect when the LCD is on? (extra problem - the LCD is faulty and randomly lights up)

Soldering ones:

  1. Add BT (longshot - 3v needed): got some BTLE transmitters somewhere, was thinking of figuring out some 3v power on the controller board to power the transmitter only when the speakers are on. Then have HA detect the BT presence.
  2. Add WIFI (5v needed): same as above but have the speakers control hub power an ESP and then detect it through ping sensor. (seen an instructable where this guy uses a usb powered ESP chip through his TV’s usb port. No usb port present here)

Questionable ones:

  1. Will a magnetic clamp work? like the ones we use to detect consumption in the separate phases of AC current? will this show anything if i put the clamp around the power cord? (i highly doubt it)
  2. Super smart energy consumption meters. I’m currently using efergy meter, but i’ve seen some more expensive ones that have the capability to detect which device is on or off. I’m somewhat sceptical about their accuracy and on top of that I think they mostly detect high consumption devices and wont work with the speakers.

That’s all i could think of my self.
Looking forward to hearing ideas on how to detect if dumb devices are on (even specialised on speakers)
Maybe we can create a list of ways for the rest of the community to use?

Kind regards,
K.

Smart plug is easiest and maybe most responsive

I want to do the same and my current plan is to install an arduino IoT type device inside the control unit and monitor the state of the pins on the power button LED.
I plan to use a combination of simple web server + web hooks to integrate with home assistant.
Just need to figure out how to power it, I presume there will be a suitable power source inside the control unit that can be co-opted.
I’d be happy to share any code/schematics that I produce although it seems that there are at least two different versions of the Z-5500 electronics so it would only apply to the version that I have.

I’d also like to see if it’s possible to monitor the display using the arduino so that I can detect the selected input and possibly volume level, but that would require an understanding of the protocol for controlling the screen.

Also, I haven’t been able to find discrete on/off IR commands and I even bought a harmony remote since I figured if anything was going have those codes it’d be Logitech’s own remote.

I’m using google assistant integration with my home assistant and it’s a bit annoying if the speakers turn on if they’re off when I tell google to ‘turn off the living room’ for instance.

Just looking at the pinout on the connector, that is probably where I would start.

It was a long time since I had one of these Logitech speakers.
But this com port is between the control unit and the subwoofer, right?

If so then opening the subwoofer and looking at the pins there could perhaps give some clues.

Pinout in second post here:
https://www.eevblog.com/forum/repair/help-repairing-my-logitech-z-5500s/

Thanks, that’s very useful, but i ended up using a smart plug with consumption reading along with an IR blaster.
It’s been working ok for the last couple of months so i didnt bother further.

Thanks, I’d seen this pinout and I figure either the 8v or 18v could power the arduino, but I need to check whether they’re always powered or only when the speaker is switched on (i.e. not in standby).
Also don’t actually have the arduino yet and haven’t been able to find out how much power the IoT wifi units draw so I need to check that.
I guess pin 7 may be able to be used to detect on/off instead of hooking up to the led for the power button.

I don’t think you should use the pins here to power an ESP, just use it to detect if there is a voltage.
If this is just signal wires then perhaps there is not enough amperage to support an ESP and you end up destroying something.

Better to power the ESP from a normal charger and just hook up one of the wires in a voltage divider or buck converter to be able to read it.

That would be safer but I would prefer not to have additional cables exiting the control unit.

I can measure the current flow on the +18v and +8V lines with my scope and if the current draw for the arduino is low enough relative to that I may just risk it.

That is why I said check where the cable goes. It’s from the control unit to the subwoofer right?
So whichever end you measure at, it should be the same.
And the subwoofer is large enough that you can easily hide and ESP inside it.

I hadn’t thought of putting the device in the subwoofer box and I like that idea, although it wouldn’t work if I figure out a solution to read the z-5500’s display and it means I’ll have to figure out how to open the subwoofer box. Presumably not too hard though.

I’ll think about it. I guess I could hook up a DC adapter direct to the AC 240V supply too avoiding the need for external cables too.

Hope you don’t mind me hijacking your thread krash.

It looks like the display on the Logitech uses an SPI interface which means it should be possible to snoop with the arduino so I’m going to continue looking at installing it inside the control unit.

It would also be nice if the volume could be controlled via google assistant with commands like ‘increase the volume 10%’

https://www.mouser.com/datasheet/2/244/LCM-E02002DTF-U-81450.pdf

No hijack at all, interfacing with the z5500 would be great.
I have since moved to another solution and wrote my scripts to understand the status depending on power consumption (as im only using the sub now), but being able to fully control it would be absolutely great.
Good luck!

Hi Harry,
Can you share the code please ?
Best regards,
Jeffrey

Ofcourse, but keep in mind that it’s raw and it takes into account that my IR blaster does not always register, so there’s some delays to check if the actual comand went through. It also takes into account the consumption of my xiaomi ZB plug to take different actions.

  • Here is my code, i will try to add comments to explain what I’m doing.
  • Keep in mind, that i have two z5500 subs in my system, so there’s a reference of z5500_2 at the end.
  • There was also an issue where my speakers would not switch on, after powering them, the light would turn red but i could not bring them out of standby, so i had to turn the plug on and off until they came to their senses.
  • Lastly, this takes into account that the set consumes ~8-12watts at stdby (or anyway <20W) and around 45-50 when ON
  • Also, don’t ask me why i wrote it this way, It seemed like a great way at the time.
script:
  z5500_on_off_actions: # this checks if the plug is on or off the speakers are on standby or on, and takes the equivalent action - runs different script each time.
      sequence:
        - service: homeassistant.turn_on
          data_template:
            entity_id: >
              {% if is_state("switch.up_lr_xiaomi_zb_plug_z5500", "off") %}
                script.z5500_toggle_switch_until_on_from_plug_off
              {% elif is_state("switch.up_lr_xiaomi_zb_plug_z5500", "on") and states.sensor.up_lr_xiaomi_zb_plug_z5500_consumption.state |int < 20  %}
                script.z5500_toggle_switch_until_on_from_plug_on
              {% elif is_state("switch.up_lr_xiaomi_zb_plug_z5500", "on") and states.sensor.up_lr_xiaomi_zb_plug_z5500_consumption.state |int >= 20  %}
                script.z5500_toggle_switch_until_off
              {% endif %}

  z5500_on_actions: # this can probably be omitted, i have no idea why i added this, since the above script takes care of everything as a toggle switch
      sequence:
        - service: homeassistant.turn_on
          data_template:
            entity_id: >
              {% if is_state("switch.up_lr_xiaomi_zb_plug_z5500", "off") %}
                script.z5500_toggle_switch_until_on_from_plug_off
              {% elif is_state("switch.up_lr_xiaomi_zb_plug_z5500", "on") and states.sensor.up_lr_xiaomi_zb_plug_z5500_consumption.state |int < 20  %}
                script.z5500_toggle_switch_until_on_from_plug_on
              {% endif %}


  z5500_toggle_switch_until_on_from_plug_off: #this handles actions if i run the script and the plug is off, so it turns off the plug and spams the IR blaster (with time delay) until the plug registers some power consumption
    sequence:
      - condition: state
        entity_id: switch.up_lr_xiaomi_zb_plug_z5500
        state: 'off'
      - repeat:
          until:
            - condition: template
              value_template: "{{ states.sensor.up_lr_xiaomi_zb_plug_z5500_consumption.state |int >= 20 }}"
            - condition: template
              value_template: "{{ repeat.index <= 5 }}"
          sequence: # i had an issue, where my speakers were non responsive when i turned the plug on, the red light would go on, but i couldnt turn them on (blue) by pressing the button, or with IR, so this script will toggle the plug until it decides to obey my commands!
            - service: switch.turn_off
              entity_id: switch.up_lr_xiaomi_zb_plug_z5500
            - delay: 3
            - service: switch.turn_on
              entity_id: switch.up_lr_xiaomi_zb_plug_z5500
            - wait_template: "{{ states.sensor.up_lr_xiaomi_zb_plug_z5500_consumption.state |int > 0}}"
              timeout: "00:00:20" 
            - service: remote.send_command
              data_template:
                entity_id: remote.broadlink_lr_up_remote
                device: z5500
                command: power
            - wait_template: "{{ states.sensor.up_lr_xiaomi_zb_plug_z5500_consumption.state |int >= 20}}"
              timeout: "00:00:20" 

  z5500_toggle_switch_until_on_from_plug_on:
    sequence:
      - condition: and
        conditions:
          - condition: numeric_state
            entity_id: sensor.up_lr_xiaomi_zb_plug_z5500_consumption
            below: 20
          - condition: numeric_state
            entity_id: sensor.up_lr_xiaomi_zb_plug_z5500_consumption
            above: 1
      - repeat:
          until:
            - condition: template
              value_template: "{{ states.sensor.up_lr_xiaomi_zb_plug_z5500_consumption.state |int >= 20 }}"
            - condition: template
              value_template: "{{ repeat.index <= 10 }}"
          sequence:
            - service: remote.send_command
              data_template:
                entity_id: remote.broadlink_lr_up_remote
                device: z5500
                command: power
            - wait_template: "{{ states.sensor.up_lr_xiaomi_zb_plug_z5500_consumption.state |int >= 20 }}"
              timeout: "00:00:10" 

  z5500_toggle_switch_until_off:
    sequence:
      - condition: numeric_state
        entity_id: sensor.up_lr_xiaomi_zb_plug_z5500_consumption
        above: 20
      - repeat:
          until:
            - condition: template
              value_template: "{{ states.sensor.up_lr_xiaomi_zb_plug_z5500_consumption.state |int < 20 }}"
            - condition: template
              value_template: "{{ repeat.index <= 10 }}"
          sequence:
            - service: remote.send_command
              data_template:
                entity_id: remote.broadlink_lr_up_remote
                device: z5500
                command: power
            - wait_template: "{{ states.sensor.up_lr_xiaomi_zb_plug_z5500_consumption.state |int < 20 }}"
              timeout: "00:00:10" 

  z5500_2_toggle_switch_until_off: # this spams the IR off command untill my second set, registers as STBY consumption, through the second zb plug.
    sequence:
      - condition: numeric_state
        entity_id: sensor.up_lr_xiaomi_zb_plug_z5500_2_consumption
        above: 20
      - repeat:
          until:
            - condition: template
              value_template: "{{ states.sensor.up_lr_xiaomi_zb_plug_z5500_2_consumption.state |int < 20 }}"
            - condition: template
              value_template: "{{ repeat.index <= 10 }}"
          sequence:
            - service: remote.send_command
              data_template:
                entity_id: remote.broadlink_lr_up_remote
                device: z5500
                command: power
            - wait_template: "{{ states.sensor.up_lr_xiaomi_zb_plug_z5500_2_consumption.state |int < 20 }}"
              timeout: "00:00:10" 


I know I’m not making any sense, but it -miraculously- works … so let me know if i can help you out somehow

Sorry for my late reply.
Thanks for sharing your code.
I will take a closer look at it :wink:
Cheers!

im integrate z-5500 with tasmota-ir firmware with ir blaster and https://github.com/smartHomeHub/SmartIR/blob/417a830db96d0fdedc46e60cab40ea3dd4a7dd16/docs/MEDIA_PLAYER.md

and detect state with photoresistor. set it to backlight display of z-5500. photoresistor connect to esp8266 at eshome

Nice!
Can it destinguish blue/red/off?

No. Only light or not light. Work very good. If sun bright from window may be false state. Else good for 99 percent