Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tell me how to change values ? #242

Open
andreyxc opened this issue Sep 4, 2022 · 3 comments
Open

Tell me how to change values ? #242

andreyxc opened this issue Sep 4, 2022 · 3 comments

Comments

@andreyxc
Copy link

andreyxc commented Sep 4, 2022

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
Copy link
Author

andreyxc commented Sep 5, 2022

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

Any chance to advise? Thanks

@andreyxc
Copy link
Author

andreyxc commented Sep 7, 2022

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

@jlusiardi
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants