I have never gotten Insteon REST to work. I installed OpenHab that has Insteon support out the box and used the OpenHab REST api.
Search u see my name you’ll find the custom component I wrote if you are interested.
I have never gotten Insteon REST to work. I installed OpenHab that has Insteon support out the box and used the OpenHab REST api.
Search u see my name you’ll find the custom component I wrote if you are interested.
Hi @chanders
Good to know i’m not alone. And although disappointing glad to know there is a work around is this the post you are referring too?
Thanks for the push in the right direction much appreciated. Do you experience any extra delay or problems integrating Insteon this way?
That’s the one. I have no delays at all. In fact it is faster than the REST api that is web based with Insteon because this is a local solution (running on the same machine).
If you want I can post some links to the Insteon component for you to setup in OpenHab and also post up my HA component.
I too am interested in this as I have both hue an insteon. The insteon component is the only thing I am missing. Insteon hasn’t gotten back to me about an API yet 3 months down the road.
There is no “attach file” here so I am going to paste the component. Save it as insteondimmeroh.py and place in your custom_components\light folder.
"""
Openhab light platform that implements lights.
"""
import logging
import requests
from homeassistant.components.light import (
ATTR_BRIGHTNESS, Light)
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = "Openhab Insteon Dimmer"
DEFAULT_BRIGHTNESS = "255"
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
"""Setup Openhab Insteon Dimmer platform."""
resource = config.get('resource')
if resource is None:
_LOGGER.error("Missing required variable: resource")
return False
try:
requests.get(resource, timeout=10)
except requests.exceptions.MissingSchema:
_LOGGER.error("Missing resource or schema in configuration. "
"Add http:// or https:// to your URL")
return False
except requests.exceptions.ConnectionError:
_LOGGER.error("No route to resource/endpoint: %s", resource)
return False
add_devices_callback([OpenhabLight(
hass,
config.get('name', DEFAULT_NAME),
config.get('resource'),
config.get('brightness', DEFAULT_BRIGHTNESS))])
class OpenhabLight(Light):
"""Provide an Openhab light."""
# pylint: disable=too-many-arguments
def __init__(self, hass, name, resource, brightness):
"""Initialize the light."""
self._state = None
self._hass = hass
self._name = name
self._resource = resource
self._brightness = brightness
@property
def should_poll(self):
"""Polling for a light."""
return True
@property
def name(self):
"""Return the name of the light if any."""
return self._name
@property
def brightness(self):
"""Return the brightness of this light between 0..255."""
return self._brightness
@property
def is_on(self):
"""Return true if light is on."""
request = requests.get(self._resource+"/state", timeout=10)
if int(float(request.text)) > 0:
self._state = True
else:
self._state = False
return self._state
def turn_on(self, **kwargs):
"""Turn the light on."""
onValue = str((kwargs.get(ATTR_BRIGHTNESS, int(self._brightness))/255)*100)
request = requests.post(self._resource,
data=onValue,
timeout=10)
if (request.status_code == 200) or (request.status_code == 201):
self._state = True
else:
_LOGGER.info("HTTP Status Code: %s", request.status_code)
_LOGGER.error("Can't turn on %s. Is resource/endpoint offline?", self._resource)
self.update_ha_state()
def turn_off(self, **kwargs):
"""Turn the light off."""
request = requests.post(self._resource, data="0", timeout=10)
if (request.status_code == 200) or (request.status_code == 201):
self._state = False
else:
_LOGGER.error("Can't turn off %s. Is resource/endpoint offline?",
self._resource)
self.update_ha_state()
What version of OpenHab are you running?
I have got open hab up and running I am now trying to wrap my head around getting it to see the switches and dimmer modules I have. I assume I have to add them manually into the system somewhere? Also man Home assistaint looks so much better.
Thanks @chanders ill get OpenHAB up and running and give this a go and hopefully polish off my Home Assistant install.
1.8
I just sent you a PM
I have OpenHAB up and running and i am trying to Bind my Insteon hub and set up devices. Do you have any information on doing this. OpenHAB seams to be a larger learning curve than i had anticipated. I have read there docs and populated the config, items and sitemaps but still failing don’t want to dive too deep as this is simply to make Home Assistant work… Any help would be apreciated.
I have open hab triggering the switches now. Later I will work on the home Assistan part. If you need help let me know.
See here for a comprehensive guide
However after registering for the API, waiting for it and then finally filling out my details I’ve ran into a problem.
Wait… you actually got an API key from them? I’ve been waiting for 5 weeks on my most recent request and 6 months on my previous one…
Yes, pretty quickly too. I think it took around a week.But turned out to be useless for my Hub1 which i mistook for the Hub 2. hopefully it will come in use IF Insteon ever release the Hub Pro to the UK.
Just wanted to chime back in and thank you @Chanders with your help i am now able to switch all of my devices via the PLM in my Hub1 thank you very much! Going to try and get the dimming working next.
I would really like to see a PLM component done for Homeassistant. I am in no way capable of doing this as I would not even know where to start.
Pardon me for resurrecting a thread, but is it possible to set a ramp rate? Insteon has a predefined set of rates that are defined by hexadecimal, so a “transition time” attribute in Home Assistant won’t work.“Ramp rate” is a transition rate that controls how fast or slow I want to turn on and off a light.
Have a look at this:
http://www.madreporite.com/insteon/ramprate.htm
I’m not sure how to do that in OpenHAB, but if it’s possible to do that with a custom component, that’d be great.
There’s been a feature request for OpenHAB since last year, but it’s closed.
Please pardon me for resurrecting the thread, but the code that’s made back in July 16, 2016 does not expose the slider for controlling the brightness of the light in 0.37.
I will be switching from 2012 Hub to 2014 model soon with insteon_local component. My motivation for 2012 Hub is the PLM functionality.
I have the same problem with the code not showing the light as a dimmer in HA. Were you able to figure out a fix?