Closed danielperna84 closed 8 years ago
Here are some steps to get started:
pyhomematic
a true library to interact 2-way with homematic devices, including allowing other scripts to register for callbacks etc. Abstract the XMLRPC API away and offer a nice API for other scripts, offer objects that represent a thermostat, a switch etc.homematic
that instantiates a pyhomematic
server. It will check with pyhomematic
what kind of platforms are supported and will fire discovery events for those platforms. This is exactly how Wink support
works.I would love to join in. Can offer way more motivation than experience. I have a working Homematic XML RPC Server implemented in Java but thats about all. Is there a good example for a "true library" with a similar setup as required for the Homemtaic component in Home Assistant?
I have restructured my module to be a library already since I've created this issue. It's available through pip as well. So actually the only parts missing right now, as far as I can tell, are the proper component and the platforms. Due to lack of time I haven't started with that. Have a look at my referenced repository. The readme as well as the provided example demonstrate how the library can / should be used. All that's needed to get started is installing it via pip and figuring out an efficient implementation.
I did some very first steps to integrate the pyhomematic into home-assist (not a working component yet):
https://github.com/jazzaj/home-assistant-homematic/blob/master/homematic.py
I have a good understanding how to use the Entity class to create devices but I have trouble to get a grip on the setup of the devices. Maybe @balloob can give me a hint:
Thanks for any hint...
I had a quick look.
for device in homematic.devices:
if device._TYPE == "HM-CC-RT-DN":
# setup Thermostat
elif ...
As for your questions:
My suggestion: Use the library straight from the commandline to get to know how it is behaving. Try to get it working there, and if it runs like that, try to recreate that with the component.
Thanks for your comments. I worked through them and made some progress. The code is working:
Still many things to do:
Guidance regarding auto-detection of devices is highly welcome. Mainly I lack an idea if a) I want this and b) how to trigger the creation of devices
The auto detection of devices is what I am unsure about as well. Since homematic doesn't name its devices, they have to be configured anyways. So the easy way would actually be to just do it like with the already existing thermostat platform, but instead of it creating its own xml rpc proxy, it could use the one provided by pyhomematic. Additionally, the platform would add its update-method as a callback to the corresponding device within pyhomematic. That way the homematic component wouldn't do more than just initializing the local server to receive events, and all the platforms would just leverage the callback-functionality provided by pyhomematic.
Meanwhile I have implemented an auto-detection option (will upload soon). Users can use the configuration file to turn this feature on or off. As you have pointed out by default there is no access to the device names and without names the auto detection part seems useless. At least for the Homematic CCU (not sure about Homegear) there is the option to set names but they are not accessible via the XML-RPC interface. The alternative would be for all CCUs that have the XML-API Addon installed (http://www.homematic-inside.de/software/addons/item/xmlapi). With devicelist.cgi you could obtain a list off all device names. What do you think? Do you see an option to integrate this into pyhomematic? Only for CCUs with the add-on installed the names could be added to the devices.
PS: I have left some pull requests and issues in the pyhomematic git... PSS: I'm confident to have by Monday an alpha version to integrate lights, switches and rollershutter into home assisstant.
Since I don't know about XML-API addon for Homegear as well, I suggest to initially focus on manual device/platform configuration. If that's done and working, name-resolving could be a feature within pyhomematic. So you could create the issue for that in my repo, since that's not directly related to home-assistant. I do indeed think that would be nice feature. Although I don't own a CCU, so I'd need some additional information about how all that works. But again, that's part of the pyhomematic-issue, not HA.
I'll have a look at the pull-requests. Thanks for mentioning. Didn't notice that.
Hi, I would like to see bi-directional communication between Home Assistant and Homeatic devices in the future.
Besides the already supported thermostats by Homematic, there are lots of devices that send event-messages to registered logic-providers to perform actions depending on the event-message content. Examples:
There are far more device for which this is true. And as of now, the available thermostat just polls the CCU / Homegear for that information. Which is ok for data with low volatility like temperature. But especially the sensors for doors / windows and switches depend on instant feedback.
That being said, I've put together a (standalone) module that showcases how bi-directional communication for Homematic devices can be implemented. It is a proof of concept which just creates log-messages for the events. For usability I primarily focused on easy interaction with devices, so it's not tailored for integration in HA.
I've had a look at the HA code, but could not grasp on how I could integrate my work in a way that makes sense and suits the architechture of HA. Hence I ask if someone could either guide me on how to integrate my code myself, or rework my code so it can be implemented.
Roughly explained it works like this:
Once bi-directional support is given within HA I would then proceed on implementing further device types (I have access to at least 15 other types of devices besides the 3 existing ones).
You can view my work here: pyhomematic
PS: The thermostat I have implemented would fix the Homematic-specific issue #709, not taking into account HA would generally need support for such modes.