Skip to content

Commit

Permalink
support multiple inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
markirb committed Aug 29, 2024
1 parent 08db16d commit f0abb85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 9 additions & 6 deletions mos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ libs:
- location: https://github.com/mongoose-os-libs/ota-http-server
- location: https://github.com/mongoose-os-libs/rpc-service-config
- location: https://github.com/mongoose-os-libs/rpc-service-fs
- location: https://github.com/mongoose-os-libs/rpc-service-gpio
- location: https://github.com/mongoose-os-libs/rpc-uart
- location: https://github.com/mongoose-os-libs/rpc-ws
- location: https://github.com/mongoose-os-libs/sntp
Expand Down Expand Up @@ -656,17 +655,21 @@ conds:

- ["lb1", "lb", {title: "Light 1 settings"}]
- ["lb2", "lb", {title: "Light 2 settings"}]
- ["lb2.initial_state", 2] #input only available to lb1
- ["lb3", "lb", {title: "Light 3 settings"}]
- ["lb3.initial_state", 2] #input only available to lb1
- ["lb4", "lb", {title: "Light 4 settings"}]
- ["lb4.initial_state", 2] #input only available to lb1

- ["in1", "in", {title: "Input 1 settings"}]
- ["in1.ssw.name", "Shelly SSW1"]
- ["in1.sensor.name", "Shelly S1"]
- ["sw1", "sw", {title: "SW1 settings"}]
- ["sw1.name", "Shelly SW"]
- ["in2", "in", {title: "Input 2 settings"}]
- ["in2.ssw.name", "Shelly SSW2"]
- ["in2.sensor.name", "Shelly S2"]
- ["in3", "in", {title: "Input 3 settings"}]
- ["in3.ssw.name", "Shelly SSW3"]
- ["in3.sensor.name", "Shelly S3"]
- ["in4", "in", {title: "Input 4 settings"}]
- ["in4.ssw.name", "Shelly SSW4"]
- ["in4.sensor.name", "Shelly S4"]

- when: build_vars.MODEL == "ShellyPlus1"
apply:
Expand Down
5 changes: 1 addition & 4 deletions src/ShellyRGBW2/shelly_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ void CreateComponents(std::vector<std::unique_ptr<Component>> *comps,
out_pin += 3;
}

Input *in = FindInput(1);
if (i != 0) {
in = nullptr; // support input only for first device
}
Input *in = FindInput(i);

hap_light.reset(new hap::LightBulb(
i + 1, in, std::move(lightbulb_controller), lb_cfg, is_optional));
Expand Down

0 comments on commit f0abb85

Please sign in to comment.