I use my “electric imp” (its a small microcontroller connected to a cloud) to control two power sockets via a small homepage. I included two current sensors to get the actual current flow. I tried several ways to visualize in a small diagram. I tried plot.ly grovestream and some others. Its ok but I really want the cool smart “History Graph Card” design. So now I want to send the data to my Home Assistant. But I think the electric imp controller only support HTTP requests and no mqtt. Is there a change to do that? I see there exists a RESTful sensor platform to do a HTTP Post/Get request…
Ok this works for me:
In my “agent” code section I implemented a “function requestHandler(request, response)” that response to any HTTP request, for Home Assistants requests, too.
In this function I add this:
/* Home Assistant polls */
else if (request.path == "/ha_requestpower1")
response.send(200, power1);
else if (request.path == "/ha_requestpower2")
response.send(200, power2);
In Homeassistant I add these two sensors:
# RESTful - Electric Imp
- platform: rest
resource: https://agent.electricimp.com/EZTw97Kag97c/ha_requestpower1
name: Socket1
device_class: power
unit_of_measurement: W
- platform: rest
resource: https://agent.electricimp.com/EZTw97Kag97c/ha_requestpower2
name: Socket2
device_class: power
unit_of_measurement: W