Using Homematic/Intertechno Devices with Homegear

I’m using HA for a couple of days and i’m happy with that right now.

What i’ve done is set up a homegear instance on my raspberry pi to mange my Homematic components that are connected to the HM-LAN-CFG device. Works like charm right now - connecting with the configuration entry:

Homematic Device Configuration

homematic:
  hosts:
    rf:
      ip: 192.168.21.20
      resolvenames: metadata
      username: Admin
      password: 
      primary: true
      variables: true

All Homematic devices that are paired to homegear are automaticaly shown in HA !

After that i added an intertechno configuration inside homegear and added some switches, that can be switched successfully using the homegear CLI.

But the intertechno devices are not shown in HA right now. How can i add those Intertechno switches to HA (using homegear) ?

These lines are shown in the log during startup:

2017-09-28 16:57:32 DEBUG (Thread-2) **[pyhomematic._hm] RPCFunctions.createDeviceObjects: created ITD00000221  as UNSUPPORTED device for IT-Switch**

You could head over to the pyhomematic repository which is used for communication with the CCU/Homegear. The big question would be, if Intertechno devices can be controlled via the XML-RPC API the same way as it is possible with the HomeMatic devices.
If you are comfortable using Python you might as well manually step through what is done in example.py and use the proxy-object that is being created to take control. If pyhomematic.devices_all['ITD00000221 :1'].getValue("STATE") returns some usefule information (given it has a ‘STATE’ parameter on channel 1), then it would be possible the include intertechno devices from Homegear.

I’ve been at the pyhomematic repository allready and was a bit confused about the description. pyhomematic provides the control of Homematic devices and not IT components. Homegear is able to switch IT devices using the specified device, like in my case, the CUL from busware.de

I’m not very familiar using Python so I am not quite sure what to do with the example.py script to figure out what values i can get in return of the IT devices.

In homegear the CUL devices is added with the following config settings:

[CUL]
id = My-CUL

Uncomment this if you want this CUL to be your default communication module.

#default = true
deviceType = cul
device = /dev/ttyACM0
baudrate = 57600

and I am able to add the Intertechno devices there.

Connecting with the Homematic config tool to homegear with the xmlrpc protocoll, the tool shows up the added IT devices.

I guess the IT devices are completely different from homematic, because it’s another protocol (no BidCoS) and there is no bidirectional communication.

Even though IT devices are different from HomeMatic, Homegear seems to “map” IT devices to the XML-RPC API. The screenshot from the config-tool clearly shows the IT devices, and pyhomematic uses exactly the same API to control HomeMatic devices. So now we know for sure, that at least in theory pyhomematic could control IT devices via Homegear.
What I would need you to do is making the same screenshot, but this time with one of the ITs + being pressed so I can see some of the details of the device. With that I might be able to prepare a set of commands you could just copy and paste to test if it’s working.

The only thing i can show you is when using the switch command on the homegear CLI and the output of the referring log event.

That’s even better then what I have asked for. IT devices are controlled in the same way as HomeMatic devices. And that’s also how HASS is controlling the devices through pyhomematic.
There’s just one more thing I need to know:
In your example you did setValue(10, 1 "STATE", true). Is it also possible to use the device serial number instead of the ID? So probably setValue("ITD00000221", 1, "STATE", true)? pyhomematic is using the serial numbers, which are what is being advertised when establishing the connection. Alternatively try the address without the ITD prefix (since ITD seems to always be the same, so I could strip that out).

Doesn’t seem to work using the serial of the device in both ways (with ITD or just using the numeric values). Got an exit code 255 on homegear CLI.

The command ref of homgear for the setValue command does not include some kind of “serial switchting” at all.

https://ref.homegear.eu/rpc.html#setValue

The documentation also shows the deprecated method. Thinking of it, that’s what we are doing for HomeMatic. So instead please try this:
setValue("00000221:1", "STATE", true) or setValue("ITD00000221:1", "STATE", true)

If that doesen’t work as well, we’d have to find out if we can somehow extract the interface ID manually.

However, what should work from HASS right now already:

Using that approach you could configure an input_boolean, and then have an automation that reacts on state changes and calls the homematic.dev_set_value service accordingly.

The setValue command failed again using the CLI. Seems only to work with the specified ID.

Also the call service homematic option does not work at all.

HA log:

2017-10-04 12:55:06 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service=set_dev_value, domain=homematic, service_call_id=1972761456-11, service_data=address=00000221, channel=1, value=true, param=STATE>
2017-10-04 12:55:06 ERROR (Thread-4) [homeassistant.components.homematic] 00000221 not found!

BUT, i’m wondering about the events in the homgear log, because there are incoming events of the switch command. in fact, the switch does not turn on or off! :frowning:

10/04/17 13:02:10.845 RPC Server (Port 2001): Info: Client number 128172 is calling RPC method: setValue (1) Parameters:
(String) ITD00000221:1
(String) STATE
(String) false
10/04/17 13:02:10.846 Module Intertechno: Info: STATE of peer 10 with serial number ITD00000221:1 was set to 0x00.
10/04/17 13:02:10.846 Module Intertechno: Intertechno CUL “CUL1”: Info: Sending (CUL1): F000F0000FF0
10/04/17 13:02:11.179 Intertechno packet received from 00000000 (RSSI: -74 dBm):
10/04/17 13:02:28.158 RPC Server (Port 2001): Info: Connection from ::ffff:192.168.21.20:33876 accepted. Client number: 128174
10/04/17 13:02:28.158 RPC Server (Port 2001): Info: RPC server client id for client number 128174 is: 17099
10/04/17 13:02:28.159 RPC Server (Port 2001): Info: Client number 128174 is calling RPC method: setValue (1) Parameters:
(String) ITD00000221:1
(String) STATE
(String) true
10/04/17 13:02:28.159 Module Intertechno: Info: STATE of peer 10 with serial number ITD00000221:1 was set to 0x01.
10/04/17 13:02:28.159 Module Intertechno: Intertechno CUL “CUL1”: Info: Sending (CUL1): F000F0000FF0
10/04/17 13:02:28.493 Intertechno packet received from 00000000 (RSSI: -74 dBm):

Hey! What i’ve found out is, that Home Assistant is always sending an “turn off” signal to the intertechno switch! If I use the homegear CLI to switch the Intertechno switch on, and THEN i move to the HA webinterface to call the homematic service and turn the switch (using the serial number) on or off again, it turns off! in both cases HA sends an “off” command. As you can see in the logfile it’s FF = on / F0 = off.

Homegear (set Value true):
10/04/17 13:07:22.371 Module Intertechno: Info: STATE of peer 10 with serial number ITD00000221:1 was set to 0x01.
10/04/17 13:07:22.371 Module Intertechno: Intertechno CUL “CUL1”: Info: Sending (CUL1): F000F0000FFF

Homegear (set Value false):
10/04/17 13:10:24.339 Module Intertechno: Info: STATE of peer 10 with serial number ITD00000221:1 was set to 0x00.
10/04/17 13:10:24.339 Module Intertechno: Intertechno CUL “CUL1”: Info: Sending (CUL1): F000F0000FF0

Home Assitant (set Value true):
10/04/17 13:08:19.182 Module Intertechno: Info: STATE of peer 10 with serial number ITD00000221:1 was set to 0x01.
10/04/17 13:08:19.182 Module Intertechno: Intertechno CUL “CUL1”: Info: Sending (CUL1): F000F0000FF0
10/04/17 13:08:19.516 Intertechno packet received from 00000000 (RSSI: -74 dBm):

Home Assistant (set Value false):
10/04/17 13:08:54.544 Module Intertechno: Info: STATE of peer 10 with serial number ITD00000221:1 was set to 0x00.
10/04/17 13:08:54.544 Module Intertechno: Intertechno CUL “CUL1”: Info: Sending (CUL1): F000F0000FF0
10/04/17 13:08:54.878 Intertechno packet received from 00000000 (RSSI: -74 dBm):

so the setValue true command from Home Assistant must be FF instead of F0.

Could you try if using 0 and 1 instead auf true/false makes a difference? Even though the log says 0x00 and 0x01 in correlation to true/false, it might be worth a try.

nope, that doesn’ work…

only “true” is going to switch the IT switch, but it doesn’t matter what i put in for false, it turns the switch off.

kind of funny :slight_smile:

image

To me it seems as if the XML-RPC API of Homegear has a bug in this case. Every value that’s being passend is translated to the boolean false. One more test to verify this would be to do the following in a Python 3 shell:

from xmlrpc.client import ServerProxy
p = ServerProxy("http://1.2.3.4:2001") # Homegear, like configured for HASS
p.setValue("ITD00000221:1", "STATE", True) # Test with real boolean
p.setValue("ITD00000221:1", "STATE", 1) # Test with integer
p.setValue("ITD00000221:1", "STATE", 15) # Test with integer, 15 being F in Hex
p.setValue("ITD00000221:1", "STATE", hex(15)) # Test real Hex F

If all of these setValue commands (which are pretty much the same as what you’re doing in the Homegear CLI, except using the address) fail to turn on the switch, then Homgear does not accept the usually correct values via XML-RPC. Which is odd actually, because the one log you’ve posted indicates, that it detects true and false correctly. It’s more like the conversion from true (XML-RPC) does not get translated to the required FF that is required for Intertechno.
In that case I would head over to the Homegear repo at https://github.com/Homegear/ and create an issue to get this fixed. Even though the way we use the XML-RPC API is flagged as deprecated from Homegears point of view, it still has to be in place for being compatible with the CCU. And even though technically Intertechno isn’t Homematic, I see a value in being able to control the interfaces with the same API. Hence I would ask if this could be fixed.

PS: I’ve ordered a CUL and got an Intertechno Jalousieaktor to further test this. I’ll have a look at it when it arrives.

p.setValue(“ITD00000221:1”, “STATE”, True) <-- WORKS
p.setValue(“ITD00000221:1”, “STATE”, 1) <-- NOT
p.setValue(“ITD00000221:1”, “STATE”, 15) <-- NOT
p.setValue(“ITD00000221:1”, “STATE”, hex(15)) <-- NOT

I’ve opened an issue at the homegear git: https://github.com/Homegear/Homegear-Intertechno/issues/1

Please confirm: that command actually turns the switch on?

yes, it turns the switch on. i can hear the switch klicking in the hallway :wink:

Uhm, then it’s actually working and I don’t understand why the same RPC call generated by HASS is not working.
Can you include the log part where it’s saying:

(String) ITD00000221:1
(String) STATE
(String) false

Maybe it’s different when using the True and shows (Boolean) true. If so, then the command we are sending seems to be the issue.

Set TRUE

10/05/17 13:35:43.950 RPC Server (Port 2001): Info: RPC server client id for client number 14656 is: 4170
10/05/17 13:35:43.950 RPC Server (Port 2001): Info: Client number 14656 is calling RPC method: setValue (1) Parameters:
(String) ITD00000221:1
(String) STATE
(Boolean) 1
10/05/17 13:35:43.951 Module Intertechno: Info: STATE of peer 10 with serial number ITD00000221:1 was set to 0x01.
10/05/17 13:35:43.951 Module Intertechno: Intertechno CUL "CUL1": Info: Sending (CUL1): F000F0000FFF
10/05/17 13:35:44.284 Intertechno packet received from 00000000 (RSSI: -74 dBm): 

Set FALSE

10/05/17 13:35:45.471 RPC Server (Port 2001): Info: Connection from ::ffff:192.168.21.20:39736 accepted. Client number: 14658
10/05/17 13:35:45.471 RPC Server (Port 2001): Info: RPC server client id for client number 14658 is: 4171
10/05/17 13:35:45.473 RPC Server (Port 2001): Info: Client number 14658 is calling RPC method: setValue (1) Parameters:
(String) ITD00000221:1
(String) STATE
(Boolean) 0
10/05/17 13:35:45.473 Module Intertechno: Info: STATE of peer 10 with serial number ITD00000221:1 was set to 0x00.
10/05/17 13:35:45.473 Module Intertechno: Intertechno CUL "CUL1": Info: Sending (CUL1): F000F0000FF0
10/05/17 13:35:45.807 Intertechno packet received from 00000000 (RSSI: -74 dBm):

Ok, so the problem seems to be that calling the set_dev_value service transfers the data as a string, which is ok for HomeMatic devices, but the Intertechno backend seems to need a real boolean. Which technically is correct. But since Homegear still detects wheter it is 0x00 or 0x01 correctly when the string is sent, it should be at least streamlined to be equal to how it is for HomeMatic devices.

One more thing I’m curious about is how the switch behaves when being “supported”. For this to happen it should actually be enough to edit pyhomematic/devicestypes/actors.py and add the following line to the dictionary at the bottom:

"IT-Switch": Switch,

With that in place restart HASS, then you should already be getting the entities for the switches. Using the entity might work for turning on the switch since in explicitly uses a boolean when using the RPC method.
What might not work is the updating of the current state. That’s done by evaluating the events the CCU emits. But Intertechno is not bi-directional as far as I know, so there may be no events that would toggle the UI state.

works like charm :smiley:

what I did:

  • added IT-Switch as known actor to the actory.py
  • restart HASS
  • IT-Switch components are shown up as entities in HASS
  • used call a service for domain switch with services turn_on and turn_off

image

image

the switch reacts on both services, so the lamp at the switch turns on and off.