profile
viewpoint

Bouke/django-federated-login 18

Django Federated Login provides an authentication bridge between Django projects and OpenID-enabled identity providers.

Bouke/django-airbrake 17

Django Airbrake provides a logging handler to push exceptions and other errors to airbrakeapp or other airbrake-compatible exception handler services (e.g. aTech Media's Codebase).

Bouke/Bignum 4

Swift big number library

Bouke/django-filebrowser-no-grappelli 4

Media-Management without Grappelli and patched for S3

Bouke/CLibSodium 3

Swift overlay for libsodium

Bouke/Cdns_sd 1

Swift C modulemap for dns_sd.h

Bouke/CNCurses 1

Modulemap for NCurses

Bouke/django 1

The Web framework for perfectionists with deadlines. Now on GitHub.

Bouke/django-cms 1

An Advanced Django CMS.

Bouke/AutoMapper 0

A convention-based object-object mapper in .NET.

fork myii/django-two-factor-auth

Complete Two-Factor Authentication for Django providing the easiest integration into most Django projects.

http://example-two-factor-auth.herokuapp.com/

fork in 21 hours

startedBouke/django-two-factor-auth

started time in 21 hours

startedBouke/django-two-factor-auth

started time in 2 days

fork unusualpepe/django-two-factor-auth

Complete Two-Factor Authentication for Django providing the easiest integration into most Django projects.

http://example-two-factor-auth.herokuapp.com/

fork in 2 days

issue closedBouke/HAP

Characteristic Function not called when updating powerState or brightness of a Accessory.Lightbulb subclass

I'm using HAP for an application to implement HomeKit for devices on a Control4 home automation system. Currently the HAP bridge can run on a Mac and on an Xcode simulated iPad.

The list of Control4 devices is read from the C4 controller on startup. This list is presented through the user interface where each device can be added dynamically to the bridge or removed if active. So far I've written the code for lights and locks. These work as expected through the home app and with Siri.

When a device is active and selected, UI controls are presented for managing the device. For a light these consists of an on/off switch and a slider for brightness.

It is my understanding that the following code will turn on the light and set the brightness to 50%. I've included the C4HKLight class definition below. The C4Light class is used to control the light through the C4 controller when the characteristic function is called.

let light = C4HKLight(C4Light())
light.lightbulb.powerState.value = true
light.lightbulb.brightness?.value = 50

But when this is executed, the light does not change from whatever state it is in. The device icon in the home app on my iPhone does change to reflect the new setting. After a couple of seconds the icon in the Home app changes back to the state it was in before the code above was executed. The overridden characteristic function in the C4HKLight class is never executed.

If I use the home app to turn on/off or dim the light, the light is turned on/off or dimmed and the overridden characteristic function is executed.

So, the characteristic function in my subclass is called when I adjust the light in the home app but not when I make light value changes from within my application.

Anyone know what the problem may be or can you offer a suggestion for debugging it?

Thanks.

I have HAP included in my Xcode project as a Swift Package Dependency. I have not modified it in any way.

The C4HKLight class is defined as follows.

class C4HKLight: Accessory.Lightbulb {
    var c4Light: C4Light
    
    init(c4Light: C4Light) {
        self.c4Light = c4Light
        super.init(info: Service.Info(name: c4Light.itemName, serialNumber: "\(c4Light.itemID)"), isDimmable: c4Light.isDimmable)
    }
    
    override func characteristic<T>(_ characteristic: GenericCharacteristic<T>,
                                    ofService service: Service,
                                    didChangeValue newValue: T?) {
        if characteristic === lightbulb.powerState {
            logger.info("power state: \(String(describing: newValue))")
            if newValue as! Bool  {
                c4Light.lightOn()
            } else {
                c4Light.lightOff()
            }
        }
        if characteristic === lightbulb.brightness {
            c4Light.setLightLevel(level: newValue as! Int)
        }
        print("****** characteristic: \(characteristic)")
        super.characteristic(characteristic, ofService: service, didChangeValue: newValue)
    }
}

closed time in 4 days

ctmanley

issue commentBouke/HAP

Characteristic Function not called when updating powerState or brightness of a Accessory.Lightbulb subclass

Thanks. I wasn't sure from the documentation that characteristic wasn't also called on a value change.

ctmanley

comment created time in 4 days

startedBouke/django-two-factor-auth

started time in 5 days

issue commentBouke/HAP

Characteristic Function not called when updating powerState or brightness of a Accessory.Lightbulb subclass

The problem is that the characteristic function is not being executed. The c4Light functions work fine when the characteristic function is called.

When I manage the light from within the home app the characteristic function is called and the c4Light functions are called properly.

When I executed the following within my code the characteristic function in the C4HKLight subclass is not called.

let light = C4HKLight(C4Light()) light.lightbulb.powerState.value = true light.lightbulb.brightness?.value = 50

ctmanley

comment created time in 5 days

issue commentBouke/HAP

Characteristic Function not called when updating powerState or brightness of a Accessory.Lightbulb subclass

I think you need to call a didChange function from the if characteristic line Here is some an example from a project I'm working on

`override func characteristic<T>(_ characteristic: GenericCharacteristic<T>, ofService service: Service, didChangeValue newValue: T?) { if characteristic === lightbulb.powerState { didChangePowerState(newValue: Bool(newValue as! Bool)) } if characteristic === lightbulb.brightness { didChangeBrightness(newValue: Int(newValue as! Int)) } if characteristic === lightbulb.hue { didChangeHue(newValue: Float(newValue as! Float)) }

    if characteristic === lightbulb.saturation {
        didChangeSaturation(newValue: Float(newValue as! Float))
    }
        
        super.characteristic(characteristic, ofService: service, didChangeValue: newValue)
    }`

That then calls

`func didChangePowerState(newValue: Bool) {

if !self.powerState { RGBValues = [0,0,0] } else { convert() } sendData()

}`

So create a function `func didChangePowerState(newValue: Bool) {

if newValue { c4Light.lightOn() } else { c4Light.lightOff() }

}`

ctmanley

comment created time in 5 days

issue openedBouke/HAP

Characteristic Function not called when updating powerState or brightness of a Accessory.Lightbulb subclass

I'm using HAP for an application to implement HomeKit for devices on a Control4 home automation system. Currently the HAP bridge can run on a Mac and on an Xcode simulated iPad.

The list of Control4 devices is read from the C4 controller on startup. This list is presented through the user interface where each device can be added dynamically to the bridge or removed if active. So far I've written the code for lights and locks. These work as expected through the home app and with Siri.

When a device is active and selected, UI controls are presented for managing the device. For a light these consists of an on/off switch and a slider for brightness.

It is my understanding that the following code will turn on the light and set the brightness to 50%. I've included the C4HKLight class definition below. The C4Light class is used to control the light through the C4 controller when the characteristic function is called.

let light = C4HKLight(C4Light()) light.lightbulb.powerState.value = true light.lightbulb.brightness?.value = 50

But when this is executed, the light does not change from whatever state it is in. The device icon in the home app on my iPhone does change to reflect the new setting. After a couple of seconds the icon in the Home app changes back to the state it was in before the code above was executed. The overridden characteristic function in the C4HKLight class is never executed.

If I use the home app to turn on/off or dim the light, the light is turned on/off or dimmed and the overridden characteristic function is executed.

So, the characteristic function in my subclass is called when I adjust the light in the home app but not when I make light value changes from within my application.

Anyone know what the problem may be or can you offer a suggestion for debugging it?

Thanks.

I have HAP included in my Xcode project as a Swift Package Dependency. I have not modified it in any way.

The C4HKLight class is defined as follows.

class C4HKLight: Accessory.Lightbulb { var c4Light: C4Light

init(c4Light: C4Light) {
    self.c4Light = c4Light
    super.init(info: Service.Info(name: c4Light.itemName, serialNumber: "\(c4Light.itemID)"), isDimmable: c4Light.isDimmable)
}

override func characteristic<T>(_ characteristic: GenericCharacteristic<T>,
                                ofService service: Service,
                                didChangeValue newValue: T?) {
    if characteristic === lightbulb.powerState {
        logger.info("power state: \(String(describing: newValue))")
        if newValue as! Bool  {
            c4Light.lightOn()
        } else {
            c4Light.lightOff()
        }
    }
    if characteristic === lightbulb.brightness {
        c4Light.setLightLevel(level: newValue as! Int)
    }
    print("****** characteristic: \(characteristic)")
    super.characteristic(characteristic, ofService: service, didChangeValue: newValue)
}

}

created time in 6 days

startedBouke/SRP

started time in 8 days

issue commentBouke/HAP

Improve documentation

More needs doing, I'm trying to figure out how to build a light accessory to send E1.31 data using https://github.com/dnadoba/sACN but can't figure it out easily

Bouke

comment created time in 8 days

startedBouke/HAP

started time in 8 days

pull request commentBouke/HAP

Replace Libsodium with SwiftCrypto (fork)

I've been revisiting this, looking through my original pull request and this one. While I still like the approach of putting all the Crypto calls into the Authenticator class in my implementation, I've no logical objections to doing it this way.

Work in progress. Idea is to drop Libsodium completely as a dependency. I find the API documentation hard to work with, it doesn't specify what primitives it uses and leaves a lot of guess work when implementing. Using the CryptoKit API, we can remove various low-level C calls.

Regarding compatibility with older macOS / iOS, we can fork swift-crypto to support that / force it to always use BoringSSL.

Yes that could work. I've just built and ran tests on a BoringSSL backed version on Big Sur (forcing the replacement of CrypoKit) and it seemed to work.

Update I cannot build BoringSSL on my Raspberry (ARM). Holding off on merging this.

While I know the original idea was to drop libsodium universally, if BoringSSL is posing a problem on your Pi, would it be useful to implement a version of Crypto with libsodium shim's, just for the small part of the api that we use in HAP ?

That would allow us to merge this PR into the main branch, use CryptoKit on BigSur/iOS 14, use SwiftCrypto with BoringSSL elsewhere (macOS earlier than Big Sur with ) and still cover platforms where SwiftCrypto does not yet work properly (Raspberry Pi), at least until that is fixed.

Bouke

comment created time in 9 days

push eventBouke/HAP

Bouke

commit sha 970f3df1c35d1a7e3f8f744dc040059c52ab140b

Deploying Updated Jazzy Docs

view details

push time in 12 days

startedBouke/django-two-factor-auth

started time in 14 days

fork kentnz/HAP

Swift implementation of the Homekit Accessory Protocol

https://boukehaarsma.nl/HAP/

fork in 14 days

startedBouke/SwiftInitializerGenerator

started time in 15 days

push eventBouke/HAP

Bouke

commit sha 5f876e7257b521acd62286a10e1e5edc2d259f20

Deploying Updated Jazzy Docs

view details

push time in 15 days

pull request commentBouke/HAP

Fix swiftlint issues

Kudos, SonarCloud Quality Gate passed!

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Bugs
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Vulnerabilities
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Security Hotspots
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 4 Code Smells

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/0.png' alt='0.0%' width='16' height='16' /> 0.0% Coverage
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' /> 0.0% Duplication

Bouke

comment created time in 15 days

pull request commentBouke/HAP

Fix swiftlint issues

Kudos, SonarCloud Quality Gate passed!

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Bugs
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Vulnerabilities
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Security Hotspots
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 4 Code Smells

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/0.png' alt='0.0%' width='16' height='16' /> 0.0% Coverage
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' /> 0.0% Duplication

Bouke

comment created time in 15 days

pull request commentBouke/HAP

Fix swiftlint issues

Kudos, SonarCloud Quality Gate passed!

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Bugs
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Vulnerabilities
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Security Hotspots
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Code Smells

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/0.png' alt='0.0%' width='16' height='16' /> 0.0% Coverage
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' /> 0.0% Duplication

Bouke

comment created time in 15 days

pull request commentBouke/HAP

Fix swiftlint issues

Kudos, SonarCloud Quality Gate passed!

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Bugs
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Vulnerabilities
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Security Hotspots
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Code Smells

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/0.png' alt='0.0%' width='16' height='16' /> 0.0% Coverage
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' /> 0.0% Duplication

Bouke

comment created time in 15 days

push eventBouke/HAP

Bouke

commit sha 4fe962386a1ea1437cb54d9206f4e2958de779c8

Deploying Updated Jazzy Docs

view details

push time in 15 days

pull request commentBouke/HAP

Fix swiftlint issues

Kudos, SonarCloud Quality Gate passed!

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Bugs
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Vulnerabilities
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Security Hotspots
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' /> <img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' /> 0 Code Smells

<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/0.png' alt='0.0%' width='16' height='16' /> 0.0% Coverage
<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' /> 0.0% Duplication

Bouke

comment created time in 15 days

push eventBouke/HAP

Bouke

commit sha 76061a0ca1f0ba8671c55fe97fb7948fcd3e004d

Deploying Updated Jazzy Docs

view details

push time in 15 days

push eventBouke/HAP

Bouke

commit sha d4df25caa12d0bcc62255c2729fadc2b91a7eb04

Deploying Updated Jazzy Docs

view details

push time in 15 days

startedBouke/django-two-factor-auth

started time in 15 days

Pull request review commentBouke/HAP

Add logging bootstrap to select debug messages

 fileprivate let logger = Logger(label: "bridge")     import Glibc #endif +func createLogHandler(label: String) -> LogHandler {+    var handler = StreamLogHandler.standardOutput(label: label)+    #if DEBUG+        print("DEBUG")+        switch label {+        case "hap.encryption":+            handler.logLevel = .info+        case _ where label.starts(with: "hap"):+            handler.logLevel = .debug+        default:+            handler.logLevel = .info+        }+    #else+        // No logging+        handler.logLevel = .critical+    #endif+    return handler+}+LoggingSystem.bootstrap(createLogHandler)

Sure, I've lifted createLogHandler() out to a separate file. I suggest we keep the call LoggingSystem.bootstrap() in the main file, as it should only be called as the program starts up.

gbrooker

comment created time in 16 days

Pull request review commentBouke/HAP

Make AccessoryType, ServiceType and CharacteristicType's CustomStringConvertible

 public class Inspector {         for category in categoryInfo.sorted(by: { $0.id < $1.id }) {             write("\tcase \(categoryName(category.name)) = \"\(category.id)\"")         }-        write("}")+        write("""+        }++        extension AccessoryType: CustomStringConvertible {+            public var description: String {+                switch self {+        """)+        for category in categoryInfo.sorted(by: { $0.id < $1.id }) {+            write("\t\tcase .\(categoryName(category.name)):")

OK I've replaced all the \t with four spaces

gbrooker

comment created time in 16 days

more