Exemplo n.º 1
0
def zhaopenclose_message(websocket_message, rest_message):
	return {
		'event': websocket_message['e'],
		'state': failsafe(lambda : 'open' if websocket_message['state']['open'] else 'closed'),
		'battery': failsafe(lambda : websocket_message['config']['battery']),
		'temperature': failsafe(lambda : websocket_message['config']['temperature']),
		}
Exemplo n.º 2
0
def zhaswitch_message(websocket_message, rest_message):
	button_map = {
		1002: 'button1',
		2002: 'button2',
		3002: 'button3',
		4002: 'button4',
		5002: 'button5',
	}
	return {
		'event': websocket_message['e'],
		'button': failsafe(lambda : button_map[websocket_message['state']['buttonevent']]),
		'battery': failsafe(lambda : websocket_message['config']['battery']),
		'temperature': failsafe(lambda : websocket_message['config']['temperature']),
		}
Exemplo n.º 3
0
def zhapress_message(websocket_message, rest_message):
	return {
		'event': websocket_message['e'],
		'pressure': failsafe(lambda : websocket_message['state']['pressure']),
		'battery': failsafe(lambda : websocket_message['config']['battery']),
		}
Exemplo n.º 4
0
def zhahumidity_message(websocket_message, rest_message):
	return {
		'event': websocket_message['e'],
		'humidity': failsafe(lambda : websocket_message['state']['humidity'] / 100),
		'battery': failsafe(lambda : websocket_message['config']['battery']),
		}
Exemplo n.º 5
0
def zhatemp_message(websocket_message, rest_message):
	return {
		'event': websocket_message['e'],
		'temperature': failsafe(lambda : websocket_message['state']['temperature'] / 100),
		'battery': failsafe(lambda : websocket_message['config']['battery']),
		}