Hi,
I’m trying to migrate from Xiaomi smarthome to miio binding which works better for some of my xiaomi devices and support more devices. Two features that I miss are:
- Switch to trigger my aqara gateway (lumi.gateway.v3) to play alarm sound
- Read the value from the build-in light sensor
The way how I set them up with smarthome binding:
Number:Illuminance Xiaomi_gateway_light_sensor "Indoor Light Sensor [%s lx]" <sun> (gXiaomiGateway) {homekit="LightSensor", channel="mihome:gateway:xxxxxx:xxxxxx:illumination" }
Number Xiaomi_gateway_play_sound "" <soundvolume-0> (gXiaomiGateway) { channel="mihome:gateway:xxxxxx:xxxxxx:sound" }
Dimmer Xiaomi_gateway_sound_volume <soundvolume> (gXiaomiGateway) { channel="mihome:gateway:xxxxxx:xxxxxx:volume" }
Switch Xiaomi_gateway_sound_homekit "Play Sound" (gXiaomiGateway) {homekit="Switchable" }
Xiaomi_gateway_sound_homekit send the commands to Xiaomi_gateway_play_sound and Xiaomi_gateway_sound_volume in rules (timer used to control the length of ringtone):
rule "Play sound"
when
Item Xiaomi_gateway_sound_homekit changed from OFF to ON
then
Xiaomi_gateway_sound_volume.sendCommand(25)
//0="police car 1",
//1="police car 2",
//2="accident",
//3="countdown",
//4="ghost",
//5="sniper rifle",
//6="battle",
//7="air raid",
//8="bark",
//10="doorbell",
//11="knock at a door",
//12="amuse",
//13="alarm clock",
//20="mimix",
//21="enthusuastic",
//22="guitar classic",
//23="ice world piano",
//24="leisure time",
//25="child hood",
//26="morning stream liet",
//27="music box",
//28="orange",
//29="thinker"
Xiaomi_gateway_play_sound.sendCommand(29)
logInfo("Info", "Xiaomi: started playing sound on gateway")
timer = createTimer(now, [|
Xiaomi_gateway_sound_homekit.sendCommand(OFF)
])
timer.reschedule(now.now.plusNanos(1800000000))
end
rule "Stop play sound"
when
Item Xiaomi_gateway_sound_homekit changed from ON to OFF
then
Xiaomi_gateway_play_sound.sendCommand(10000)
Xiaomi_gateway_sound_volume.sendCommand(0)
Xiaomi_gateway_sound_homekit.sendCommand(OFF)
logInfo("Info", "Xiaomi: stopped playing sound on gateway")
if(timer !== null) {
timer.cancel()
}
timer = null
end
Is it possible to add the support for the additional features on the gateway? Many thanks in advance!