MCPcopy Create free account
hub / github.com/NSPManager/NSPanelManager / toggle

Method toggle

docker/MQTTManager/include/light/light.cpp:372–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372void Light::toggle() {
373 if (this->_current_state) {
374 this->turn_off(true);
375 } else {
376 // Apply default "turn on brightness" if it is requested to become 0 as that won't work.
377 if (this->_requested_brightness == 0) {
378 this->_requested_brightness = std::stoi(MqttManagerConfig::get_setting_with_default("light_turn_on_brightness", "50"));
379 }
380 this->turn_on(true);
381 }
382}
383
384std::string_view Light::get_icon() {
385 if (this->get_state()) {

Callers 4

_command_callbackMethod · 0.45
command_callbackMethod · 0.45
jquery-ui.min.jsFile · 0.45
jquery-ui.jsFile · 0.45

Calls 3

turn_offMethod · 0.95
turn_onMethod · 0.95
get_setting_with_defaultFunction · 0.85

Tested by

no test coverage detected