Originally posted by will40
View Post
Announcement
Collapse
No announcement yet.
IFTTT to trigger Node Red flows?
Collapse
X
-
Ok maybe I will save you some time and head scratching on this developer account business...I have read up on this Twitter API dev to obtain user's tweets for a few hours now.
It appears that the free developer account credentials are good. I found a python script online to validate our dev credentials and it worked for me so I know my free tier account is active. It allows me to post a tweet and to get user info using v1 or v2 of the Twitter API.
It also allows searching for a Twitter user using API v1.1 but neither version allow getting tweets from a user. At least not with the free tier.
I believe I have exhausted trying to use Twitter's API's for getting a user's tweet. Time for me to move on using alternative methods....
- Likes 1
Comment
-
In my continuing efforts to create a flow to scrape a users' twitter feed I have finally got it working. At this time I have to run an inject mode at a certain interval to poll a twitter front end for the specific users' post since a conventional twitter monitor does not exist except for IFTTT.
I am able to run the flow successfully every 10 minutes but what I would like to do is apply a filter so I am not receiving the same tweet msg every 10 mins.
I am writing the tweet to a single line text file to try. I have it overwriting itself on each interval flow.
What I am stumped on is how to filter and command the flow to stop or exit if the text file contains the same previous msg.
I appreciate somebody nudging me in the right direction. Thanks
Comment
-
Look at the RBE node, which I believe is now called the Filter node. It only passes the message if the data has changed. I'm away from a computer today and tomorrow. As I recall you can configure it to Kim at a specific property if the message..
If I can get to computer that can access my Node-Red before you figure it out, I'll post an example.Karl S
HS4Pro on Windows 10
1070 Devices
56 Z-Wave Nodes
104 Events
HSTouch Clients: 3 Android, 1 iOS
Google Home: 3 Mini units, 1 Pair Audios, 2 Displays
Comment
-
ksum here is a working version. I chose a user twitter test feed with very frequent posts so I could apply changes and see the test results quickly. It's not the most elegant flow but works for any twitter feeds that I wish to keep a close eye on. Thanks again for your assistance and contribs on this.
PHP Code:[
{
"id": "e13b35838490bc02",
"type": "change",
"z": "e85ae3689f64c329",
"name": "",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "incoming",
"tot": "msg"
},
{
"t": "set",
"p": "payload.status",
"pt": "msg",
"to": "incoming",
"tot": "msg"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "update",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1000,
"y": 300,
"wires": [
[
"0265afc7b9c8811f"
]
]
},
{
"id": "0265afc7b9c8811f",
"type": "hs-device",
"z": "e85ae3689f64c329",
"name": "DailyMailUK HS4 Tweet Device",
"device": "7508",
"server": "234f285be78e0c76",
"feature": 0,
"reportonstartup": false,
"x": 1170,
"y": 480,
"wires": [
[]
]
},
{
"id": "afa658c0bff49c4a",
"type": "inject",
"z": "e85ae3689f64c329",
"name": "Inject Every 1 min",
"props": [
{
"p": "payload.status",
"v": "on",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 150,
"y": 200,
"wires": [
[
"d2bdb1d4ac2d588b"
]
]
},
{
"id": "d2bdb1d4ac2d588b",
"type": "http request",
"z": "e85ae3689f64c329",
"name": "https://twstalker.com/DailyMailUK",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://twstalker.com/DailyMailUK",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 240,
"y": 400,
"wires": [
[
"866fae2c6fa6ddbf"
]
]
},
{
"id": "866fae2c6fa6ddbf",
"type": "html",
"z": "e85ae3689f64c329",
"name": "",
"property": "payload",
"outproperty": "payload",
"tag": "div.activity-descp p",
"ret": "text",
"as": "single",
"x": 430,
"y": 260,
"wires": [
[
"08eae2efca67adcc"
]
],
"outputLabels": [
"msg.payload"
]
},
{
"id": "fa295889bbad5015",
"type": "debug",
"z": "e85ae3689f64c329",
"name": "TwStalker DailyMailUK Tweet",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1180,
"y": 200,
"wires": []
},
{
"id": "08eae2efca67adcc",
"type": "change",
"z": "e85ae3689f64c329",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload[0]",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 620,
"y": 120,
"wires": [
[
"766bc6d40b292465"
]
]
},
{
"id": "6f850f7e7d71541e",
"type": "play audio",
"z": "e85ae3689f64c329",
"name": "",
"voice": "7",
"x": 1130,
"y": 100,
"wires": []
},
{
"id": "0007d6f4e856433f",
"type": "comment",
"z": "e85ae3689f64c329",
"name": "TWStalker Web Twitter Scrape",
"info": "",
"x": 170,
"y": 100,
"wires": []
},
{
"id": "ef2650df05927672",
"type": "string",
"z": "e85ae3689f64c329",
"name": "",
"methods": [
{
"name": "delRightMost",
"params": [
{
"type": "str",
"value": "trib"
}
]
}
],
"prop": "payload",
"propout": "payload",
"object": "msg",
"objectout": "msg",
"x": 870,
"y": 120,
"wires": [
[
"e13b35838490bc02",
"6f850f7e7d71541e",
"fa295889bbad5015"
]
]
},
{
"id": "766bc6d40b292465",
"type": "function",
"z": "e85ae3689f64c329",
"name": "RBE Filter",
"func": "// block unless value changes\n\nvar new_input = msg.payload;\nvar last_output = context.get("last_output");\n\nif (typeof last_output == 'undefined') {\n context.set("last_output", new_input);\n return msg; // forward initial value\n // * return null to ignore the initial value * //\n}\n\n// otherwise last_output is defined, so did it change?\nif (new_input == last_output) {\n return null;\n}\nelse {\n context.set("last_output", new_input);\n return msg;\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 730,
"y": 260,
"wires": [
[
"ef2650df05927672"
]
]
},
{
"id": "234f285be78e0c76",
"type": "hs-server",
"name": "",
"host": "10.168.1.21",
"port": "8083"
}
]
Comment
-
Replace your Function node with the Filter node. It will show on the editor field as rbe. See the image below. I thought this is delivered with Node-RED but it appears that may not be the case. I have it showing when I search for RBE in the Manage Pallette menu. node-red-node-rbe You should be able to use the default values.
Function nodes use more resources over other nodes. While one or two do not hurt things much, it is better practice to use standard nodes when you can, even if from a contrib. I think this one will do exactly what you need and was the one I was trying to point you towards.
Karl S
HS4Pro on Windows 10
1070 Devices
56 Z-Wave Nodes
104 Events
HSTouch Clients: 3 Android, 1 iOS
Google Home: 3 Mini units, 1 Pair Audios, 2 Displays
- Likes 1
Comment
Comment