wingrunr21 / hassio-xcel-itron-mqtt

Bridge for Xcel Energy's iTron Gen 5 Riva smart meters and MQTT
51 stars 8 forks source link

Receiving "Got unexpected response from the API: Service not enabled" after start #19

Open mkadrlik opened 6 days ago

mkadrlik commented 6 days ago

Following the directions within the README.md, I was able to get the device setup on the Xcel web portal, and received an e-mail shortly after setup stating that I can connect to the smart meter, however, when I try to start the service, I get the below error:

ERROR: Got unexpected response from the API: Service not enabled
s6-rc: info: service legacy-services successfully started
Traceback (most recent call last):
  File "/opt/xcel_itron2mqtt/main.py", line 83, in <module>
    meter = xcelMeter(INTEGRATION_NAME, ip_address, port_num, creds)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/xcel_itron2mqtt/xcelMeter.py", line 58, in __init__
    self.mqtt_client = self.setup_mqtt(self.mqtt_server_address, self.mqtt_port)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/xcel_itron2mqtt/xcelMeter.py", line 197, in setup_mqtt
    client.connect(mqtt_server_address, mqtt_port)
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 912, in connect
    self.connect_async(host, port, keepalive,
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 978, in connect_async
    raise ValueError('Invalid host.')
ValueError: Invalid host.
[15:13:33] INFO: Service Xcel iTron2MQTe exited with code 1 (by signal 0)

I can confirm that the IP address I set for the device is correct, and I went so far as to port forward 8081 on my router to ensure that nothing internally was blocking communication. I haven't looked at the code itself yet to see if I can ascertain an issue yet - wanted to post this here to see if there is a simple solution to this error that may not be obvious to me.

TIA for the help!

dxmnkd316 commented 6 days ago

do you have an MQTT broker running? Have you supplied the iTron add-on with the MQTT user/pass?

wingrunr21 commented 6 days ago

I don't support manual MQTT user/pass yet (per the Future section).

If you are using the Mosquitto broker HASS add-on it should auto detect the credentials.

mkadrlik commented 5 days ago

Yep, I didn't have the broker installed; that was the entire issue. Any issue with adding that to the README.md? I'd be happy to do that.

wingrunr21 commented 5 days ago

Sure, but please make sure you link to the Hass MQTT integration docs.

mkadrlik commented 5 days ago

@wingrunr21 Here is the PR for the README.md addition. I'll close this issue out once you merge this. Thanks again for the help!!