Commit 91e315c
committed
fix: persist execute switch state across HA restarts
SmartThingsExecuteSwitch used `_assumed_on = True` in __init__,
so beep and display_lighting always showed ON after HA restart
even when they were turned OFF before. ARTIK051 doesn't report
OCF execute state, so `_get_ocf_options()` returns None.
Fix: Use `_attr_assumed_on` as a class-level default and
restore the last known state from HA's state registry in
`async_added_to_hass()` via `async_get_last_state()`. If no
previous state exists, defaults to ON (beep is enabled by default
on Samsung ACs).1 parent 49508a9 commit 91e315c
2 files changed
Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
| 648 | + | |
648 | 649 | | |
649 | 650 | | |
650 | 651 | | |
| |||
658 | 659 | | |
659 | 660 | | |
660 | 661 | | |
661 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
662 | 670 | | |
663 | 671 | | |
664 | 672 | | |
| |||
699 | 707 | | |
700 | 708 | | |
701 | 709 | | |
702 | | - | |
| 710 | + | |
703 | 711 | | |
704 | 712 | | |
705 | 713 | | |
| |||
708 | 716 | | |
709 | 717 | | |
710 | 718 | | |
711 | | - | |
| 719 | + | |
712 | 720 | | |
713 | 721 | | |
714 | 722 | | |
| |||
718 | 726 | | |
719 | 727 | | |
720 | 728 | | |
721 | | - | |
| 729 | + | |
722 | 730 | | |
0 commit comments