Using Microsoft Flow with Home Assistant

Now that Microsoft Flow is out of Beta I thought I would play with it and integrate it with Home Assistant running my house. The Microsoft Flow is fairly flexible and has more flow options than IFTTT to make choices. To use this with Home Assistant I am going to use the REST API to make and set a sensor value, you can then take this and make it as complicated as you want. :) Settings You need to ensure you have this information at hand. * Home Assistant Endpoint - https://publicdomin:optionalPort/api * Your password for the http component. If you public expose HA without a password, stop and fix it now! * The name of the sensor you want to update. sensor.kitchen_temperature in this case.

  1. Go to https://flow.microsoft.com and login.
  2. Make a new Flow from a blank template
  3. Search for button (you can use other triggers but this is an easy start)
  4. Add a new step of type action.
  5. Select HTTP
  6. Change Method to POST
  7. In URI put the full URI of the sensor you want to change. Using the data above this is https://publicdomin:optionalPort/api/states/sensor.kitchen_temperature
  8. In headers add the following JSON blob. { “x-ha-access”: “YOURPASSWORD”, “Content-Type”: “application/json” }
  9. In Body put the JSON to update the sensor. { “state”: “25”, “attributes”: { “unit_of_measurement”: “°C” } }
  10. Save the Flow!

Now open up Flow on your phone and log in with the same account, you will see a nice big button with manual -> HTTP on it. Click that button and look at the state of the sensor in Home Assistant. You will see it with the value you set in the body. To trouble shoot, in the web UI click on the i with a circle around it. It will show a log of successes and failures. If you click on that you can drill into the details of the flow and the responses from Home Assistant.

Loading message from the API: ...