new at this so bear with me, im trying to do a node red automation that turns the coffee on (switch) and sends me an iOS notification displaying the current outside temperature from an outside motion sensor outside. I figure out the first part, thats easy, the notification I just can’t, anybody would be so kind as to tell me how to do it?
Hi there, Since you have successfully done the first part, it would be easy to do the second also. I hope you have already configured the temperature sensor with HA. If so you can use the below flow in node red to achieve what you want.
[{"id":"be9ac76b5efc4254","type":"inject","z":"51045e07.bbf87","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":210,"y":780,"wires":[["f68373489e3ceba6"]]},{"id":"f68373489e3ceba6","type":"api-current-state","z":"51045e07.bbf87","name":"Sensor Temperature","server":"","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.temperature","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":400,"y":780,"wires":[["e46e7a485a6e850e"]]},{"id":"e46e7a485a6e850e","type":"api-call-service","z":"51045e07.bbf87","name":"Ios Notification","server":"","version":3,"debugenabled":false,"service_domain":"notify","service":"ios","entityId":"","data":"{\"title\":\"Temperature\",\"message\":\"The temperature is {{payload}}\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":600,"y":780,"wires":[[]]}]
To use this code, first copy the full code and then got to node red, press CTRL+I to import flows and paste the copied code in it, select import and the flows will be imported. Now you have make small corrections in it.
For that let me explain how this flow works.
The first node is just a inject node which starts the flow.
Second node is the current state node which is used to get the current state of any entity. You should edit this node to add your outside entity_id and also select your home assistant server under the server tab. When set this node will collect the outside temperature sensor state and pass it on as msg.payload to next node.
The next node is call service node which calls the service nofity. To configure this node, you have to select again your Home assistant server, then select the service name for notifying your IOS app. The most important part is the data which in our case should be in json format. This should carry the title and message service data. Here again if you see the message part, I have used something like this {{payload}}
, with this the value in the msg.payload is collected and put in its place.
Now you can try the flow. Hope its clear. Do ask if you have any issues.
That is so perfect, thank you so much