homekit_python icon indicating copy to clipboard operation
homekit_python copied to clipboard

Tell me how to change values ?

Open andreyxc opened this issue 3 years ago • 3 comments

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?

andreyxc avatar Sep 04 '22 22:09 andreyxc

I can not understand how to change the values in the code, for example, on or temperature?

Any chance to advise? Thanks

andreyxc avatar Sep 05 '22 11:09 andreyxc

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()

andreyxc avatar Sep 07 '22 10:09 andreyxc

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.

jlusiardi avatar Jun 10 '24 05:06 jlusiardi