GithubHelp home page GithubHelp logo

yangqian / hass-gelight Goto Github PK

View Code? Open in Web Editor NEW
39.0 2.0 14.0 33 KB

Home assistant custom component to control C by GE smart light bulb locally via Bluetooth

License: MIT License

Python 100.00%
ge-lights bluepy home-assistant home-automation blte smart-light smart-home

hass-gelight's Introduction

hass-gelight

What is it

This Home assistant custome components works for C by GE Smart Lights. E.g. https://www.gelighting.com/smart-home/led-bulbs

Tested it on Soft white and tunable white bulbs. It may work on Full color. GE lights are inexpensive because the Smart light is not Smart enough... You are supposed to locally connect to the GE Mesh through Bluetooth. Only one device can connect. So you have to choose to between the GE app or Google home to control them.

This code use the Home Assistant as the Hub to control GE lights so all your smart devices could be used to connect to the light via the Hub.

Requirement:

  • Install bluepy and dimond.

Note this might be done automatically by home assistant. The libraries are installed to ~/.homeassistant/deps/lib/python3.9/site-packages/. Bluepy had a bug in described in IanHarvey/bluepy#239 on aarch64. Please mannually fix it by applying the patch https://github.com/IanHarvey/bluepy/files/3800265/0001-Bugfix-of-high-CPU-usage.patch.txt to the file bluepy-helper.c and run make under the directory bluepy. Othewise, you might notice bluepy-helper use 100% CPU resources.

light:
  - platform: gelight
    password: %s
    username: %s
    lights:
      - id: %s
        mac: %s
        name: %s
        type:  17
      - id: %s
        mac: %s
        name: %s
        type:  20
  • paste the output to configuration.yaml.

Optional Requirement:

Documentation

Account API documentation can be found here (in Chinese).

hass-gelight's People

Contributors

pcon avatar sondercoder avatar yangqian avatar zimmra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hass-gelight's Issues

directions to install bluepy and diamond?

I am trying to follow this guide but I am unable to figure out how to install bluepy and diamond. I am running Hassio on a pi3b+. It appears python isn't available to the system but I'm not 100% sure.

Not working in Home Assistant v2022.7+

Since bluepy can only be installed for python versions lower than 3.10, this component isn't supported in the newer versions of home assistant.

Has anyone tried to change the library from bluepy to anything else such as bleak?

Line 159 Is Looking for hs_color, but is receiving rgb_color

I have this spun up in a temporary setup, so this issue is separate from the other that I've posted

I get the following error thrown

ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 619, in _update_entity_states
    await asyncio.gather(*tasks)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 283, in async_update_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 322, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/light/__init__.py", line 438, in state_attributes
    if supported_features & SUPPORT_COLOR and self.hs_color:
  File "/home/homeassistant/.homeassistant/custom_components/gelight/light.py", line 159, in hs_color
    return tuple(self.red,self.green,self.blue)
TypeError: tuple expected at most 1 argument, got 3

From what I can tell it is looking for hs_color which would be hue & saturation, but it is receiving rgb

There is color_RGB_to_hs available in color.py from homeassistant, but I am not sure how to modify the gelight script to look use this

Access token expired in get_config.py

I get the access token, refresh token, user id output after email 2fa but, when it goes to retrieve devices it always returns 403: access token expired.

➜  gelight git:(master) ✗ python3 get_config.py
Refresh token (if available):
`user_id` (if available):
Enable debug output? (y/N):
light:

DBG>>> Response from get_access_token(): {"access_token":"1007d2ad150c4000-2407d4c8e8629220jE4RThFMzIyMjdCMTA0RDRD<SANITIZED>,"refresh_token":"MkNFOTc3RjM4MUE0QzMzMDMxMzU2N<SANITIZED>","expire_in":604800}

DBG>>> using access token -> 1007d2ad150c4000-2407d4c8e8629220jE4RThFMzIyMjdCMTA0RDRD<SANITIZED>

DBG>>> Response from get_devices(): {"msg":"Access Token Expired","code":4031021,"data":null,"error":{"msg":"Access Token Expired","code":4031021},"status":403}

DBG>>> devices = {'msg': 'Access Token Expired', 'code': 4031021, 'data': None, 'error': {'msg': 'Access Token Expired', 'code': 4031021}, 'status': 403}

Any ideas?

Unable to use lightbulb in automations

I cannot use the bulb in any automations because it "does not have a unique ID." Is there a way to specify the entity_id in the configuration file so that automations can be run against the device? The error text points to this documentation.

Unable to Control Multiple Devices Consistently

Individual control of lamps works great after your recent update.

However when I try to control my group of lamps (total 6) not all of the lamps receive commands. It seems 1-3 of the lamps react when controlled as a group

I'd be happy to provide whatever info you'd like, although nothing appears 'wrong' in the debug logs.

Cannot connect to mesh

Home Assistant Info:

Version 0.118.3
Installation Type Home Assistant Container
Development false
Supervisor false
Docker true
Virtual Environment false
Python Version 3.8.6
Operating System Family Linux
Operating System Version 5.4.0-53-generic
CPU Architecture x86_64

I have bluepy and dimond installed within the container

I can see my devices when using bluetoothctl scan within the container

I have the gelight directory in the custom_components directory

Example of my config (values privatized):

light:
  - platform: gelight
    password: 114782
    username: 09468793751B
    lights:
      - id: 1
        mac: f4:bc:da:3b:3b:2c
        name: Vanity 2
        type: 21
      - id: 2
        mac: f4:bc:da:3c:5b:0f
        name: Vanity 5
        type: 21
      - id: 3
        mac: f4:bc:da:3b:c1:2p
        name: Vanity 1
        type: 21
      - id: 4
        mac: f4:bc:da:3b:00:97
        name: Vanity 3
        type: 6
      - id: 5
        mac: f4:bc:da:3a:ee:7d
        name: Vanity 4
        type: 6
      - id: 6
        mac: f4:bc:da:3b:87:4a
        name: Vanity 6
        type: 21

Error thrown:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 199, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/gelight/light.py", line 107, in async_setup_platform
    await hass.async_add_executor_job(mesh.connect)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/gelight/light.py", line 303, in connect
    raise Exception("Unable to connect to mesh %s" % self.address)
Exception: Unable to connect to mesh 09468793751B

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.