/// <summary>
        /// Creates a Host Device.
        /// </summary>
        public static HostDevice CreateHostDevice(string deviceId, string friendlyName)
        {
            if (ValidateTopicLevel(deviceId, out var validationMessage) == false)
            {
                throw new ArgumentException(validationMessage, nameof(deviceId));
            }

            var returnDevice = new HostDevice(BaseTopic, deviceId, friendlyName);

            return(returnDevice);
        }
        internal void Initialize(HostDevice parentDevice)
        {
            _parentDevice = parentDevice;

            _parentDevice.InternalPropertyPublish($"{_propertyId}/$name", _nameAttribute);
            _parentDevice.InternalPropertyPublish($"{_propertyId}/$datatype", _dataTypeAttribute.ToHomiePayload());
            _parentDevice.InternalPropertyPublish($"{_propertyId}/$format", _formatAttribute);
            _parentDevice.InternalPropertyPublish($"{_propertyId}/$settable", _isSettableAttribute.ToString().ToLower());
            _parentDevice.InternalPropertyPublish($"{_propertyId}/$retained", _isRetainedAttribute.ToString().ToLower());
            _parentDevice.InternalPropertyPublish($"{_propertyId}/$unit", _unitAttribute);

            if (Type != PropertyType.Command)
            {
                _parentDevice.InternalPropertyPublish($"{_propertyId}", _rawValue);
            }


            if (Type == PropertyType.Parameter)
            {
                _parentDevice.InternalPropertySubscribe($"{_propertyId}/set", (payload) => {
                    if (ValidatePayload(payload) == true)
                    {
                        _rawValue = payload;

                        RaisePropertyChanged(this, new PropertyChangedEventArgs("Value"));

                        _parentDevice.InternalPropertyPublish($"{_propertyId}", _rawValue);
                    }
                });
            }

            if (Type == PropertyType.Command)
            {
                // Before subsribing to SET events, need to clear the topic. It may be present on the broker from previous runs,
                // resulting in command activation when this devices boots up. Although there is *no* actual message sent.
                _parentDevice.InternalPropertyPublish($"{_propertyId}/set", "");

                // Now subsribing to a clean topic.
                _parentDevice.InternalPropertySubscribe($"{_propertyId}/set", (payload) => {
                    if (ValidatePayload(payload) == true)
                    {
                        _rawValue = payload;

                        RaisePropertyChanged(this, new PropertyChangedEventArgs("Value"));
                    }
                });
            }
        }