TedPro, Ted 6000 Sensor Configuration

I purchased a TedPro (Ted6000) energy Meter. When i activated the built in Ted5000 sensor, it failed to initialize. This started me down the path to figure out what was wrong. The company that makes this device has changed the API. The xml has changed quite a bit. So i did some research and found the correct settings to get this to work under the TED5000 built in energy sensor. Here are the changes i made to get this to work.
You can find the file at

homeassistant/lib/python3.6/site-packages/homeassistant/components/sensor/ted5000.py

Change the following

"""Set up the Ted5000 sensor."""
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
name = config.get(CONF_NAME)
url = 'http://{}:{}/api/LiveData.xml'.format(host, port)

“”“Initialize the sensor.”""
units = {‘W’: ‘power’, ‘V’: ‘voltage’}

mtus = int(doc[“LiveData”][“System”][“NumberMTU”]):

for mtu in range(1, mtus + 1):
power = int(doc[“LiveData”][“Power”][“MTU%d” % mtu]
[“PowerNow”])
voltage = int(doc[“LiveData”][“Voltage”][“MTU%d” % mtu]
[“VoltageNow”])

to
“”“Set up the Ted5000 sensor.”""
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
name = config.get(CONF_NAME)
url = ‘http://{}:{}/api/SystemOverview.xml’.format(host, port)

“”“Initialize the sensor.”""
units = {‘W’: ‘Value’, ‘V’: ‘Voltage’}
This section is under “”“Get the latest data from the Ted5000 XML API.”""

mtus = int(“1”)

for mtu in range(1, mtus + 1):
power = int(doc[“DialDataDetail”][“MTUVal”][“MTU%d” % mtu]
[“Value”])
voltage = int(doc[“DialDataDetail”][“MTUVal”][“MTU%d” % mtu]
[“Voltage”])

I hope this helps someone down the road. I wouldn’t mind if someone with better knowledge of Python could provide a better solution for the “mtus=int()” section.

Super interested in this. Is it possible for you put together some type of implementation guide for how to make this work?

I can try and put something together this weekend. I have also implemented a custom sensor for costs. Current costs and anticipated monthly bill.

Looking back i would think it best to implement everything thru a custom sensor.

Any chance you had a moment to put something together?

For starters i use home assistant on a Ubuntu server running under a python virtual environment.

I originally modified the built in TED 5000 sensor file to pick up the energy use from my TED. After thinking about this for some time i believe this is not the best choice. An update could possibly over write the file, etc.

Instead i believe you can just create custom sensors as needed.

This guide also assumes you have your TED already set up and operational as a stand alone device.

Record the ip number you configured for your TED unit.

  1. Start by creating a folder in your homeassistant folder. Name this folder “custom_components”. If this folder already exists you can skip this step.
    I also generated another sub folder titled “sensor”
  2. Generate a new file in the custom_components/sensor folder, mine is titled “ted6kHRLycost.py”
    Change the ip number in the “url1” section of the following copied code to match your TED unit.

Copy the following into the new file

import logging
from datetime import timedelta
import requests
import xmltodict
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle

REQUIREMENTS = [‘xmltodict==0.11.0’]

MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=10)
url1= ‘http://192.168.10.4/api/DashData.xml?T=1&D=0&M=0

def setup_platform(hass, config, add_devices, discovery_info=None):
“”“Set up the Ted6000 sensor.”""
add_devices([TedCost()])

class TedCost(Entity):
“”“Implementation of a Ted6000 sensor.”""

def __init__(self):
    """Initialize the sensor."""
    self._state = None

@property
def name(self):
    """Return the name of the sensor."""
    return 'Current Cost'
    
@property
def state(self):
    """Return the state of the resources."""
    return self._state

@property
def unit_of_measurement(self):
    """Return the unit the value is expressed in."""
    return 'Dollars'

@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
     """Get the latest data from the Ted6000 XML API."""
     request = requests.get(url1, timeout=10)
     doc1 = xmltodict.parse(request.text)
     self._state = (int(doc1["DashData"]["Now"])/100)
  1. Now go to your Home assistant configuration file and add the following under your “sensor” section. Please make sure to verify proper indent as this is a yaml file.
  • platform: ted6kHRLycost
    close and save your configuration file

You can also reference the homeassistant website for more in site on how to configure a custom sensor,
Restart homeassistant, your new sensor should appear.

Ossey try that out and see if it works for you.

Thanks! Let me give it a try later this week.

Any movement on this? I’d like to see if/how TED’s are being use for Hass.

Thanks,

Ambi

Bump. Thinking of buying a TED Pro, wondering if I’m going to have issues?

Ive been trying to get this to work, but with no luck :frowning:

I decided against TED; I got the IotaWatt and it works great.

Trying this today, new Home Assistant user with an existing Ted Pro. I’ve set this up as you indicate, but Config is not finding the integration at all. I’m sure this is something simple, but for the life of me I can’t figure out what’s missing. Happy to do whatever debugging is necessary, once I get started.

I have changed the way I have been pulling the power reading. I’m only looking for the power use.

I added the following under the sensor section of my configuration file.

- platform: rest
  resource_template: http://192.168.10.4/api/DashData.xml
  name: Ted 5000
  scan_interval: 5
  value_template: "OK"
  json_attributes_path: "$.DashData"
  json_attributes:
    - "Now"
- platform: template
  sensors:
    ted5000_power:
      friendly_name: Power Consumption
      value_template: "{{ state_attr('sensor.ted_5000', 'Now') }}"


This is what my web browser is seeing from the Ted unit.

<DashData>
    <Now>4069</Now>
    <TDY>40365</TDY>
    <MTD>1547965</MTD>
    <Avg>58015</Avg>
    <Proj>1740463</Proj>
    <Voltage>1225</Voltage>
    <Phase>131</Phase>
</DashData>

Thanks, that worked! I was also able to add the other readings by adding them to the “json_attributes” list and the “value_template” lists, and to define them as additional sensors.

Is there a way to scale the data? The values are in watts and watt-hours, voltage is in 0.1V units. Thanks for all the help!