Messages
- class nat20.messages.BatteryLevel(level: int, state: BatteryState)[source]
Current state of the battery.
Broadcast on changes (see
Pixel.handler()
) and reply toRequestBatteryLevel
.- state: BatteryState
The current charge state
- class nat20.messages.BatteryState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
- BadCharging = 4
Attempted to charge, but something went wrong (eg, coil voltage is wrong from sitting crooked)
- Charging = 2
Battery is charging
- Done = 3
Battery is full and on craddle
- Error = 5
WEIRDNESS (eg charging but no coil voltage)
- Low = 1
Battery level is low, user should recharge
- Ok = 0
Discharging
- class nat20.messages.Blink(count: int, duration: int, color: int, face_mask: int, fade: int, loop: int)[source]
Do a custom blink.
Replied with
BlinkAck
- class nat20.messages.DesignAndColor(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
- AuroraSky = 12
- Generic = 1
- HematiteGrey = 10
- MidnightGalaxy = 11
- OnyxBlack = 9
- Unknown = 0
- V3Orange = 2
- V4BlackClear = 3
- V4WhiteClear = 4
- V5Black = 7
- V5Gold = 8
- V5Grey = 5
- V5White = 6
- class nat20.messages.DieFlavor(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
- D10 = 6
- D12 = 7
- D20 = 8
- D4 = 1
- D6 = 2
- D6Fudge = 4
- D6Pipped = 3
- D8 = 5
- class nat20.messages.IAmADie(led_count: int, design_and_color: DesignAndColor, data_set_hash: int, pixel_id: int, available_flash: int, build_timestamp: datetime, roll_state: RollState_State, roll_face: int, batt_level: int, batt_state: BatteryState)[source]
A bunch of general info.
Reply to
WhoAreYou
- batt_state: BatteryState
Current battery percent
- design_and_color: DesignAndColor
The aesthetic design of the die
- roll_face: int
Current face that’s up, starting at 0. Validity depends on
roll_state
.
- roll_state: RollState_State
Current roll state
- to_batterylevel() BatteryLevel [source]
Repackages the battery information.
- class nat20.messages.NotifyUser(timeout: int, ok: bool, cancel: bool, text: str)[source]
Die asking the user a question
- class nat20.messages.NotifyUserAck(ok_cancel: OkCancel)[source]
Response to
NotifyUser
- class nat20.messages.OkCancel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Button enum for
NotifyUserAck
- Cancel = 0
- Ok = 1
- class nat20.messages.RequestBatteryLevel[source]
Request the current battery.
Replies with
BatteryLevel
.
- class nat20.messages.RequestMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
How much should a thing be reported.
(Called TelemetryRequestMode in other places.)
- Off = 0
Turn repeating off
- Once = 1
Do a one-shot request
- Repeat = 2
Repeatedly send the data until turned off.
- class nat20.messages.RequestRollState[source]
Request the current roll state.
Replied with
RollState
.
- class nat20.messages.RequestRssi(request_mode: RequestMode, min_interval: int)[source]
Request RSSI.
Replied with
Rssi
.- request_mode: RequestMode
Set the reporting mode
- class nat20.messages.RequestTemperature[source]
Get the current temperature
Die replies with
Temperature
.
- class nat20.messages.RollState(state: RollState_State, face: int)[source]
The current motion.
Broadcast on changes (see
Pixel.handler()
) and is a reply toRequestRollState
.- state: RollState_State
The current motion
- class nat20.messages.RollState_State(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
The current motion of the die.
- Crooked = 4
The die is still but not flat and level
- Handling = 2
I’m not sure how reliable the detection of this state is.)
- Type:
The die is in hand (Note
- OnFace = 1
The die is sitting flat and is not moving
- Rolling = 3
The die is actively rolling
- Unknown = 0
- class nat20.messages.Rssi(rssi: int)[source]
Report the current RSSI as seen by the die.
See
RequestRssi
.
- class nat20.messages.Telemetry(battery_percent: int, battery_state: nat20.messages.BatteryState, voltage: int, v_coil: int, rssi: int, bt_channel: int, mcu_temp: int, battery_temp: int, internal_charge_state: int, force_disable_charging_state: int)[source]
-
- battery_state: BatteryState