working temp split
This commit is contained in:
		
							parent
							
								
									20631f0440
								
							
						
					
					
						commit
						e87d27c5fb
					
				@ -10,7 +10,28 @@ module.exports = function (app) {
 | 
				
			|||||||
    app.get("/heating/status", async function (req, res, next) {
 | 
					    app.get("/heating/status", async function (req, res, next) {
 | 
				
			||||||
        const response = await post.postRequest()
 | 
					        const response = await post.postRequest()
 | 
				
			||||||
        const heating = response.updateData.zones[0].status
 | 
					        const heating = response.updateData.zones[0].status
 | 
				
			||||||
        res.json(heating)
 | 
					
 | 
				
			||||||
 | 
					        let mrt = String( heating.measuredRoomTemp )
 | 
				
			||||||
 | 
					        mrt = mrt.split( /(?=(?:..)*$)/ )
 | 
				
			||||||
 | 
					        mrt = parseFloat(mrt[1] + "." + mrt[0])
 | 
				
			||||||
 | 
					        heating.measuredRoomTemp = mrt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let on 
 | 
				
			||||||
 | 
					        if (heating.currentSetpoint > 0) {
 | 
				
			||||||
 | 
					            on = true
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            on = false
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let heatingStatus = {
 | 
				
			||||||
 | 
					            "heatingOn": on,
 | 
				
			||||||
 | 
					            "measuredRoomTemp": mrt,
 | 
				
			||||||
 | 
					            "currentSetpoint": heating.currentSetpoint,
 | 
				
			||||||
 | 
					            "lastTimerSetPoint": heating.lastTimerSetPoint,
 | 
				
			||||||
 | 
					            "lastTimerDurationMinutes": heating.lastTimerDurationMinutes
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        res.json(heatingStatus)
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    app.get("/heating/config", async function (req, res, next) {
 | 
					    app.get("/heating/config", async function (req, res, next) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user