diff --git a/home_assistant/home_assistant_package.yaml b/home_assistant/home_assistant_package.yaml new file mode 100644 index 0000000..97e1a98 --- /dev/null +++ b/home_assistant/home_assistant_package.yaml @@ -0,0 +1,124 @@ +template: + - binary_sensor: + - name: "Robot GPS Fix" + unique_id: robot_gps_fix_template + state: "{{ states('sensor.robot_gps_fix_raw') == 'on' }}" + + - name: "Robot Motion" + unique_id: robot_motion_template + state: "{{ states('sensor.robot_motion_raw') == 'on' }}" + + - name: "Robot Home" + unique_id: robot_home_template + state: > + {% set d = states('sensor.robot_distance_to_dock') | float(999) %} + {{ d < 3 }} + + - name: "Robot Charging" + unique_id: robot_charging_template + state: > + {% set p = states('sensor.robot_dock_power') | float(0) %} + {% set home = is_state('binary_sensor.robot_home', 'on') %} + {{ home and p > 15 }} + + - sensor: + - name: "Robot Distance To Dock" + unique_id: robot_distance_to_dock + unit_of_measurement: "m" + state: > + {% set lat1 = states('sensor.robot_gps_latitude') | float(0) %} + {% set lon1 = states('sensor.robot_gps_longitude') | float(0) %} + {% set lat2 = 56.194000 %} + {% set lon2 = 10.682000 %} + {% if lat1 == 0 and lon1 == 0 %} + 999 + {% else %} + {{ distance(lat1, lon1, lat2, lon2) * 1000 }} + {% endif %} + + - name: "Robot GPS Status" + unique_id: robot_gps_status + state: > + {% if is_state('binary_sensor.robot_gps_fix', 'on') %} + FIX + {% else %} + NOFIX + {% endif %} + + - name: "Robot Motion Status" + unique_id: robot_motion_status + state: > + {% if is_state('binary_sensor.robot_motion', 'on') %} + MOVING + {% else %} + STILL + {% endif %} + + - name: "Robot Home Status" + unique_id: robot_home_status + state: > + {% if is_state('binary_sensor.robot_home', 'on') %} + HOME + {% else %} + AWAY + {% endif %} + + - name: "Robot Charge Status" + unique_id: robot_charge_status + state: > + {% if is_state('binary_sensor.robot_charging', 'on') %} + CHARGING + {% else %} + IDLE + {% endif %} + +lovelace_example: + title: Robot Mower V2 + cards: + - type: entities + title: Robot status + entities: + - entity: sensor.robot_gps_status + name: GPS + - entity: sensor.robot_motion_status + name: Bevægelse + - entity: sensor.robot_home_status + name: Position + - entity: sensor.robot_charge_status + name: Ladning + - entity: sensor.robot_distance_to_dock + name: Afstand til dock + - entity: sensor.robot_heading_deg + name: Heading + - entity: sensor.robot_gps_satellites + name: Satellitter + - entity: sensor.robot_gps_hdop + name: HDOP + - entity: sensor.robot_gps_speed_kmh + name: Hastighed + - entity: sensor.robot_last_position_age + name: Sidste position alder + + - type: entities + title: Ladeboks + entities: + - entity: sensor.robot_dock_voltage + name: Spænding + - entity: sensor.robot_dock_current + name: Strøm + - entity: sensor.robot_dock_power + name: Effekt + - entity: binary_sensor.robot_dock_online + name: Ladeboks online + + - type: gauge + entity: sensor.robot_dock_power + min: 0 + max: 200 + name: Ladeeffekt + + - type: map + title: Robot position + default_zoom: 19 + entities: + - entity: zone.home