twam / fritzbox2mqtt

Fritz!Box to MQTT gateway
14 stars 6 forks source link

ERROR Failure while reading configuration file 'config.yaml' #7

Open TBR-BRD opened 5 months ago

TBR-BRD commented 5 months ago

Hello i have a error message:

Python v 3.9

python3 fritzbox2mqtt.py -c config.yaml

2024-04-25 10:40:57,187 [MainThread ] ERROR Failure while reading configuration file 'config.yaml': ScannerError('while parsing a tag', <yaml.error.Mark object at 0x7fbde02e20>, "expected URI, but found '\n'", <yaml.error.Mark object at 0x7fbde02eb0>)

Please help me

twam commented 5 months ago

Can you post a copy of your config.yaml? (With removed passwords)

TBR-BRD commented 5 months ago

yes, thank you

mqtt:
  address: al.myfritz.net
  port: 2268
#  ssl: 1
  username: t
  password: !
  prefix: fritzbox/home

fritzbox:
  address: fritz.box
  defaultPeriod: 5
  port: 49000
  username: fb
  password: !

  services:
    DeviceInfo:
      prefix: deviceInfo
      actions:
        GetInfo:
          period: 3600
          values:
            NewDeviceLog:
              topic: DeviceLog
              type: str
            NewManufacturerName:
              topic: ManufacturerName
              type: str
            NewManufacturerOUI:
              topic: ManufacturerOUI
              type: str
            NewModelName:
              topic: ModelName
              type: str
            NewDescription:
              topic: Description
              type: str
            NewProductClass:
              topic: ProductClass
              type: str
            NewSerialNumber:
              topic: SerialNumber
              type: str
            NewSoftwareVersion:
              topic: SoftwareVersion
              type: str
            NewHardwareVersion:
              topic: HardwareVersion
              type: str
            NewSpecVersion:
              topic: SprecVersion
              type: str
            NewProvisioningCode:
              topic: ProvisioningCode
              type: str
            NewUpTime:
              topic: Uptime
              type: str
    WANCommonInterfaceConfig:
      prefix: wan
      period: 60
      actions:
        GetTotalBytesSent:
          values:
            NewTotalBytesSent:
              topic: totalBytesSent
              type: int
        GetTotalBytesReceived:
          values:
            NewTotalBytesReceived:
              topic: totalBytesReceived
              type: int
    WLANConfiguration:[1-2,3]:
      prefix: wifi{id}
      actions:
        GetTotalAssociations:
          period: 300
          values:
            NewTotalAssociations:
              topic: totalAssociations
              type: int
        GetSecurityKeys:
          period: 600
          values:
            NewWEPKey0:
              topic: WEPKey0
              type: str
            NewWEPKey1:
              topic: WEPKey1
              type: str
            NewWEPKey2:
              topic: WEPKey2
              type: str
            NewWEPKey3:
              topic: WEPKey3
              type: str
            NewPreSharedKey:
              topic: preSharedKey
              type: str
            NewKeyPassphrase:
              topic: passphrase
              type: str
        GetInfo:
          period: 600
          values:
            NewEnable:
              topic: enable
              type: int
            NewStatus:
              topic: status
              type: str
            NewMaxBitRate:
              topic: maxBitRate
              type: str
            NewChannel:
              topic: channel
              type: str
            NewSSID:
              topic: ssid
              type: str
            NewBeaconType:
              topic: beaconType
              type: str
            NewMACAddressControlEnabled:
              topic: MACAddressControlEnabled
              type: int
            NewStandard:
              topic: standard
              type: str
            NewBSSID:
              topic: bssid
              type: str
            NewBasicEncryptionModes:
              topic: encryptionMode
              type: str
            NewBasicAuthenticationMode:
              topic: authenticationMode
              type: str
            NewMaxCharsSSID:
              topic: MaxCharsSSID
              type: int
            NewMinCharsSSID:
              topic: MinCharsSSID
              type: int
            NewAllowedCharsSSID:
              topic: AllowedCharsSSID
              type: str
            NewMaxCharsPSK:
              topic: MaxCharsPSK
              type: int
            NewMinCharsPSK:
              topic: MinCharsPSK
              type: int
            NewAllowedCharsPSK:
              topic: AllowedCharsPSK
              type: str
twam commented 5 months ago

Your config file works fine for me, but the error indicates a problem while parsing the file. Do you maybe have 'strange' line-endings your file or your password contains special characters and isn't quoted?

TBR-BRD commented 5 months ago

I have used inverted commas ( " ) everywhere. Now it's this error:

pi@rpi3-display:~/fritzbox2mqtt $ python3 fritzbox2mqtt.py -c config.yaml
Exception ignored in: <function Client.__del__ at 0x7fb0176040>
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 874, in __del__
    self._reset_sockets()
  File "/home/pi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1133, in _reset_sockets
    self._sock_close()
  File "/home/pi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1119, in _sock_close
    if not self._sock:
AttributeError: 'Client' object has no attribute '_sock'
Traceback (most recent call last):
  File "/home/pi/fritzbox2mqtt/fritzbox2mqtt.py", line 121, in <module>
    main()
  File "/home/pi/fritzbox2mqtt/fritzbox2mqtt.py", line 26, in main
    run(args)
  File "/home/pi/fritzbox2mqtt/fritzbox2mqtt.py", line 88, in run
    m.connect()
  File "/home/pi/fritzbox2mqtt/mqtt.py", line 44, in connect
    self._client = mqtt.Client()
TypeError: __init__() missing 1 required positional argument: 'callback_api_version'
twam commented 5 months ago

This is caused by a breaking change in the paho-mqtt module. I updated the requirements.txt to limit it to a version < 2.0.0.