model

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatTimeHoursMinutes                            = "15:04"
	TimeoutReservationPendingModificationDoneDuration = time.Hour * 72
)

Variables

View Source
var (
	NukiActionUnlock                    = NukiAction(1)
	NukiActionLock                      = NukiAction(2)
	NukiActionUnlatch                   = NukiAction(3)
	NukiActionLockNGo                   = NukiAction(4)
	NukiActionLockNGoWithUnlatch        = NukiAction(5)
	NukiActionDoorWarningAjar           = NukiAction(208)
	NukiActionDoorWarningStatusMismatch = NukiAction(209)
	NukiActionDoorbellRecognition       = NukiAction(224)
	NukiActionDoorOpened                = NukiAction(240)
	NukiActionDoorClosed                = NukiAction(241)
	NukiActionDoorSensorJammed          = NukiAction(242)
	NukiActionFirmwareUpdate            = NukiAction(243)
	NukiActionDoorLogEnabled            = NukiAction(250)
	NukiActionDoorLogDisabled           = NukiAction(251)
	NukiActionInitialization            = NukiAction(252)
	NukiActionCalibration               = NukiAction(253)
	NukiActionLogEnabled                = NukiAction(254)
	NukiActionLogDisabled               = NukiAction(255)
	NukiActions                         = map[NukiAction]string{
		NukiActionUnlock:                    "unlock",
		NukiActionLock:                      "lock",
		NukiActionUnlatch:                   "unlatch",
		NukiActionLockNGo:                   "lock'n'go",
		NukiActionLockNGoWithUnlatch:        "lock'n'go with unlatch",
		NukiActionDoorWarningAjar:           "door warning ajar",
		NukiActionDoorWarningStatusMismatch: "door warning status mismatch",
		NukiActionDoorbellRecognition:       "doorbell recognition (only Opener)",
		NukiActionDoorOpened:                "door opened",
		NukiActionDoorClosed:                "door closed",
		NukiActionDoorSensorJammed:          "door sensor jammed",
		NukiActionFirmwareUpdate:            "firmware update",
		NukiActionDoorLogEnabled:            "door log enabled",
		NukiActionDoorLogDisabled:           "door log disabled",
		NukiActionInitialization:            "initialization",
		NukiActionCalibration:               "calibration",
		NukiActionLogEnabled:                "log enabled",
		NukiActionLogDisabled:               "log disabled",
	}
)
View Source
var (
	NukiDeviceTypeSmartlock = NukiDeviceType(0)
	NukiDeviceTypeOpener    = NukiDeviceType(2)
	NukiDeviceTypeSmartdoor = NukiDeviceType(3)
	NukiDeviceTypes         = map[NukiDeviceType]string{
		NukiDeviceTypeSmartlock: "smartlock",
		NukiDeviceTypeOpener:    "opener",
		NukiDeviceTypeSmartdoor: "smartdoor",
	}
)
View Source
var (
	NukiSourceDefault     = NukiSource(0)
	NukiSourceKeypadCode  = NukiSource(1)
	NukiSourceFingerprint = NukiSource(2)
	NukiSources           = map[NukiSource]string{
		NukiSourceDefault:     "Default",
		NukiSourceKeypadCode:  "Keypad code",
		NukiSourceFingerprint: "Fingerprint",
	}
)
View Source
var (
	NukiStateSuccess           = NukiState(0)
	NukiStateMotorBlocked      = NukiState(1)
	NukiStateCanceled          = NukiState(2)
	NukiStateTooRecent         = NukiState(3)
	NukiStateBusy              = NukiState(4)
	NukiStateLowMotorVoltage   = NukiState(5)
	NukiStateClutchFailure     = NukiState(6)
	NukiStateMotorPowerFailure = NukiState(7)
	NukiStateIncomplete        = NukiState(8)
	NukiStateRejected          = NukiState(9)
	NukiStateRejectedNightMode = NukiState(10)
	NukiStateWrongKeypadCode   = NukiState(224)
	NukiStateOtherError        = NukiState(254)
	NukiStateUnknownError      = NukiState(255)
	NukiStates                 = map[NukiState]string{
		NukiStateSuccess:           "Success",
		NukiStateMotorBlocked:      "Motor blocked",
		NukiStateCanceled:          "Canceled",
		NukiStateTooRecent:         "Too recent",
		NukiStateBusy:              "Busy",
		NukiStateLowMotorVoltage:   "Low motor voltage",
		NukiStateClutchFailure:     "Clutch failure",
		NukiStateMotorPowerFailure: "Motor power failure",
		NukiStateIncomplete:        "Incomplete",
		NukiStateRejected:          "Rejected",
		NukiStateRejectedNightMode: "Rejected night mode",
		NukiStateWrongKeypadCode:   "Wrong keypad code",
		NukiStateOtherError:        "Other error",
		NukiStateUnknownError:      "Unknown error",
	}
)
View Source
var (
	NukiTriggerSystem    = NukiTrigger(0)
	NukiTriggerManual    = NukiTrigger(1)
	NukiTriggerButton    = NukiTrigger(2)
	NukiTriggerAutomatic = NukiTrigger(3)
	NukiTriggerWeb       = NukiTrigger(4)
	NukiTriggerApp       = NukiTrigger(5)
	NukiTriggerAutoLock  = NukiTrigger(6)
	NukiTriggerAccessory = NukiTrigger(7)
	NukiTriggerKeypad    = NukiTrigger(255)
	NukiTriggers         = map[NukiTrigger]string{
		NukiTriggerSystem:    "system",
		NukiTriggerManual:    "manual",
		NukiTriggerButton:    "button",
		NukiTriggerAutomatic: "automatic",
		NukiTriggerWeb:       "web",
		NukiTriggerApp:       "app",
		NukiTriggerAutoLock:  "auto lock",
		NukiTriggerAccessory: "accessory",
		NukiTriggerKeypad:    "keypad",
	}
)

Functions

func MinutesFromMidnight added in v0.0.7

func MinutesFromMidnight(t time.Time) int32

Types

type NukiAction

type NukiAction int32

func (NukiAction) String

func (n NukiAction) String() string

type NukiDeviceType

type NukiDeviceType int32

func (NukiDeviceType) String

func (n NukiDeviceType) String() string

type NukiReservationResponse added in v0.0.2

type NukiReservationResponse struct {
	ID                      string    `json:"id"`
	AddressID               int       `json:"addressId"`
	AccountID               int       `json:"accountId"`
	Email                   string    `json:"email"`
	Name                    string    `json:"name"`
	Guests                  int       `json:"guests"`
	GuestsIssued            int       `json:"guestsIssued"`
	KeypadIssued            bool      `json:"keypadIssued"`
	State                   string    `json:"state"`
	ServiceId               string    `json:"serviceId"`
	Reference               string    `json:"reference"`
	Automation              int       `json:"automation"`
	CheckedIn               bool      `json:"checkedIn"`
	StartDate               time.Time `json:"startDate"`
	EndDate                 time.Time `json:"endDate"`
	UpdateDate              time.Time `json:"updateDate"`
	IsCurrentlyIssuingAuth  bool      `json:"isCurrentlyIssuingAuth"`
	IsCurrentlyRevokingAuth bool      `json:"isCurrentlyRevokingAuth"`
	HasCustomAccessTimes    bool      `json:"hasCustomAccessTimes"`
	CurrentlyIssuingAuth    bool      `json:"currentlyIssuingAuth"`
	CurrentlyRevokingAuth   bool      `json:"currentlyRevokingAuth"`
}

type NukiSmartlockLogResponse

type NukiSmartlockLogResponse struct {
	ID            string         `json:"id"`
	SmartLockID   int64          `json:"smartlockId"`
	DeviceType    NukiDeviceType `json:"deviceType"`
	AccountUserID int32          `json:"accountUserId"`
	AuthID        string         `json:"authId"`
	Name          string         `json:"name"`
	Action        NukiAction     `json:"action"`
	Trigger       NukiTrigger    `json:"trigger"`
	State         NukiState      `json:"state"`
	AutoUnlock    bool           `json:"autoUnlock"`
	Date          time.Time      `json:"date"`
	Source        NukiSource     `source:"source"`
}

func Diff

Diff returns new NukiSmartlockLogResponse from new not present in old

func (NukiSmartlockLogResponse) Equals

type NukiSource

type NukiSource int32

func (NukiSource) String

func (n NukiSource) String() string

type NukiState

type NukiState int32

func (NukiState) GetEmoji

func (n NukiState) GetEmoji() string

func (NukiState) String

func (n NukiState) String() string

type NukiTrigger

type NukiTrigger int32

func (NukiTrigger) GetEmoji

func (n NukiTrigger) GetEmoji() string

func (NukiTrigger) String

func (n NukiTrigger) String() string

type ReservationPendingModification added in v0.0.7

type ReservationPendingModification struct {
	ReservationRef    string                   `json:"reservation_ref"`
	CheckInTime       time.Time                `json:"check_in_time"`
	CheckOutTime      time.Time                `json:"check_out_time"`
	ModificationDone  bool                     `json:"modification_done"`
	LinkedReservation *NukiReservationResponse `json:"linked_reservation"`
	FromChatID        int64                    `json:"from_chat_id"`
	LastUpdateTime    time.Time                `json:"last_update_time"`
}

reservationPendingModification registers a pending modification. This will be applied when the reservation appears on Nuki side Check in/out time is an int32 representing the number of minutes from midnight stored as a go time

func (ReservationPendingModification) FormatCheckIn added in v0.0.7

func (r ReservationPendingModification) FormatCheckIn() string

func (ReservationPendingModification) FormatCheckOut added in v0.0.7

func (r ReservationPendingModification) FormatCheckOut() string

func (ReservationPendingModification) MarshalZerologObject added in v0.0.7

func (r ReservationPendingModification) MarshalZerologObject(e *zerolog.Event)

type SmartLockState added in v0.0.2

type SmartLockState struct {
	Name                      string `json:"name"`
	BatteryCritical           bool   `json:"battery_critical"`
	BatteryCharge             int32  `json:"battery_remaining_percent"`
	KeypadBatteryCritical     bool   `json:"keypad_battery_critical"`
	DoorsensorBatteryCritical bool   `json:"doorsensor_battery_critical"`
}

type SmartlockAuthResponse added in v0.0.3

type SmartlockAuthResponse struct {
	Id            string `json:"id"`
	SmartlockId   int    `json:"smartlockId"`
	AccountUserId int    `json:"accountUserId"`
	AuthId        int    `json:"authId"`
	Code          int    `json:"code"`
	Fingerprints  struct {
		AdditionalProp1 string `json:"additionalProp1"`
		AdditionalProp2 string `json:"additionalProp2"`
		AdditionalProp3 string `json:"additionalProp3"`
	} `json:"fingerprints"`
	Type             int       `json:"type"`
	Name             string    `json:"name"`
	Enabled          bool      `json:"enabled"`
	RemoteAllowed    bool      `json:"remoteAllowed"`
	LockCount        int       `json:"lockCount"`
	AllowedFromDate  time.Time `json:"allowedFromDate"`
	AllowedUntilDate time.Time `json:"allowedUntilDate"`
	AllowedWeekDays  int       `json:"allowedWeekDays"`
	AllowedFromTime  int       `json:"allowedFromTime"`
	AllowedUntilTime int       `json:"allowedUntilTime"`
	LastActiveDate   time.Time `json:"lastActiveDate"`
	CreationDate     time.Time `json:"creationDate"`
	UpdateDate       time.Time `json:"updateDate"`
	OperationId      struct {
		Timestamp         int       `json:"timestamp"`
		Counter           int       `json:"counter"`
		Time              int       `json:"time"`
		Date              time.Time `json:"date"`
		MachineIdentifier int       `json:"machineIdentifier"`
		ProcessIdentifier int       `json:"processIdentifier"`
		TimeSecond        int       `json:"timeSecond"`
	} `json:"operationId"`
	Error            string `json:"error"`
	AuthTypeAsString string `json:"authTypeAsString"`
}

type SmartlockResponse added in v0.0.2

type SmartlockResponse struct {
	SmartlockId int64  `json:"smartlockId"`
	AccountId   int    `json:"accountId"`
	Type        int    `json:"type"`
	LmType      int    `json:"lmType"`
	AuthId      int    `json:"authId"`
	Name        string `json:"name"`
	Favorite    bool   `json:"favorite"`
	Config      struct {
		Name               string  `json:"name"`
		Latitude           float64 `json:"latitude"`
		Longitude          float64 `json:"longitude"`
		AutoUnlatch        bool    `json:"autoUnlatch"`
		LiftUpHandle       bool    `json:"liftUpHandle"`
		PairingEnabled     bool    `json:"pairingEnabled"`
		ButtonEnabled      bool    `json:"buttonEnabled"`
		LedEnabled         bool    `json:"ledEnabled"`
		LedBrightness      int     `json:"ledBrightness"`
		TimezoneOffset     int     `json:"timezoneOffset"`
		DaylightSavingMode int     `json:"daylightSavingMode"`
		FobPaired          bool    `json:"fobPaired"`
		FobAction1         int     `json:"fobAction1"`
		FobAction2         int     `json:"fobAction2"`
		FobAction3         int     `json:"fobAction3"`
		SingleLock         bool    `json:"singleLock"`
		AdvertisingMode    int     `json:"advertisingMode"`
		KeypadPaired       bool    `json:"keypadPaired"`
		Keypad2Paired      bool    `json:"keypad2Paired"`
		HomekitState       int     `json:"homekitState"`
		MatterState        int     `json:"matterState"`
		TimezoneId         int     `json:"timezoneId"`
		DeviceType         int     `json:"deviceType"`
		WifiEnabled        bool    `json:"wifiEnabled"`
	} `json:"config"`
	AdvancedConfig struct {
		TotalDegrees                            int  `json:"totalDegrees"`
		SingleLockedPositionOffsetDegrees       int  `json:"singleLockedPositionOffsetDegrees"`
		UnlockedToLockedTransitionOffsetDegrees int  `json:"unlockedToLockedTransitionOffsetDegrees"`
		UnlockedPositionOffsetDegrees           int  `json:"unlockedPositionOffsetDegrees"`
		LockedPositionOffsetDegrees             int  `json:"lockedPositionOffsetDegrees"`
		DetachedCylinder                        bool `json:"detachedCylinder"`
		BatteryType                             int  `json:"batteryType"`
		AutoLock                                bool `json:"autoLock"`
		AutoLockTimeout                         int  `json:"autoLockTimeout"`
		AutoUpdateEnabled                       bool `json:"autoUpdateEnabled"`
		LngTimeout                              int  `json:"lngTimeout"`
		SingleButtonPressAction                 int  `json:"singleButtonPressAction"`
		DoubleButtonPressAction                 int  `json:"doubleButtonPressAction"`
		AutomaticBatteryTypeDetection           bool `json:"automaticBatteryTypeDetection"`
		UnlatchDuration                         int  `json:"unlatchDuration"`
	} `json:"advancedConfig"`
	WebConfig struct {
		BatteryWarningPerMailEnabled bool `json:"batteryWarningPerMailEnabled"`
	} `json:"webConfig"`
	State struct {
		Mode                      int   `json:"mode"`
		State                     int   `json:"state"`
		Trigger                   int   `json:"trigger"`
		LastAction                int   `json:"lastAction"`
		BatteryCritical           bool  `json:"batteryCritical"`
		BatteryCharging           bool  `json:"batteryCharging"`
		BatteryCharge             int32 `json:"batteryCharge"`
		KeypadBatteryCritical     bool  `json:"keypadBatteryCritical"`
		DoorsensorBatteryCritical bool  `json:"doorsensorBatteryCritical"`
		DoorState                 int   `json:"doorState"`
		RingToOpenTimer           int   `json:"ringToOpenTimer"`
		NightMode                 bool  `json:"nightMode"`
	} `json:"state"`
	FirmwareVersion     int       `json:"firmwareVersion"`
	HardwareVersion     int       `json:"hardwareVersion"`
	ServerState         int       `json:"serverState"`
	AdminPinState       int       `json:"adminPinState"`
	VirtualDevice       bool      `json:"virtualDevice"`
	CreationDate        time.Time `json:"creationDate"`
	UpdateDate          time.Time `json:"updateDate"`
	CurrentSubscription struct {
		Type         string    `json:"type"`
		State        string    `json:"state"`
		CreationDate time.Time `json:"creationDate"`
	} `json:"currentSubscription"`
}

func (SmartlockResponse) PrettyFormat added in v0.0.3

func (s SmartlockResponse) PrettyFormat() string

func (SmartlockResponse) ToSmartlockState added in v0.0.2

func (s SmartlockResponse) ToSmartlockState() SmartLockState

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL