aboutsummaryrefslogtreecommitdiff
path: root/examples/switch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/switch.rs')
-rw-r--r--examples/switch.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/switch.rs b/examples/switch.rs
index 67767d7..0158ede 100644
--- a/examples/switch.rs
+++ b/examples/switch.rs
@@ -11,7 +11,7 @@ static RESOURCES: StaticCell<embassy_ha::DeviceResources> = StaticCell::new();
11async fn main_task(spawner: Spawner) { 11async fn main_task(spawner: Spawner) {
12 let mut stream = AsyncTcp::connect(std::env!("MQTT_ADDRESS")); 12 let mut stream = AsyncTcp::connect(std::env!("MQTT_ADDRESS"));
13 13
14 let mut device = embassy_ha::Device::new( 14 let mut device = embassy_ha::new(
15 RESOURCES.init(Default::default()), 15 RESOURCES.init(Default::default()),
16 embassy_ha::DeviceConfig { 16 embassy_ha::DeviceConfig {
17 device_id: "example-device-id", 17 device_id: "example-device-id",
@@ -21,7 +21,8 @@ async fn main_task(spawner: Spawner) {
21 }, 21 },
22 ); 22 );
23 23
24 let switch = device.create_switch( 24 let switch = embassy_ha::create_switch(
25 &device,
25 "switch-id", 26 "switch-id",
26 embassy_ha::SwitchConfig { 27 embassy_ha::SwitchConfig {
27 common: embassy_ha::EntityCommonConfig { 28 common: embassy_ha::EntityCommonConfig {
@@ -34,7 +35,7 @@ async fn main_task(spawner: Spawner) {
34 35
35 spawner.must_spawn(switch_task(switch)); 36 spawner.must_spawn(switch_task(switch));
36 37
37 device.run(&mut stream).await.unwrap(); 38 embassy_ha::run(&mut device, &mut stream).await.unwrap();
38} 39}
39 40
40#[embassy_executor::task] 41#[embassy_executor::task]