aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-12-05 15:23:24 +0000
committerdiogo464 <[email protected]>2025-12-05 15:23:24 +0000
commit51027d838eb4fbf298c546b163d650a5b0eb2599 (patch)
tree74582bab06459f76ea739c6d5be9521506799eca
parent9696489d5f1807a507214d6fcdecac4d47e0356d (diff)
removed unused comment
-rw-r--r--src/lib.rs118
1 files changed, 0 insertions, 118 deletions
diff --git a/src/lib.rs b/src/lib.rs
index ac26a45..325df1d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -732,121 +732,3 @@ async fn wait_on_atomic_waker(waker: &AtomicWaker) {
732 } 732 }
733 F(waker, false).await 733 F(waker, false).await
734} 734}
735
736/*
737 Step-by-Step Process
738
739 1. What are you measuring/controlling?
740
741 Start with the physical thing:
742 - "I want to measure temperature"
743 - "I want to detect if a door is open"
744 - "I want to control a relay"
745 - "I want a button to restart the device"
746
747 2. Pick the component type based on behavior
748
749 Ask yourself:
750 - Is it read-only or controllable?
751 - Does it have numeric values or on/off states?
752
753 Decision tree:
754 Read-only measurement?
755 ├─ Numeric value (23.5, 65%, etc.)
756 │ └─ Component: sensor
757 └─ On/off state (open/closed, detected/not detected)
758 └─ Component: binary_sensor
759
760 Controllable?
761 ├─ On/off control
762 │ └─ Component: switch (or light for LEDs)
763 ├─ Adjustable number
764 │ └─ Component: number
765 ├─ Select from options
766 │ └─ Component: select
767 └─ Trigger action (no state)
768 └─ Component: button
769
770 3. Pick the device_class (if applicable)
771
772 Now look at the component type you chose:
773
774 For sensor - What kind of measurement?
775 - Temperature → device_class: "temperature"
776 - Humidity → device_class: "humidity"
777 - Pressure → device_class: "pressure"
778 - Custom metric → device_class: None
779
780 For binary_sensor - What kind of detection?
781 - Door → device_class: "door"
782 - Motion → device_class: "motion"
783 - Window → device_class: "window"
784 - Generic → device_class: None
785
786 For button - No device_class needed!
787
788 4. Pick units (if applicable)
789
790 Based on your device_class:
791 - Temperature → "°C" or "°F"
792 - Humidity → "%"
793 - Pressure → "hPa"
794
795 Examples
796
797 Example 1: DHT22 Temperature Reading
798
799 1. What? → Measure temperature
800 2. Component? → sensor (numeric, read-only)
801 3. Device class? → "temperature"
802 4. Unit? → "°C"
803
804 Result:
805 - Discovery: homeassistant/sensor/pico2w_temp/config
806 - JSON: device_class: "temperature", unit_of_measurement: "°C"
807
808 Example 2: Reed Switch on Door
809
810 1. What? → Detect door open/closed
811 2. Component? → binary_sensor (on/off state, read-only)
812 3. Device class? → "door"
813 4. Unit? → N/A
814
815 Result:
816 - Discovery: homeassistant/binary_sensor/pico2w_door/config
817 - JSON: device_class: "door"
818
819 Example 3: Relay Control
820
821 1. What? → Control a relay
822 2. Component? → switch (on/off, controllable)
823 3. Device class? → None (switches typically don't have device_class)
824 4. Unit? → N/A
825
826 Result:
827 - Discovery: homeassistant/switch/pico2w_relay/config
828 - JSON: No device_class needed
829
830 Example 4: Restart Button
831
832 1. What? → Trigger device restart
833 2. Component? → button (action trigger, no state)
834 3. Device class? → None (buttons don't have device_class)
835 4. Unit? → N/A
836
837 Result:
838 - Discovery: homeassistant/button/pico2w_restart/config
839 - JSON: No device_class, no state_topic
840
841 TL;DR Workflow
842
843 Physical thing
844
845 Component type (behavior: read-only numeric? binary? controllable?)
846
847 Device class (what specific type?)
848
849 Units (if numeric)
850
851 Does this mental model make sense now?
852*/