esphome-ts 这是与一起使用的客户端库。 使用范例 import { EspDevice , SwitchComponent } from 'esphome-ts/dist' ; import { filter , tap } from 'rxjs/operators' ; const device = new EspDevice ( 'my_esp.local' ) ; device . discovery$ . pipe ( filter ( ( value ) => value ) , tap ( ( ) => { const sw = device . components [ 'test_switch' ] as SwitchComponent ; sw . state$ . sub