Homegear / Homegear-Intertechno

Intertechno module for Homegear
1 stars 2 forks source link

REV-Ritter-Switch not working #2

Closed w194 closed 6 years ago

w194 commented 6 years ago

I replaced all "1" with "0" then all "F" with "1" in the fhem string, convert to decimal then added the switch in homegear

pc IT-COC 2 475

then I tried to change STATE using $hg->setValue(2, 1, "STATE", true);

Nothing happens at the switch but according to log the message is sent:

12/29/17 11:25:24.124 Script Engine Server: Info: Starting script "/var/lib/homegear/scripts/inline.php" with id 2.
12/29/17 11:25:24.148 Script Engine Server: Info: Client number 0 is calling RPC method: setValue Parameters:
(Integer) 2
(Integer) 1
(String) STATE
(Boolean) 1
12/29/17 11:25:24.149 Module Intertechno: Info: STATE of peer 2 with serial number ITD069DE4C3:1 was set to 0x01.
12/29/17 11:25:24.149 Module Intertechno: COC "IT-COC": Info: Sending (IT-COC): 11FF1110FFFF
12/29/17 11:25:24.150 Debug: Writing: 69733131464631313130464646460A
12/29/17 11:25:24.156 Script Engine Server: Response: 
(void)
12/29/17 11:25:24.167 Info: Script with id 2 finished with exit code 0
12/29/17 11:25:24.492 Debug (IT-COC): Packet s11FF1110FFFF enters raisePacketReceived.
12/29/17 11:25:24.492 Debug (IT-COC): Packet s11FF1110FFFF is now passed to the EventHandler.
12/29/17 11:25:24.491 Intertechno packet received from 00000000 (RSSI: -74 dBm): 
12/29/17 11:25:24.493 Debug (IT-COC): Packet processing of packet s11FF1110FFFF took 1 ms.

It looks like wrong packet is sent. It sends s11FF1110FFFF instead of s1FFF1FF0FFFF. So the address will be 195 not 475.

w194 commented 6 years ago

It works when using the hex address instead of decimal

def fhem_to_hg_hex(x):
    return hex(int(x.replace("1", "0").replace("F", "1"), 2))

fhem_to_hg_hex("1FFF1FF0FF") -> 0x1db

(Family)> pc IT-COC 2 0x1db
Added peer 4 with address 0x000001DB and serial number ITD000001DB.
hfedcba commented 6 years ago

No idea why it didn't work with the decimal address - i should... But great it works now!