homekit_python
homekit_python copied to clipboard
Tell me how to change values ?
Tell me how to change values ?
thermostatService = ThermostatService() thermostatService.set_target_temperature_set_callback(th_target_temperature) thermostatService.set_target_heating_cooling_state_set_callback(th_target_state)
thermostatService.set_current_heating_cooling_state_get_callback = OFF OR 0: Off 1: Heater is on 2: Cooler is on
can you give a small example?
I can not understand how to change the values in the code, for example, on or temperature?
Any chance to advise? Thanks
Tell me how to change the status of the light bulb in this example?
import os.path
from homekit import AccessoryServer from homekit.model import Accessory, LightBulbService
if name == 'main': try: httpd = AccessoryServer(os.path.expanduser('~/.homekit/demoserver.json'))
accessory = Accessory('test_light', 'homekit_python', 'Demoserver', '0001', '0.1')
lightService = LightBulbService()
accessory.services.append(lightService)
httpd.accessories.add_accessory(accessory)
httpd.publish_device()
print('published device and start serving')
httpd.serve_forever()
except KeyboardInterrupt:
print('unpublish device')
httpd.unpublish_device()
Sorry for the late reply. I am not exactly sure what you want to achieve?
- Do you want to control an existing HomeKit Accessory like a light bulb? Then you need to use the commands described in the ReadMe to first discover and pair the accessory then get and put characteristics to change the bulb's status.
- Do you want to simulate a HomeKit Accssory? Then demoserver.py might help.