chore: simplify off-action error message (#29707)
This commit is contained in:
parent
bd651da8ff
commit
de8d02282c
2 changed files with 3 additions and 3 deletions
|
|
@ -247,7 +247,7 @@ func (c *Connection) CallSwitchService(entity string, turnOn bool) error {
|
|||
case "button", "input_button":
|
||||
// Buttons are stateless — they only have a press action.
|
||||
if !turnOn {
|
||||
return fmt.Errorf("entity %s (domain %s) has no off action", entity, domain)
|
||||
return fmt.Errorf("entity %s has no off action", entity)
|
||||
}
|
||||
service = "press"
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ func TestCallSwitchService_DomainDispatch(t *testing.T) {
|
|||
{"switch turn_off", "switch.foo", false, "/api/services/switch/turn_off", ""},
|
||||
{"button press", "button.tesla_model_x_wake_up", true, "/api/services/button/press", ""},
|
||||
{"input_button press", "input_button.bar", true, "/api/services/input_button/press", ""},
|
||||
{"button no off", "button.foo", false, "", "entity button.foo (domain button) has no off action"},
|
||||
{"input_button no off", "input_button.bar", false, "", "entity input_button.bar (domain input_button) has no off action"},
|
||||
{"button no off", "button.foo", false, "", "entity button.foo has no off action"},
|
||||
{"input_button no off", "input_button.bar", false, "", "entity input_button.bar has no off action"},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue