Examples: Monday, today, last week, Mar 26, 3/26/04

OhmHour API

CadirCadir Posts: 8Administrator

For those of you that have extra devices to automate that OhmConnect does not connect to directly, you can use a couple of handy extensions.
First, on the bottom of the settings page is a URL that looks like ...verify-ohm-hour... which is personalized just to your account. When you open that URL it will indicate whether you are having an #OhmHour -- which would allow turning off additional devices. The format is
<?xml version="1.0" encoding="UTF-8"?>
<address>Service Address</address>

Active will be None if there are no upcoming #OhmHours -- otherwise it will be True or False reflecting when an #OhmHour is active.

Second, you can integrate with third party services such as IFTTT or Zapier. When OhmConnect sends an SMS or an email, that can be used to trigger recipes.

If you have other channels, let us know!


  • Steve ReedSteve Reed Posts: 111Member

    The XML URL works great with isy994 home controllers from Universal Devices, which can control Insteon and zWave devices.

    I have it set up to monitor the flag, but wait until the beginning of the hour to turn off devices, since OhmHour alerts trigger 15-20 minute before the event, and I don't want things turned off that early.

  • Kate from OhmConnectKate from OhmConnect Posts: 1,049Administrator

    @dstjohn99 wanted to make sure you saw this post, in case it's helpful to you!

  • dstjohn99dstjohn99 Posts: 371Member
    Thanks, it's on my to do list...
  • Daniel5Daniel5 Santa Rosa, CAPosts: 12Member

    Sorry to dig up an old post but I can't figure out how to integrate that URL with IFTTT. It doesnt seem it has a parser for JSON/XML

  • Kate from OhmConnectKate from OhmConnect Posts: 1,049Administrator

    @curtistongue any ideas?

  • santacruzsaversantacruzsaver Posts: 5Member

    @Daniel5 said:
    Sorry to dig up an old post but I can't figure out how to integrate that URL with IFTTT. It doesnt seem it has a parser for JSON/XML

    I think the original poster was suggesting that you use an email or SMS monitoring IFTTT applet with keywords for the ohmconnect notification email/sms which would allow you to act on it. It may have a delay but it shouldn't be too terrible.

    The URL is more useful if you're coding your own scripts/apps or if you have a smart home hub device that can monitor it and act on changes.

  • carl.lenoxcarl.lenox Posts: 1Member
    edited January 2018

    This is a very useful post! I wrote a bit of Python to parse the XML which may be useful for posterity. Good luck!

    import xml.etree.ElementTree as ET
    import certifi
    import urllib3

    http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())

    r = http.request('GET', 'https://login.ohmconnect.com/verify-ohm-hour/XXXXXX')

    comment-# Put your specific URL found at the bottom of settings into the above

    data = r.data

    root = ET.fromstring(data)

    OC_state = root[1].text

    comment-# OC_state will be True, False, or None

  • Kate from OhmConnectKate from OhmConnect Posts: 1,049Administrator

    @carl.lenox what do you use this for?

  • Jason GoeckeJason Goecke Posts: 1Member

    Any chance OhmConnect will provide a callback/hook instead of a GET function? Would be much better to just trigger a script/IFTTT via that rather than email, SMS, or a GET.

  • cwiedcwied San MateoPosts: 135Member

    Or even simpler, just add an "OhmHour scheduled" trigger to the OhmConnect IFTTT triggers with ingredients for start and end time.

  • randyalurandyalu Posts: 2Member
    edited January 14

    Any chance of adding another field? I would love "next_start" and "next_end" fields that listed the date and time of day that the next scheduled Ohm Hour happens. It would keep my software from having to load the XML file every minute - just check once per day or so.

    For those who are curious about other uses, I have two:
    1) I have an old hot tub that I've put a solar hot water collector on. I've recently integrated a Raspberry Pi to determine when to use the electric back up heater and I've got it checking this URL every minute when it would otherwise be turning on the electric heater.

    2) I've converted a 1975 Porsche 914 to electric. I prefer to charge in the evening because I often watch the battery voltages during charge to look for weak cells. I plan to put a Raspberry Pi into it as well so that it can pause the charging automatically during an Ohm Hour (among other reasons to pause like the batteries are getting too warm).

  • UkiwiSUkiwiS San DiegoPosts: 1,599Member, Moderator
    edited January 14


    What's your battery capacity and range of the Porsche? Do you have any pics posted?

  • cwiedcwied San MateoPosts: 135Member

    Strictly speaking, you only have to check the file once an hour since the OhmHours are all aligned to hour batteries, but I understand your desire.

    Have you considered using the IFTTT triggers and a Webhook instead? This is how I automate my Powerwalls. It does require port forwarding, but it sounds like you have the expertise to make it work. The key to doing it securely is using https and a security key (which can be part of the URL). With free letsencrypt certificates, it's reasonable to do this for hobbyist projects.

  • titusmartitusmar Posts: 1Member

    Would you be able to provide more details on how you automate your powerwalls?
  • cwiedcwied San MateoPosts: 135Member

    I have a FreeNAS box that runs a simple node.js web server that responds to web requests and then makes requests using the local Powerwall web API (the one that the setup wizard uses). The IFTTT applets respond to OhmHour start and end events and make web requests to my web server. On OhmHour start events, I set the powerwalls to self-consumption with a reserve of 10%. On OhmHour end events, I set the reserve to 100%.

    See https://github.com/vloschiavo/powerwall2 for details on how to interact with the Powerwalls on the LAN.

    Unfortunately my code is hard-coded for my local setup, otherwise I could share it. I haven't spent any time trying to package it for reuse yet. It isn't that complex, though, so if you have any coding ability it should be relatively easy to reproduce.

Sign In or Register to comment.