Getting a state without depending on the relay state

so i have a shelly1 that i use as a dry switch
its wired to a button that works as spring action, process is this way
TURN ON APPLIANCE PROCEDURE
shelly button turned on , nothing happens, shelly button turned off , the appliance turns on succesfully

TURN OFF APPLIANCE PROCEDURE
shelly button turned on , nothing happens, shelly button turned off , the appliance turns off succesfully

to avoid the double clicking i simply setup AUTO OFF with timer of 1s on the shelly options
that works well but now i have a different issue
on my lovelace i cant get the state right this way
i of course want my lovelace to change color of the button once the appliance is on, just like all my other buttons, but it follows the relay state currently, it changes the color for a second and then goes back to original state(no color)

what can i do to get around this ?

Make a template switch that pulls the state from the state of the appliance, where the turn_on/off sequences are using the relay.

thats the thing i cant get a state from the appliance
the switch turn on and the auto off after 1s.
i need to make up a new switch to use as state
perhaps something that can change on and off depending on the clicking on HA lovelace button ?

You can use assumed_state. Either set that on your current switch or make a template switch with assumed_state set to true.

Couldn’t they use an input_boolean, with an automation that toggles the state of the boolean when the shelly relay state goes from “on” to “off”.

Initial state off. Shelly relay pressed on, Shelly relay pressed off (or turned off after 1s) - input_boolean toggled to on. Shelly relay pressed on, Shelly relay pressed off (or turned off after 1s) - input_boolean toggled to off.

i tried that, but both automations would trigger because at every switching regardless of on/off process its going through turning on and off of the switch

that would go in config yaml ?

Follow the directions at the top of the link I posted, it describes how to setup customizations

ok i did that
when i go to dev tools and find the entity it does show
assumed_state: true

but it doesnt make a difference, when i flip the switch the state of this entity goes to on and then back to off according to the “auto off 1s” shelly operation

then you have to make a template switch with assumed state.

Templates arent my strong suites :frowning:
what basically assumed state does ? in theory ?

when you click on, it assumes its now on

There will be zero templates in your template switch.

it assumes the state only by my click ? completely ignoring the actual shelly ?

yes, that’s what it does

i see, so im basically making an empty switch yes ?
new entity that does nothing but switches itself to a on or off state ?
do you happen to have an example i could try and tinker with ?

there are examples in the template switch documentation, you only need the turn_on / turn_off fields, do not fill out value_template.

something like this

  • platform: template
    switches:
    shellylrstate:
    turn_on:
    service: switch.turn_on
    target:
    entity_id: switch.skylight_open
    turn_off:
    service: switch.turn_off
    target:
    entity_id: switch.skylight_close

what would go under targer> entity id ?

ok i think i got the switch now
but how do i switch it ?
i mean if i flip on my shelly switch, i need this one to be clicked as well, automation ? group them together ?