mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Add sensors for inventory items to Habitica (#135331)
Add sensors for inventory items
This commit is contained in:
parent
b3af12c9b1
commit
0d85f54e76
@ -138,6 +138,27 @@
|
||||
},
|
||||
"constitution": {
|
||||
"default": "mdi:run-fast"
|
||||
},
|
||||
"food_total": {
|
||||
"default": "mdi:candy",
|
||||
"state": {
|
||||
"0": "mdi:candy-off"
|
||||
}
|
||||
},
|
||||
"eggs_total": {
|
||||
"default": "mdi:egg",
|
||||
"state": {
|
||||
"0": "mdi:egg-off"
|
||||
}
|
||||
},
|
||||
"hatching_potions_total": {
|
||||
"default": "mdi:flask-round-bottom"
|
||||
},
|
||||
"saddle": {
|
||||
"default": "mdi:horse"
|
||||
},
|
||||
"quest_scrolls": {
|
||||
"default": "mdi:script-text-outline"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
|
@ -29,7 +29,7 @@ from homeassistant.helpers.typing import StateType
|
||||
from .const import ASSETS_URL
|
||||
from .entity import HabiticaBase
|
||||
from .types import HabiticaConfigEntry
|
||||
from .util import get_attribute_points, get_attributes_total
|
||||
from .util import get_attribute_points, get_attributes_total, inventory_list
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -73,6 +73,11 @@ class HabiticaSensorEntity(StrEnum):
|
||||
INTELLIGENCE = "intelligence"
|
||||
CONSTITUTION = "constitution"
|
||||
PERCEPTION = "perception"
|
||||
EGGS_TOTAL = "eggs_total"
|
||||
HATCHING_POTIONS_TOTAL = "hatching_potions_total"
|
||||
FOOD_TOTAL = "food_total"
|
||||
SADDLE = "saddle"
|
||||
QUEST_SCROLLS = "quest_scrolls"
|
||||
|
||||
|
||||
SENSOR_DESCRIPTIONS: tuple[HabiticaSensorEntityDescription, ...] = (
|
||||
@ -179,6 +184,44 @@ SENSOR_DESCRIPTIONS: tuple[HabiticaSensorEntityDescription, ...] = (
|
||||
suggested_display_precision=0,
|
||||
native_unit_of_measurement="CON",
|
||||
),
|
||||
HabiticaSensorEntityDescription(
|
||||
key=HabiticaSensorEntity.EGGS_TOTAL,
|
||||
translation_key=HabiticaSensorEntity.EGGS_TOTAL,
|
||||
value_fn=lambda user, _: sum(n for n in user.items.eggs.values()),
|
||||
entity_picture="Pet_Egg_Egg.png",
|
||||
attributes_fn=lambda user, content: inventory_list(user, content, "eggs"),
|
||||
),
|
||||
HabiticaSensorEntityDescription(
|
||||
key=HabiticaSensorEntity.HATCHING_POTIONS_TOTAL,
|
||||
translation_key=HabiticaSensorEntity.HATCHING_POTIONS_TOTAL,
|
||||
value_fn=lambda user, _: sum(n for n in user.items.hatchingPotions.values()),
|
||||
entity_picture="Pet_HatchingPotion_RoyalPurple.png",
|
||||
attributes_fn=(
|
||||
lambda user, content: inventory_list(user, content, "hatchingPotions")
|
||||
),
|
||||
),
|
||||
HabiticaSensorEntityDescription(
|
||||
key=HabiticaSensorEntity.FOOD_TOTAL,
|
||||
translation_key=HabiticaSensorEntity.FOOD_TOTAL,
|
||||
value_fn=(
|
||||
lambda user, _: sum(n for k, n in user.items.food.items() if k != "Saddle")
|
||||
),
|
||||
entity_picture="Pet_Food_Strawberry.png",
|
||||
attributes_fn=lambda user, content: inventory_list(user, content, "food"),
|
||||
),
|
||||
HabiticaSensorEntityDescription(
|
||||
key=HabiticaSensorEntity.SADDLE,
|
||||
translation_key=HabiticaSensorEntity.SADDLE,
|
||||
value_fn=lambda user, _: user.items.food.get("Saddle", 0),
|
||||
entity_picture="Pet_Food_Saddle.png",
|
||||
),
|
||||
HabiticaSensorEntityDescription(
|
||||
key=HabiticaSensorEntity.QUEST_SCROLLS,
|
||||
translation_key=HabiticaSensorEntity.QUEST_SCROLLS,
|
||||
value_fn=(lambda user, _: sum(n for n in user.items.quests.values())),
|
||||
entity_picture="inventory_quest_scroll_dustbunnies.png",
|
||||
attributes_fn=lambda user, content: inventory_list(user, content, "quests"),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
@ -310,6 +310,26 @@
|
||||
"name": "[%key:component::habitica::entity::sensor::strength::state_attributes::buffs::name%]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"eggs_total": {
|
||||
"name": "Eggs",
|
||||
"unit_of_measurement": "eggs"
|
||||
},
|
||||
"hatching_potions_total": {
|
||||
"name": "Hatching potions",
|
||||
"unit_of_measurement": "potions"
|
||||
},
|
||||
"food_total": {
|
||||
"name": "Pet food",
|
||||
"unit_of_measurement": "foods"
|
||||
},
|
||||
"saddle": {
|
||||
"name": "Saddles",
|
||||
"unit_of_measurement": "saddles"
|
||||
},
|
||||
"quest_scrolls": {
|
||||
"name": "Quest scrolls",
|
||||
"unit_of_measurement": "scrolls"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
|
@ -159,3 +159,14 @@ def get_attributes_total(user: UserData, content: ContentData, attribute: str) -
|
||||
return floor(
|
||||
sum(value for value in get_attribute_points(user, content, attribute).values())
|
||||
)
|
||||
|
||||
|
||||
def inventory_list(
|
||||
user: UserData, content: ContentData, item_type: str
|
||||
) -> dict[str, int]:
|
||||
"""List inventory items of given type."""
|
||||
return {
|
||||
getattr(content, item_type)[k].text: v
|
||||
for k, v in getattr(user.items, item_type, {}).items()
|
||||
if k != "Saddle"
|
||||
}
|
||||
|
@ -370,7 +370,109 @@
|
||||
"animalSetAchievements": {},
|
||||
"stableAchievements": {},
|
||||
"petSetCompleteAchievs": [],
|
||||
"quests": {},
|
||||
"quests": {
|
||||
"atom1": {
|
||||
"text": "Angriff des Banalen, Teil 1: Abwasch-Katastrophe!",
|
||||
"notes": "Du erreichst die Ufer des Waschbeckensees für eine wohlverdiente Auszeit ... Aber der See ist verschmutzt mit nicht abgespültem Geschirr! Wie ist das passiert? Wie auch immer, Du kannst den See jedenfalls nicht in diesem Zustand lassen. Es gibt nur eine Sache die Du tun kannst: Abspülen und den Ferienort retten! Dazu musst Du aber Seife für den Abwasch finden. Viel Seife ...",
|
||||
"completion": "Nach gründlichem Schrubben ist das Geschirr sicher am Ufer gestapelt! Du trittst zurück und begutachtest stolz Deiner Hände Arbeit.",
|
||||
"group": "questGroupAtom",
|
||||
"prerequisite": {
|
||||
"lvl": 15
|
||||
},
|
||||
"value": 4,
|
||||
"lvl": 15,
|
||||
"category": "unlockable",
|
||||
"collect": {
|
||||
"soapBars": {
|
||||
"text": "Seifenstücke",
|
||||
"count": 20
|
||||
}
|
||||
},
|
||||
"drop": {
|
||||
"items": [
|
||||
{
|
||||
"type": "quests",
|
||||
"key": "atom2",
|
||||
"text": "Das Monster vom KochLess (Schriftrolle)",
|
||||
"onlyOwner": true
|
||||
}
|
||||
],
|
||||
"gp": 7,
|
||||
"exp": 50
|
||||
},
|
||||
"key": "atom1"
|
||||
},
|
||||
"goldenknight1": {
|
||||
"text": "Die goldene Ritterin, Teil 1: Ein ernstes Gespräch",
|
||||
"notes": "Die goldene Ritterin ist Habiticanern mit ihrer Kritik ganz schön auf die Nerven gegangen. Nicht alle Tagesaufgaben erledigt? Eine negative Gewohnheit angeklickt? Sie nimmt dies zum Anlass Dich zu bedrängen, dass Du doch ihrem Beispiel folgen sollst. Sie ist das leuchtende Beispiel eines perfekten Habiticaners und Du bist nichts als ein Versager. Das ist ja mal gar nicht nett! Jeder macht Fehler. Man sollte deshalb nicht mit solcher Kritik drangsaliert werden. Vielleicht solltest Du einige Zeugenaussagen von verletzten Habiticanern zusammentragen und die Goldene Ritterin mal ordentlich zurechtweisen!",
|
||||
"completion": "Schau Dir nur all diese Zeugenaussagen an! Bestimmt wird das reichen, um die Goldene Ritterin zu überzeugen. Nun musst Du sie nur noch finden.",
|
||||
"group": "questGroupGoldenknight",
|
||||
"value": 4,
|
||||
"lvl": 40,
|
||||
"category": "unlockable",
|
||||
"collect": {
|
||||
"testimony": {
|
||||
"text": "Zeugenaussagen",
|
||||
"count": 60
|
||||
}
|
||||
},
|
||||
"drop": {
|
||||
"items": [
|
||||
{
|
||||
"type": "quests",
|
||||
"key": "goldenknight2",
|
||||
"text": "Die goldene Ritterin Teil 2: Die goldene Ritterin (Schriftrolle)",
|
||||
"onlyOwner": true
|
||||
}
|
||||
],
|
||||
"gp": 15,
|
||||
"exp": 120
|
||||
},
|
||||
"key": "goldenknight1"
|
||||
},
|
||||
"dustbunnies": {
|
||||
"text": "Die ungezähmten Staubmäuse",
|
||||
"notes": "Es ist schon etwas her, seit Du hier drinnen das letzte Mal Staub gewischt hast, aber Du sorgst dich nicht allzusehr - ein Wenig Staub hat noch nie jemandem geschadet, oder? Erst, als Du Deine Hand in eine der staubigsten Ecken steckst und einen Biss spürst, erinnerst du dich an @InspectorCaracals Warnung: Harmlosen Staub zu lange in Ruhe zu lassen, verwandelt ihn in boshafte Staubmäuse! Du solltest sie besser besiegen, bevor sie ganz Habitica mit feinen Schmutzpartikeln bedecken!",
|
||||
"group": "questGroupEarnable",
|
||||
"completion": "Die Staubmäuse verschwinden in einer Rauch-, äh… Staubwolke. Als sich der Staub legt, siehst du dich um. Du hast vergessen, wie hübsch es hier doch aussieht, wenn es sauber ist. Du erkennst einen kleinen Haufen Gold, wo der Staub vorher war. Huch, du hattest dich schon gefragt, wo er abgeblieben war!",
|
||||
"value": 1,
|
||||
"category": "unlockable",
|
||||
"boss": {
|
||||
"name": "Ungezähmte Staubmäuse",
|
||||
"hp": 100,
|
||||
"str": 0.5,
|
||||
"def": 1
|
||||
},
|
||||
"drop": {
|
||||
"gp": 8,
|
||||
"exp": 42
|
||||
},
|
||||
"key": "dustbunnies"
|
||||
},
|
||||
"basilist": {
|
||||
"text": "Der Basi-List",
|
||||
"notes": "Da ist ein Aufruhr auf dem Marktplatz – es sieht ganz so aus, als ob man lieber in die andere Richtung rennen sollte. Da Du aber ein mutiger Abenteurer bist, rennst Du stattdessen darauf zu und entdeckst einen Basi-List, der sich aus einem Haufen unerledigter Aufgaben geformt hat! Alle umstehenden Habiticaner sind aus Angst vor der Länge des Basi-Lists gelähmt und können nicht anfangen zu arbeiten. Von irgendwo in der Nähe hörst Du @Arcosine schreien: \"Schnell! Erledige Deine To-Dos und Tagesaufgaben, um dem Monster die Zähne zu entfernen, bevor sich jemand am Papier schneidet!\" Greife schnell an, Abenteurer, und hake etwas ab - aber Vorsicht! Wenn Du irgendwelche Tagesaufgaben nicht erledigst, wird der Basi-List Dich und Deine Party angreifen!",
|
||||
"group": "questGroupEarnable",
|
||||
"completion": "Der Basi-List ist in Papierschnitzel zerfallen, die sanft in Regenbogenfarben schimmern. \"Puh!\" sagt @Arcosine. \"Gut, dass ihr gerade hier wart!\" Du fühlst Dich erfahrener als vorher und sammelst ein paar verstreute Goldstücke zwischen den Papierstücken auf.",
|
||||
"goldValue": 100,
|
||||
"category": "unlockable",
|
||||
"unlockCondition": {
|
||||
"condition": "party invite",
|
||||
"text": "Lade Freunde ein"
|
||||
},
|
||||
"boss": {
|
||||
"name": "Der Basi-List",
|
||||
"hp": 100,
|
||||
"str": 0.5,
|
||||
"def": 1
|
||||
},
|
||||
"drop": {
|
||||
"gp": 8,
|
||||
"exp": 42
|
||||
},
|
||||
"key": "basilist"
|
||||
}
|
||||
},
|
||||
"questsByLevel": {},
|
||||
"userCanOwnQuestCategories": [],
|
||||
"itemList": {
|
||||
@ -450,11 +552,61 @@
|
||||
"special": {},
|
||||
"dropEggs": {},
|
||||
"questEggs": {},
|
||||
"eggs": {},
|
||||
"eggs": {
|
||||
"Wolf": {
|
||||
"text": "Wolfsjunges",
|
||||
"mountText": "Wolfs-Reittier",
|
||||
"adjective": "ein treues",
|
||||
"value": 3,
|
||||
"key": "Wolf",
|
||||
"notes": "Finde ein Schlüpfelixier, das Du über dieses Ei gießen kannst, damit ein ein treues Wolfsjunges schlüpfen kann."
|
||||
},
|
||||
"TigerCub": {
|
||||
"text": "Tigerjunges",
|
||||
"mountText": "Tiger-Reittier",
|
||||
"adjective": "ein wildes",
|
||||
"value": 3,
|
||||
"key": "TigerCub",
|
||||
"notes": "Finde ein Schlüpfelixier, das Du über dieses Ei gießen kannst, damit ein ein wildes Tigerjunges schlüpfen kann."
|
||||
},
|
||||
"PandaCub": {
|
||||
"text": "Pandajunges",
|
||||
"mountText": "Panda-Reittier",
|
||||
"adjective": "ein sanftes",
|
||||
"value": 3,
|
||||
"key": "PandaCub",
|
||||
"notes": "Finde ein Schlüpfelixier, das Du über dieses Ei gießen kannst, damit ein ein sanftes Pandajunges schlüpfen kann."
|
||||
}
|
||||
},
|
||||
"dropHatchingPotions": {},
|
||||
"premiumHatchingPotions": {},
|
||||
"wackyHatchingPotions": {},
|
||||
"hatchingPotions": {},
|
||||
"hatchingPotions": {
|
||||
"Base": {
|
||||
"value": 2,
|
||||
"key": "Base",
|
||||
"text": "Normales",
|
||||
"notes": "Gieße dies über ein Ei und es wird ein Normales Haustier daraus schlüpfen.",
|
||||
"premium": false,
|
||||
"limited": false
|
||||
},
|
||||
"White": {
|
||||
"value": 2,
|
||||
"key": "White",
|
||||
"text": "Weißes",
|
||||
"notes": "Gieße dies über ein Ei und es wird ein Weißes Haustier daraus schlüpfen.",
|
||||
"premium": false,
|
||||
"limited": false
|
||||
},
|
||||
"Desert": {
|
||||
"value": 2,
|
||||
"key": "Desert",
|
||||
"text": "Wüstenfarbenes",
|
||||
"notes": "Gieße dies über ein Ei und es wird ein Wüstenfarbenes Haustier daraus schlüpfen.",
|
||||
"premium": false,
|
||||
"limited": false
|
||||
}
|
||||
},
|
||||
"pets": {},
|
||||
"premiumPets": {},
|
||||
"questPets": {},
|
||||
@ -466,7 +618,46 @@
|
||||
"questMounts": {},
|
||||
"specialMounts": {},
|
||||
"mountInfo": {},
|
||||
"food": {}
|
||||
"food": {
|
||||
"Meat": {
|
||||
"text": "Fleisch",
|
||||
"textA": "Fleisch",
|
||||
"textThe": "das Fleisch",
|
||||
"target": "Base",
|
||||
"value": 1,
|
||||
"key": "Meat",
|
||||
"notes": "Verfüttere dies an ein Haustier und es wächst bald zu einem kräftigen Reittier heran.",
|
||||
"canDrop": true
|
||||
},
|
||||
"Milk": {
|
||||
"text": "Milch",
|
||||
"textA": "Milch",
|
||||
"textThe": "die Milch",
|
||||
"target": "White",
|
||||
"value": 1,
|
||||
"key": "Milk",
|
||||
"notes": "Verfüttere dies an ein Haustier und es wächst bald zu einem kräftigen Reittier heran.",
|
||||
"canDrop": true
|
||||
},
|
||||
"Potatoe": {
|
||||
"text": "Kartoffel",
|
||||
"textA": "eine Kartoffel",
|
||||
"textThe": "die Kartoffel",
|
||||
"target": "Desert",
|
||||
"value": 1,
|
||||
"key": "Potatoe",
|
||||
"notes": "Verfüttere dies an ein Haustier und es wächst bald zu einem kräftigen Reittier heran.",
|
||||
"canDrop": true
|
||||
},
|
||||
"Saddle": {
|
||||
"sellWarningNote": "Hey! Das ist ein sehr nützlicher Gegenstand! Weißt Du, wie Du den Sattel mit Deinen Haustieren nutzt?",
|
||||
"text": "Magischer Sattel",
|
||||
"value": 5,
|
||||
"notes": "Lässt eines Deiner Haustiere augenblicklich zum Reittier heranwachsen.",
|
||||
"canDrop": false,
|
||||
"key": "Saddle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"appVersion": "5.29.2"
|
||||
}
|
||||
|
@ -112,6 +112,28 @@
|
||||
"eyewear": "eyewear_armoire_plagueDoctorMask",
|
||||
"body": "body_special_aetherAmulet"
|
||||
}
|
||||
},
|
||||
"quests": {
|
||||
"atom1": 1,
|
||||
"goldenknight1": 0,
|
||||
"dustbunnies": 1,
|
||||
"basilist": 0
|
||||
},
|
||||
"food": {
|
||||
"Saddle": 2,
|
||||
"Meat": 0,
|
||||
"Milk": 1,
|
||||
"Potatoe": 2
|
||||
},
|
||||
"hatchingPotions": {
|
||||
"Base": 2,
|
||||
"White": 0,
|
||||
"Desert": 1
|
||||
},
|
||||
"eggs": {
|
||||
"Wolf": 1,
|
||||
"TigerCub": 0,
|
||||
"PandaCub": 2
|
||||
}
|
||||
},
|
||||
"balance": 10,
|
||||
|
@ -160,6 +160,57 @@
|
||||
'state': 'test-user',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_eggs-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.test_user_eggs',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Eggs',
|
||||
'platform': 'habitica',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': <HabiticaSensorEntity.EGGS_TOTAL: 'eggs_total'>,
|
||||
'unique_id': 'a380546a-94be-4b8e-8a0b-23e0d5c03303_eggs_total',
|
||||
'unit_of_measurement': 'eggs',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_eggs-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'Pandajunges': 2,
|
||||
'Tigerjunges': 0,
|
||||
'Wolfsjunges': 1,
|
||||
'entity_picture': 'https://habitica-assets.s3.amazonaws.com/mobileApp/images/Pet_Egg_Egg.png',
|
||||
'friendly_name': 'test-user Eggs',
|
||||
'unit_of_measurement': 'eggs',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.test_user_eggs',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '3',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_experience-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
@ -514,6 +565,57 @@
|
||||
'state': '4',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_hatching_potions-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.test_user_hatching_potions',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Hatching potions',
|
||||
'platform': 'habitica',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': <HabiticaSensorEntity.HATCHING_POTIONS_TOTAL: 'hatching_potions_total'>,
|
||||
'unique_id': 'a380546a-94be-4b8e-8a0b-23e0d5c03303_hatching_potions_total',
|
||||
'unit_of_measurement': 'potions',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_hatching_potions-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'Normales': 2,
|
||||
'Weißes': 0,
|
||||
'Wüstenfarbenes': 1,
|
||||
'entity_picture': 'https://habitica-assets.s3.amazonaws.com/mobileApp/images/Pet_HatchingPotion_RoyalPurple.png',
|
||||
'friendly_name': 'test-user Hatching potions',
|
||||
'unit_of_measurement': 'potions',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.test_user_hatching_potions',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '3',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_health-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
@ -962,6 +1064,109 @@
|
||||
'state': '75',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_pet_food-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.test_user_pet_food',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Pet food',
|
||||
'platform': 'habitica',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': <HabiticaSensorEntity.FOOD_TOTAL: 'food_total'>,
|
||||
'unique_id': 'a380546a-94be-4b8e-8a0b-23e0d5c03303_food_total',
|
||||
'unit_of_measurement': 'foods',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_pet_food-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'Fleisch': 0,
|
||||
'Kartoffel': 2,
|
||||
'Milch': 1,
|
||||
'entity_picture': 'https://habitica-assets.s3.amazonaws.com/mobileApp/images/Pet_Food_Strawberry.png',
|
||||
'friendly_name': 'test-user Pet food',
|
||||
'unit_of_measurement': 'foods',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.test_user_pet_food',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '3',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_quest_scrolls-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.test_user_quest_scrolls',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Quest scrolls',
|
||||
'platform': 'habitica',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': <HabiticaSensorEntity.QUEST_SCROLLS: 'quest_scrolls'>,
|
||||
'unique_id': 'a380546a-94be-4b8e-8a0b-23e0d5c03303_quest_scrolls',
|
||||
'unit_of_measurement': 'scrolls',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_quest_scrolls-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'Angriff des Banalen, Teil 1: Abwasch-Katastrophe!': 1,
|
||||
'Der Basi-List': 0,
|
||||
'Die goldene Ritterin, Teil 1: Ein ernstes Gespräch': 0,
|
||||
'Die ungezähmten Staubmäuse': 1,
|
||||
'entity_picture': 'https://habitica-assets.s3.amazonaws.com/mobileApp/images/inventory_quest_scroll_dustbunnies.png',
|
||||
'friendly_name': 'test-user Quest scrolls',
|
||||
'unit_of_measurement': 'scrolls',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.test_user_quest_scrolls',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '2',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_rewards-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
@ -1048,6 +1253,54 @@
|
||||
'state': '1',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_saddles-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.test_user_saddles',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Saddles',
|
||||
'platform': 'habitica',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': <HabiticaSensorEntity.SADDLE: 'saddle'>,
|
||||
'unique_id': 'a380546a-94be-4b8e-8a0b-23e0d5c03303_saddle',
|
||||
'unit_of_measurement': 'saddles',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_saddles-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'entity_picture': 'https://habitica-assets.s3.amazonaws.com/mobileApp/images/Pet_Food_Saddle.png',
|
||||
'friendly_name': 'test-user Saddles',
|
||||
'unit_of_measurement': 'saddles',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.test_user_saddles',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '2',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.test_user_strength-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
|
Loading…
x
Reference in New Issue
Block a user