Add release.nix
This commit is contained in:
		
							parent
							
								
									6e762316c8
								
							
						
					
					
						commit
						f75eee6b8a
					
				
							
								
								
									
										96
									
								
								app.py
									
									
									
									
									
								
							
							
						
						
									
										96
									
								
								app.py
									
									
									
									
									
								
							| @ -37,8 +37,11 @@ def button_widget(topic, label, pub_value): | |||||||
|     template = ''' |     template = ''' | ||||||
|     <input type="button" class="button is-large is-info  is-outlined" value="{{label}}" onclick="publish('{{topic}}', '{{pub_value}}');"/> |     <input type="button" class="button is-large is-info  is-outlined" value="{{label}}" onclick="publish('{{topic}}', '{{pub_value}}');"/> | ||||||
|     ''' |     ''' | ||||||
|     return make_widget( |     return make_widget(template, | ||||||
|         template, 'button', label=label, pub_value=pub_value, topic=topic) |                        'button', | ||||||
|  |                        label=label, | ||||||
|  |                        pub_value=pub_value, | ||||||
|  |                        topic=topic) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def slider_widget(label, | def slider_widget(label, | ||||||
| @ -61,17 +64,16 @@ def slider_widget(label, | |||||||
|     </div> |     </div> | ||||||
|     <div>{{label}}</div> |     <div>{{label}}</div> | ||||||
|     ''' |     ''' | ||||||
|     return make_widget( |     return make_widget(template, | ||||||
|         template, |                        'slider', | ||||||
|         'slider', |                        sub_topic=sub_topic, | ||||||
|         sub_topic=sub_topic, |                        label=label, | ||||||
|         label=label, |                        min_val=min_val, | ||||||
|         min_val=min_val, |                        max_val=max_val, | ||||||
|         max_val=max_val, |                        value_path=value_path, | ||||||
|         value_path=value_path, |                        topic=topic, | ||||||
|         topic=topic, |                        unit=unit, | ||||||
|         unit=unit, |                        id_=id_) | ||||||
|         id_=id_) |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def label_widget(topic, label, unit=''): | def label_widget(topic, label, unit=''): | ||||||
| @ -82,13 +84,12 @@ def label_widget(topic, label, unit=''): | |||||||
|     </div> |     </div> | ||||||
|     <div>{{label}}</div> |     <div>{{label}}</div> | ||||||
|     ''' |     ''' | ||||||
|     return make_widget( |     return make_widget(template, | ||||||
|         template, |                        'label', | ||||||
|         'label', |                        sub_topic=topic, | ||||||
|         sub_topic=topic, |                        topic=topic, | ||||||
|         topic=topic, |                        unit=unit, | ||||||
|         unit=unit, |                        label=label) | ||||||
|         label=label) |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def log_widget(topic, label): | def log_widget(topic, label): | ||||||
| @ -106,8 +107,12 @@ def log_widget(topic, label): | |||||||
|       </div> |       </div> | ||||||
|       <div>{{label}}<button id="{{id_}}" class="delete log-delete"></button></div> |       <div>{{label}}<button id="{{id_}}" class="delete log-delete"></button></div> | ||||||
|     ''' |     ''' | ||||||
|     return make_widget( |     return make_widget(template, | ||||||
|         template, "log", sub_topic=topic, topic=topic, label=label, id_=id_) |                        "log", | ||||||
|  |                        sub_topic=topic, | ||||||
|  |                        topic=topic, | ||||||
|  |                        label=label, | ||||||
|  |                        id_=id_) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def row_layout(title, *elems): | def row_layout(title, *elems): | ||||||
| @ -157,27 +162,24 @@ def home(): | |||||||
|         widgets=[ |         widgets=[ | ||||||
|             column_layout( |             column_layout( | ||||||
|                 "Light", |                 "Light", | ||||||
|                 slider_widget( |                 slider_widget("Küche", | ||||||
|                     "Küche", |                               "hue/set/lights/Ku", | ||||||
|                     "hue/set/lights/Ku", |                               "hue/status/lights/Ku", | ||||||
|                     "hue/status/lights/Ku", |                               value_path='val'), | ||||||
|                     value_path='val'), |                 slider_widget("WZ1", | ||||||
|                 slider_widget( |                               "hue/set/lights/WZ1", | ||||||
|                     "WZ1", |                               "hue/status/lights/WZ1", | ||||||
|                     "hue/set/lights/WZ1", |                               value_path='val'), | ||||||
|                     "hue/status/lights/WZ1", |                 slider_widget("WZ2", | ||||||
|                     value_path='val'), |                               "hue/set/lights/WZ2", | ||||||
|                 slider_widget( |                               "hue/status/lights/WZ2", | ||||||
|                     "WZ2", |                               value_path='val'), | ||||||
|                     "hue/set/lights/WZ2", |                 slider_widget("Vorzimmer", | ||||||
|                     "hue/status/lights/WZ2", |                               "hue/set/lights/Vorzimmer", | ||||||
|                     value_path='val'), |                               "hue/status/lights/Vorzimmer", | ||||||
|                 slider_widget( |                               value_path='val'), | ||||||
|                     "Vorzimmer", |  | ||||||
|                     "hue/set/lights/Vorzimmer", |  | ||||||
|                     "hue/status/lights/Vorzimmer", |  | ||||||
|                     value_path='val'), |  | ||||||
|                 slider_widget("Schlafzimmer", |                 slider_widget("Schlafzimmer", | ||||||
|  |                               "home/devices/192.168.1.214/override", | ||||||
|                               "home/devices/192.168.1.214/brightness")), |                               "home/devices/192.168.1.214/brightness")), | ||||||
|             row_layout( |             row_layout( | ||||||
|                 "Temperature", |                 "Temperature", | ||||||
| @ -187,8 +189,14 @@ def home(): | |||||||
|                              "°C"), |                              "°C"), | ||||||
|                 label_widget("home/sensors/bedroom/temperature", "Bedroom", |                 label_widget("home/sensors/bedroom/temperature", "Bedroom", | ||||||
|                              "°C")), |                              "°C")), | ||||||
|             row_layout("Device logs", log_widget("test", "test log"), |             row_layout( | ||||||
|                        log_widget("test2", "test log 2")), |                 "Device logs", log_widget("test", "test log"), *[ | ||||||
|  |                     log_widget(f"home/devices/{ip}/log", name) | ||||||
|  |                     for ip, name in [("192.168.1.214", "Bedroom lamp"), | ||||||
|  |                                      ("192.168.1.213", "Sensor office"), | ||||||
|  |                                      ("192.168.1.212", "Sensor livingroom"), | ||||||
|  |                                      ("192.168.1.211", "Sensor bedroom")] | ||||||
|  |                 ]), | ||||||
|             row_layout("Some buttons", button_widget("test", "set to 1", 1), |             row_layout("Some buttons", button_widget("test", "set to 1", 1), | ||||||
|                        button_widget("test", "set to foo", 'foo')) |                        button_widget("test", "set to foo", 'foo')) | ||||||
|         ]) |         ]) | ||||||
|  | |||||||
| @ -1,5 +1,5 @@ | |||||||
| with import <nixpkgs> {}; with python3Packages; | { python }: | ||||||
| 
 | with python.pkgs; | ||||||
| buildPythonPackage rec { | buildPythonPackage rec { | ||||||
|   name = "mqtt-dash"; |   name = "mqtt-dash"; | ||||||
|   src = ./.; |   src = ./.; | ||||||
|  | |||||||
							
								
								
									
										9
									
								
								release.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								release.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | |||||||
|  | { | ||||||
|  |   mqtt-dash = | ||||||
|  |     { system ? builtins.currentSystem }: | ||||||
|  | 
 | ||||||
|  |       let | ||||||
|  |         pkgs = import <nixpkgs> { inherit system; }; | ||||||
|  |       in | ||||||
|  |         pkgs.callPackage ./. { python = pkgs.python3; }; | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user