Hello there, so I started working with home assistant only recently and am still learning the ropes. I feel that I hit a wall and don’t know what to do at this point. My issue is that I would like to send a simple JSON to home assistant from a voice recognition app that I made and then make home assistant send that JSON to another app running on a different device.
My code that sends the JSON in the voice recog. app in c# :
{
var httpWebRequest = (HttpWebRequest)WebRequest.Create(“http://hassIPaddress:8123/api/?api_password=PASS”);
httpWebRequest.ContentType = “application/json”;
httpWebRequest.Method = “POST”;
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{\"number\":\"4\"}";
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
}
So this part should be fine, my problem starts down here.
I included a rest sensor in my configuration file but it doesn’t create an entity so I am not sure how to call on him
looks like this in my configuration.yaml file ↓
sensor:
- platform: rest
resource: http://hassIPaddress:8123/api/
but I admit that I do not quite understand the REST API. I would like to make an automation on the home assistant side something like:
automation:
alias: Send JSON to a web server
trigger:
(Rest api detects a sent JSON)
action:
(Rest api sends the JSON at an ip address)
service: persistent_notification.create
data:
message: “JSON was accepted and sent”
I thought maybe some of you already did something like this. I would be really grateful for any help or comments about what am I doing wrong.