powermon.configmodel.config_model module¶
pydantic definitions for the powermon config model
- classpowermon.configmodel.config_model.APIConfig(*, host:None|str=None, port:None|int=None, enabled:None|bool=False, log_level:None|str=None, announce_topic:None|str=None, adhoc_topic:None|str=None, refresh_interval:None|int=None)¶
Bases:
NoExtraBaseModel
model/allowed elements for api section of config
- model_computed_fields:ClassVar[Dict[str,ComputedFieldInfo]]={}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config:ClassVar[ConfigDict]={'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields:ClassVar[Dict[str,FieldInfo]]={'adhoc_topic': FieldInfo(annotation=Union[NoneType, str], required=False, default=None), 'announce_topic': FieldInfo(annotation=Union[NoneType, str], required=False, default=None), 'enabled': FieldInfo(annotation=Union[NoneType, bool], required=False, default=False), 'host': FieldInfo(annotation=Union[NoneType, str], required=False, default=None), 'log_level': FieldInfo(annotation=Union[NoneType, str], required=False, default=None), 'port': FieldInfo(annotation=Union[NoneType, int], required=False, default=None), 'refresh_interval': FieldInfo(annotation=Union[NoneType, int], required=False, default=None)}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- classpowermon.configmodel.config_model.BaseConfig(*, device:DeviceConfig, commands:List[CommandConfig], mqttbroker:None|MQTTConfig=None, api:None|APIConfig=None, daemon:None|DaemonConfig=None, debuglevel:None|int|str=None, loop:None|int|Literal['once']=None)¶
Bases:
NoExtraBaseModel
model/allowed elements for first level of config
- model_computed_fields:ClassVar[Dict[str,ComputedFieldInfo]]={}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config:ClassVar[ConfigDict]={'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields:ClassVar[Dict[str,FieldInfo]]={'api': FieldInfo(annotation=Union[NoneType, APIConfig], required=False, default=None), 'commands': FieldInfo(annotation=List[CommandConfig], required=True), 'daemon': FieldInfo(annotation=Union[NoneType, DaemonConfig], required=False, default=None), 'debuglevel': FieldInfo(annotation=Union[NoneType, int, str], required=False, default=None), 'device': FieldInfo(annotation=DeviceConfig, required=True), 'loop': FieldInfo(annotation=Union[NoneType, int, Literal['once']], required=False, default=None), 'mqttbroker': FieldInfo(annotation=Union[NoneType, MQTTConfig], required=False, default=None)}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- classpowermon.configmodel.config_model.CommandConfig(*, command:str, type:None|Literal['basic']|Literal['templated']|Literal['cache_query']='basic', override:None|dict=None, trigger:None|LoopsTriggerConfig|AtTriggerConfig|EveryTriggerConfig=None, outputs:None|List[OutputConfig]|str=None)¶
Bases:
NoExtraBaseModel
model/allowed elements for command section of config
- model_computed_fields:ClassVar[Dict[str,ComputedFieldInfo]]={}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config:ClassVar[ConfigDict]={'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields:ClassVar[Dict[str,FieldInfo]]={'command': FieldInfo(annotation=str, required=True), 'outputs': FieldInfo(annotation=Union[NoneType, List[OutputConfig], str], required=False, default=None), 'override': FieldInfo(annotation=Union[NoneType, dict], required=False, default=None), 'trigger': FieldInfo(annotation=Union[NoneType, LoopsTriggerConfig, AtTriggerConfig, EveryTriggerConfig], required=False, default=None), 'type': FieldInfo(annotation=Union[NoneType, Literal['basic'], Literal['templated'], Literal['cache_query']], required=False, default='basic')}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- classpowermon.configmodel.config_model.ConfigModel(*, config:BaseConfig)¶
Bases:
NoExtraBaseModel
Entry point for config model
- model_computed_fields:ClassVar[Dict[str,ComputedFieldInfo]]={}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config:ClassVar[ConfigDict]={'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields:ClassVar[Dict[str,FieldInfo]]={'config': FieldInfo(annotation=BaseConfig, required=True)}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- classpowermon.configmodel.config_model.DaemonConfig(*, type:None|Literal['systemd']|Literal['initd'], keepalive:None|int=None)¶
Bases:
NoExtraBaseModel
model/allowed elements for daemon section of config
- model_computed_fields:ClassVar[Dict[str,ComputedFieldInfo]]={}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config:ClassVar[ConfigDict]={'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields:ClassVar[Dict[str,FieldInfo]]={'keepalive': FieldInfo(annotation=Union[NoneType, int], required=False, default=None), 'type': FieldInfo(annotation=Union[NoneType, Literal['systemd'], Literal['initd']], required=True)}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- classpowermon.configmodel.config_model.DeviceConfig(*, name:None|str=None, id:None|str|int=None, serial_number:None|str|int=None, model:None|str=None, manufacturer:None|str=None, port:TestPortConfig|SerialPortConfig|UsbPortConfig|BlePortConfig)¶
Bases:
NoExtraBaseModel
model/allowed elements for device section of config
- model_computed_fields:ClassVar[Dict[str,ComputedFieldInfo]]={}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config:ClassVar[ConfigDict]={'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields:ClassVar[Dict[str,FieldInfo]]={'id': FieldInfo(annotation=Union[NoneType, str, int], required=False, default=None), 'manufacturer': FieldInfo(annotation=Union[NoneType, str], required=False, default=None), 'model': FieldInfo(annotation=Union[NoneType, str], required=False, default=None), 'name': FieldInfo(annotation=Union[NoneType, str], required=False, default=None), 'port': FieldInfo(annotation=Union[TestPortConfig, SerialPortConfig, UsbPortConfig, BlePortConfig], required=True), 'serial_number': FieldInfo(annotation=Union[NoneType, str, int], required=False, default=None)}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- classpowermon.configmodel.config_model.MQTTConfig(*, name:str, port:None|int=None, username:None|str=None, password:None|str=None, adhoc_topic:None|str=None, adhoc_result_topic:None|str=None)¶
Bases:
NoExtraBaseModel
model/allowed elements for mqtt broker section of config
- model_computed_fields:ClassVar[Dict[str,ComputedFieldInfo]]={}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config:ClassVar[ConfigDict]={'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields:ClassVar[Dict[str,FieldInfo]]={'adhoc_result_topic': FieldInfo(annotation=Union[NoneType, str], required=False, default=None), 'adhoc_topic': FieldInfo(annotation=Union[NoneType, str], required=False, default=None), 'name': FieldInfo(annotation=str, required=True), 'password': FieldInfo(annotation=Union[NoneType, str], required=False, default=None, repr=False), 'port': FieldInfo(annotation=Union[NoneType, int], required=False, default=None), 'username': FieldInfo(annotation=Union[NoneType, str], required=False, default=None)}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- classpowermon.configmodel.config_model.OutputConfig(*, type:Literal['screen','mqtt','api_mqtt'], topic:None|str=None, format:None|str|BaseFormatConfig|HassFormatConfig|MqttFormatConfig|JsonFormatConfig|BMSResponseFormatConfig=None)¶
Bases:
NoExtraBaseModel
model/allowed elements for output config
- model_computed_fields:ClassVar[Dict[str,ComputedFieldInfo]]={}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config:ClassVar[ConfigDict]={'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields:ClassVar[Dict[str,FieldInfo]]={'format': FieldInfo(annotation=Union[NoneType, str, BaseFormatConfig, HassFormatConfig, MqttFormatConfig, JsonFormatConfig, BMSResponseFormatConfig], required=False, default=None), 'topic': FieldInfo(annotation=Union[NoneType, str], required=False, default=None), 'type': FieldInfo(annotation=Union[Literal['screen'], Literal['mqtt'], Literal['api_mqtt']], required=True)}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.