Skip to content

Request: Access to Alterative Attributes within a Sensor Field #9

Description

@Dukat-Gul

I am curious to understand how to access some of the alternative Attributes

For example;

Attributes:

UpperQuantity
TotalPercentageUsed
TotalCharge
TotalAdditionalCharge
TotalDataUsed
TotalDataRemaining
UnitType
IsFinal
IsRechargeRequired
UpperQuantityDisplay
TotalDataUsedDisplay
TotalDataRemainingDisplay
IsThrottled
DataUsedThisDevice
DataUsedThisDeviceDisplay
PercentageUsedThisDevice
DataUsedOthers
DataUsedOthersDisplay
PercentageUsedOthers
Trusted
SingleService

I attempted to adjust myself by editing the /config/custom_components/optus/sensor.py file
specifically I adjusted optus_sharedtierdatausage section where it was listed as ;

    def get_value(self, ftype):
        if ftype == "state":
            if self.sensor == "daysRemaining":
                return self.coordinator.data[self.sensor]
            elif self.sensor == "smsUsage":
                return self.coordinator.data[self.sensor]["amount"]
            elif self.sensor == "mmsUsage":
                return self.coordinator.data[self.sensor]["amount"]
            elif self.sensor == "tierVoiceUsage":
                return self.coordinator.data[self.sensor]["totalCharge"]
            elif self.sensor == "tierDataUsage":
                return self.coordinator.data[self.sensor]["totalDataUsed"]
           elif self.sensor == "sharedTierDataUsage":
                return self.coordinator.data[self.sensor]["totalDataUsed"]
                #return self.coordinator.data[self.sensor]["DataUsedThisDeviceDisplay"]

The last line is commented out now, but its what I tried and it didnt work, and the entry just showed up with Unknown for its values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions