Almost first time user needs input where to read. Automation with variable?!

Hey,
TLDR: (I think) I would like to count up a variable every time an instance turns on. Where is an example automation which I can use as inspiration?!

If you dont understand my blab please tell me. Its not easy to explain this mess…

Long story:
TV and subwoofer are seperate entities in Home Assistant.
Subwoofer controlled by Shelly, which bridges contacts of a stupid momentary button. Shelly turns itself off after 1 second to mimic the push of the button.

I cant put shelly to the main AC of the sub. The stupid sub always starts in standby-mode and needs the buttonpush to activate.
Cant measure, if bass is already on or not. No sensor for that…

My workaround now is

If TV turns on/off
turn on Sub. (which triggers the momentary switch, to toggle the state of the bass)
But

  • if I hear music over the HiFi system and start the TV it turns the sub off.
  • if I forget to turn that off the Sub wastes around 80 Watts of power all night.

I would like to count the Shelly triggers, so I can calculate, if sub is on or off…
How would I do this? (Shelly turned on 3 times today; On-Off-On → sub is On)

Bonus points if you could give me an idea, how to let Alexa override this state.
Example: Because of reasons the state of the sub is out of sync with the real state. Can an Alexa command like “Set sub state to ON” correct for this?

Would it be better to buy another shelly and throw it to the sub mains voltage in addition to the pushbutton shelly?

Cheers,

Please read the Glossary and repost this using terms we understand.

You can use a shelly on the mains of the sub if you leave it on. Then use the power usage as a means to see if it is active or stand by. With that you can create a template switch that works perfectly.

Counting clicks will at some point in time go out of sync, and have your automations do the opposite of what you want, until you realise and fix it. Toggles are killing if you don’t know what the state is.

Updated. I wanted to say that both of them are integrated, but not from the same vendor or similar.

Thats why I use HA

I dont have any Shelly 1 PM or Shelly Plugs anymore, so I cant monitor the power usage.

I hoped that I can get around even more hardware, but hey. Who needs money anyways :smiley:

Even my simple automation
Condition: TV changes state (On/Off)
Action: Toggle the sub

broke after less than 10 uses.
Ill get a power monitor.

EDIT: Ill use the Push-Botton-Shelly just as a trigger for the pushbotton when it gets power. I dont even need it for anything else

Cheers

1 Like