Skip to content

Commit

Permalink
v0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonV committed Nov 11, 2020
1 parent 3f42601 commit 8f64e8f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
19 changes: 13 additions & 6 deletions custom_components/ledfxrm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
)


SCAN_INTERVAL = timedelta(seconds=300)
SCAN_INTERVAL = timedelta(seconds=30)
DOMAIN = 'ledfxrm'
DEPENDENCIES = ['mqtt']

Expand Down Expand Up @@ -66,22 +66,25 @@ async def async_setup(hass: HomeAssistant, config: Config):

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up this integration using UI."""
#logging.warning('ENTRY: %s', entry)

#str_mydict = ''.join('{}{}'.format(key, val) for key, val in entry.data.items())
#logging.warning('ENTRY: %s', str_mydict)

if hass.data.get(DOMAIN) is None:
hass.data.setdefault(DOMAIN, {})
_LOGGER.info(STARTUP_MESSAGE)

thehost = entry.data.get('host')
theport = entry.data.get('port')
theversion = entry.data.get('version')

#theurl = entry.data.get('rest_info').get('url')
#thehost, theport = split_host_port(theurl)
#logging.warning('URL %s ', theurl )

#logging.warning('thehost %s ', thehost )
#logging.warning('theport %s ', theport )
logging.warning('Version %s ', theversion )
#logging.warning('Version %s ', theversion )

coordinator = LedfxrmDataUpdateCoordinator(
hass, thehost, theport, theversion
Expand Down Expand Up @@ -130,13 +133,17 @@ async def update(self):
async with session.get(url3, ssl=False) as resp_scenes:
rest_scenes = await resp_scenes.json()
yz['rest_scenes'] = rest_scenes
#logging.warning('REST_API: %s', yz)

#service_data = {'entity_id': 'input_select.ledfx_seceneselector' ,'options': ['off' 'on']}
#hass.services.call('input_select', 'set_options', service_data)
logging.warning('REST_API: %s', yz)

#logging.warning('REST_API: %s', yz)

return {'info':rest_info, 'devices': rest_devices, 'scenes': rest_scenes}

async def async_change_something(self, state):
logging.warning('BOOOOM: %s', state)

return {'status': 'ok'}

class LedfxrmDataUpdateCoordinator(DataUpdateCoordinator):
"""Class to manage fetching data from the API."""
Expand Down
6 changes: 5 additions & 1 deletion custom_components/ledfxrm/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Binary sensor platform for ledfxrm."""
from homeassistant.components.binary_sensor import BinarySensorEntity
import logging

from custom_components.ledfxrm.const import (
BINARY_SENSOR,
Expand Down Expand Up @@ -32,4 +33,7 @@ def device_class(self):
@property
def is_on(self):
"""Return true if the binary_sensor is on."""
return self.coordinator.data.get("bool_on", False)
logging.warning('YZ: %s', self.coordinator.data)
if self.coordinator.data.get("info").get("version") is None:
return False
return True
2 changes: 1 addition & 1 deletion custom_components/ledfxrm/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
NAME = "LedFX ReMote"
DOMAIN = "ledfxrm"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.0.1"
VERSION = "0.0.6"
MANUFACTURER = "YeonV"

ISSUE_URL = "https://github.com/YeonV/ledfxrm/issues"
Expand Down
6 changes: 3 additions & 3 deletions custom_components/ledfxrm/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ def unique_id(self):

@property
def device_info(self):
logging.warning('YZ: %s', self.coordinator.data)
logging.warning('YZ: %s {% version_installed %}', self.coordinator.data)
return {
"identifiers": {(DOMAIN, self.unique_id)},
"name": NAME,
"model": self.coordinator.data.get("info").get("name"),
"model": self.coordinator.data.get("info").get("name") + ' ' + self.coordinator.data.get("info").get("version"),
"manufacturer": MANUFACTURER,
"sw_version": self.coordinator.data.get("info").get("version"),
"sw_version": VERSION,
}

@property
Expand Down
Binary file removed custom_components/ledfxrm/icon.png
Binary file not shown.

0 comments on commit 8f64e8f

Please sign in to comment.