DTE (Powerley) Energy Bridge Endpoint error

I’ve been monitoring household electric power consumption using an Energy Bridge that connects to my SmartMeter as provided by my utility company. Old threads documented an HTTP Endpoint that returned the instantaneous demand and I had used that info to create a sensor. It’s been working for a few weeks until around 4pm today when it started to return an error. Here’s how I configured the sensor:

sensor:

  • platform: dte_energy_bridge
    ip: 192.168.0.xx
    name: AEP Energy Bridge
    version: 2

When I call the endpoint manually (http://192.168.0.xx:8888/zigbee/se/instantaneousdemand) I get this error:

{“code”:“ResourceNotFound”,“message”:"/zigbee/se/instantaneousdemand does not exist"}

Wondering if any other Energy Bridge users are having this problem? I wonder if they deployed an update that turned off this endpoint.

I am having the same issue. Mine is through AEP as well. I’m trying to figure out what the new reporting url is…

Yes, same issue here, I’m also with DTE and noticed the loss of the endpoint a couple of days ago. I contacted DTE energy bridge support but so far not received any information. I also assume it was some updated firmware pushed that caused the endpoint to go away. I’ll post if I get any more information from DTE.

I’m having the same issue as well. On AEP also.

I’m on AEP as well
This issue appeared on Jan 13th
Hoping for a solution

I’m on DTE and having the same issue. The http://ip_addr:8888/zigbee/se/instantaneousdemand stopped working Saturday around 7pm and started returning the same error you (BenDiss) are receiving.

Same issue for me after updating HA.

Log Details (WARNING)

Tue Jan 15 2019 08:17:11 GMT-0500 (Eastern Standard Time)

Invalid status_code from DTE Energy Bridge: 404 (Current Energy Usage)

{"code":"ResourceNotFound","message":"/zigbee/se/instantaneousdemand does not exist"}

image

Same thing here, AEP, also getting a 404 on the old address for the v2. I’m guessing AEP updated something here.

I just set up a v2 and I’m receiving the same error:

WARNING (SyncWorker_3) [homeassistant.components.sensor.dte_energy_bridge] Invalid status_code from DTE Energy Bridge: 404 (Current Energy Usage)

Anyone get this working?

There was a firmware update that disabled access to the energy bridge. It appears DTE wants to charge people now.

I’ve got the $0.99 a month plan so I don’t think the two are related. I can connect to the port just fine, but it looks like the API was changed.

before they did they update and the pay service you could connect to your bridge at http://x.x.x.x:8888//zigbee/se/instantaneousdemand

After the rolled out the pay service, this access is gone.

How did the original person to develop the plugin find that address in the first place? I’ve tried to monitor the traffic, but I can’t see anything as it’s all encrypted (which is good). However, I’m not really sure of what I’m doing.

My best guess is this wasn’t supposed to be there in the first place it was a security update to remove it. (likely for their development purposes I should say)

DTE’s V2 Energy Bridge is a utility-branded device from Powerley. I’ve been diving in to the packets flying around my network trying to figure out how the app is able to display the instantaneous power usage.

Turns out, they are using Amazon’s AWS IoT MQTT service. This also explains how the app can display your current energy usage even if you are not on your home network.

The Energy Bridge is hard-coded to use Google’s 8.8.8.8 DNS servers. I’ve seen it do queries for mqtt.pwly.io, along with ebapi.pwly.io (I assume ebapi = Energy Bridge API).

Every 3 seconds (which corresponds to the blinking green dot when viewing your current utilization in the app) the EB sends data to the AWS IoT MQTT server over the secure-mqtt TCP port (8883). From what I saw, the EB sends ~330 bytes, and receives back ~66 bytes.

When you start the app and login, the energy bridge looks up bothan-auth.pwly.io (which could be a reference to Bothan.io, or it could just as easily be a reference to the Bothans in Return of the Jedi). The app communicates directly with dtei-coreapi.pwly.io to get usage history, weather data, budget, billing cycles, usage targets, etc. using various API endpoints associated with each of those.

Almost all of the queries to dtei-coreapi require an Authorization: header which contains a token, presumably based on your DTE credentials.

One API endpoint I’ve seen that does not is:

https://dtei-coreapi.pwly.io/v2/ServiceNetwork/{id}

(where {id} is Powerley’s internal ID of utility companies using their product; 17 is DTE). If you curl the above endpoint, you get a JSON blob with some information about the utility.

I have not yet figured out how to authenticate to the AWS IoT MQTT service in order to receive a feed of current energy utilization.

In any case, it’s a bummer that Powerley removed the local instantaneousdemand endpoint that made it so easy to get that information in to Home Assistant. :neutral_face:

1 Like

This was posted to the github thread. I’ve implemented this successfully.

Subscribe to its undocumented MQTT broker:

mosquitto_sub -h 1.2.3.4 -p 2883 -u admin -P trinity -t '_zigbee_metering/event/metering/instantaneous_demand'

You can monitor all topics via # to see what other stuff it sends out.

@joeshaw @kylehendricks @ronytomen @PRabahy @cscheib Please , contact/call Powerley and ask them to provide a public API for their energy bridge (they designed the hardware, the app, and the code running on it). They’re probably unaware (I hope) people use the data locally so until they provide an API, you’re again going to be one update away from being completely locked out of a device you may be paying for.

Until they release an API, have your router block requests to bothan-auth.pwly.io or disconnect it from the internet entirely to prevent further updates.

1 Like

Thanks for linking to the comment on the GitHub issue for this! I will definitely try this out.

Looking at the thread in the link above:

I managed to be able to get use of the energy bridge again:

If you are already using Mosquitto you can setup a bridge to the MQTT broker on the energy bridge by adding:

connection dte
address <IP_OF_BRIDGE>:2883
remote_username admin
remote_password trinity
clientid homeassistant-1
try_private false
start_type automatic
topic # both 0

Restart mosquitto

If you aren’t using a MQTT broker of any sort you can define the energy bridge as a broker in your configuration.yaml

mqtt:
  broker: <IP_OF_BRIDGE>
  port: 2883
  client_id: home-assistant-1
  username: admin
  password: trinity

In order to keep the data populating, I added a cronjob to run every 5 minutes

*/5 *  * * *   mosquitto_pub -h <IP_OF_MQTT_BROKER> -p <PORT_OF_MQTT_BROKER> -u <USERNAME_OF_MQTT_BROKER>  -P <PASSWORD_OF_MQTT_BROKER>  -t '_zigbee_metering/request/is_app_open' -m '{"request_id": "ha-monitor"}'

No matter which option you choose above, you can then define a new sensor in your configuration.yaml like:

sensor energy:
  - platform: mqtt
    name: "DTE Energy Bridge"
    state_topic: "_zigbee_metering/event/metering/instantaneous_demand"
    unit_of_measurement: 'W'
    value_template: "{{ value_json.demand }}"
1 Like
_zigbee_metering/event/metering/instantaneous_demand

has been changed in an update overnight. The new MQTT topic is now

event/metering/instantaneous_demand

Changing my sensors to this topic has re-fixed them.

2 Likes

Hello energy bridgers! Thanks for figuring out the messages from the energy bridge, this is really neat. I’m having trouble getting it to work in home assistant with mosquitto. I think it’s an MQTT / home-assistant configuration issue somehow. This is the first thing I’m trying to do with home-assistant, so I’m sure it’s user error…

I tried the two methods listed by kidmock, thanks! It works directly from the bridge MQTT broker, Set up as the following in configuration.yaml, the dte sensor shows up and works. But, I assume this precludes using any other MQTT devices or mosquitto as the MQTT broker, so I think I want to make it work with mosquitto as the MQTT broker to ha.

# direct from the energy bridge,  if that was the only MQTT thing in use, not likely, but it works.
mqtt:
  broker: 192.168.15.19
  port: 2883
  client_id: home-assistant-1
  username: admin
  password: trinity

sensor:
  # Main meter electrical flow courtesy DTE monopoly
  - platform: mqtt
    name: "DTE Energy Bridge"
    state_topic: "event/metering/instantaneous_demand"
    unit_of_measurement: 'W'
    value_template: "{{ value_json.demand }}"

I am able to see data from it by manually subscribing from mosquitto, either from pc or from hassbian rpi. I can also publish and receive messages from command line. So I think mosquitto is working correctly. x.x.x.15 is hassbian, x.x.x.19 is the energy bridge, both are static assigned in the router. I also have home-assistant waiting for mosquitto service to be started first in /etc/systemd/system/[email protected]

pi@hassbian:~$ mosquitto_sub -h 192.168.15.19 -p 2883 -u admin -P trinity -t "event/metering/instantaneous_demand"
{"time":1558491026678,"demand":339}
{"time":1558491029718,"demand":339}
{"time":1558491032763,"demand":339}
{"time":1558491035807,"demand":341}
{"time":1558491038850,"demand":340}

But if I try to use mosquitto as the MQTT broker for home-assistant, like this: it does not work, the dte sensor does not show up in ha. ? Do I have the syntax correct for the connection section ? does this belong somewhere else besides in configuration.yaml? The configurator editor syntax checker suggested the semicolons be added.

mqtt:
  broker: 192.168.15.15
  port: 1883
  clientid: homeassistant-1
  username: pi
  password: pimqtt

  connection: dte
  address: 192.168.15.19:2883
  remote_username: admin
  remote_password: trinity
  try_private: false
  start_type: automatic
  topic: # both 0

sensor:
  # Main meter electrical flow courtesy DTE monopoly
  - platform: mqtt
    name: "DTE Energy Bridge"
    state_topic: "event/metering/instantaneous_demand"
    unit_of_measurement: 'W'
    value_template: "{{ value_json.demand }}"

This section goes into Mosquitto not home assistant

connection: dte
address: 192.168.15.19:2883
remote_username: admin
remote_password: trinity
try_private: false
start_type: automatic
topic: # both 0

To add clarity, mosquitto is a different service. I’m not sure how it is run in hassio, but in a plain installation on a raspberry pi. The configuration files are in /etc/mosquitto/conf.d/

Create a file for example : /etc/mosquitto/conf.d/dte.conf which the contents above and restart mosquitto

ex: systemctl restart mosquitto

1 Like