Some checks failed
		
		
	
	Check flake / build-amd64-linux (push) Failing after 3m22s
				
			
		
			
				
	
	
		
			88 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
| {
 | |
|   pkgs,
 | |
|   ...
 | |
| }:
 | |
| 
 | |
| {
 | |
|   services.home-assistant = {
 | |
|     customLovelaceModules = [
 | |
|       pkgs.lovelace-floorplan
 | |
|     ];
 | |
|   };
 | |
| 
 | |
|   environment.etc."home-assistant/www/floorplan/style.css".source = ./style.css;
 | |
|   environment.etc."home-assistant/www/floorplan/config.yaml".text = builtins.toJSON {
 | |
|     image = {
 | |
|       location = "/local/floorplan/beetham.svg";
 | |
|       cache = false;
 | |
|     };
 | |
|     stylesheet = {
 | |
|       location = "/local/floorplan/style.css";
 | |
|       cache = false;
 | |
|     };
 | |
| 
 | |
|     defaults = {
 | |
|       hover_action = "hover-info";
 | |
|       hold_action = "toggle";
 | |
|       tap_action = "more-info";
 | |
|     };
 | |
| 
 | |
|     rules = [
 | |
|       {
 | |
|         name = "Rooms";
 | |
|         entities = [
 | |
|           {
 | |
|             entity = "light.bedroom_lamps";
 | |
|             element = "area.bedroom";
 | |
|           }
 | |
|           {
 | |
|             entity = "light.hallway_spots";
 | |
|             element = "area.hallway";
 | |
|           }
 | |
|           {
 | |
|             entity = "light.living_room_lamps";
 | |
|             element = "area.livingroom";
 | |
|           }
 | |
|           {
 | |
|             entity = "light.office_lamps";
 | |
|             element = "area.office";
 | |
|           }
 | |
|         ];
 | |
|         tap_action = "light.toggle";
 | |
|         state_action = {
 | |
|           service = "floorplan.class_set";
 | |
|           service_data = ''
 | |
|             if (entity.state === "on") {
 | |
|               return "light-on";
 | |
|             }
 | |
|             return "light-off";
 | |
|           '';
 | |
|         };
 | |
|       }
 | |
|       {
 | |
|         name = "Temperature";
 | |
|         entities = [
 | |
|           "sensor.motion_sensor_temperature"
 | |
|         ];
 | |
|         state_action = [
 | |
|           {
 | |
|             service = "floorplan.text_set";
 | |
|             service_data = ''
 | |
|               if (!isNaN(entity.state)) {
 | |
|                 return Math.round(entity.state * 10) / 10 + "°";
 | |
|               }
 | |
|               return "Unknown";
 | |
|             '';
 | |
|           }
 | |
|           {
 | |
|             service = "floorplan.class_set";
 | |
|             service_data = {
 | |
|               class = "static-temp";
 | |
|             };
 | |
|           }
 | |
|         ];
 | |
|       }
 | |
|     ];
 | |
|   };
 | |
| }
 |