Closed TheRaspyDev closed 8 years ago
The states of the DIP switches used for the HouseCode which are transmitted inversed in the protocol. To make the configuration of the HouseCode more intuitive, the inverted functions are used.
E.g. DIP switches of the HouseCode is UP,DOWN,DOWN,DOWN,UP (5 DIP switches). The HouseCode is transmitted as 01110 instead of 10001 -> The inverted function corrects this behaviour by giving the correct binary representation of the HouseCode. This simplifies the configuration for the user. -> 01110 will be interpreted as 17 which represents the "binary" states of the DIP switches.
Instead do write a extra function you can use a second bit mapping with inverted states.
Can you give me an example?
@TheRaspyDev You can use this:
binaryInverted = helper.map(binary, {'0': '1', '1': '0'});
Then use binaryInverted for the housecode and we can rid of the inverted helper functions.
Created a new fork and pull request as there are too many changes to merge my three month old code. In the new pull request my switch is "switch 24" because "switch 23" was already used in the meantime by another developer.
Works with my Power Remote.