Hi.
i trying to use node-red and the ps integration to create custom buttons with latest used software.
and i manage to get part of it right exept for the media image.that currently adds the image that the media player have chached. so all buttons get the same image.
the image path is stored in a local jaml file
that looks some thing like this
{
"CUSA00031": {
"locked": false,
"media_content_type": "game",
"media_image_url": "https://store.playstation.com/store/api/chihiro/00_09_000/container/SE/en/19/EP0001-CUSA00031_00-RAYMANLEGENDS001/1591720622000/image",
"media_title": "Rayman Legends"
},
"CUSA00124": {
"locked": false,
"media_content_type": "app",
"media_image_url": "https://store.playstation.com/store/api/chihiro/00_09_000/container/SE/en/19/EP4345-CUSA00124_00-VIAPLAYFULLAPP00/1591922374000/image",
"media_title": "Viaplay"
},
"CUSA00127": {
"locked": false,
"media_content_type": "app",
"media_image_url": "https://store.playstation.com/store/api/chihiro/00_09_000/container/SE/en/19/EP4350-CUSA00127_00-NETFLIXPOLLUX001/1592614643000/image",
"media_title": "Netflix"
},
"CUSA00135": {
"locked": false,
"media_content_type": "game",
"media_image_url": "https://store.playstation.com/store/api/chihiro/00_09_000/container/SE/en/19/EP1018-CUSA00135_00-BAKPREORDER00001/1592009833000/image",
"media_title": "Batman: Arkham Knight"
},
"CUSA01116": {
"locked": false,
"media_content_type": "app",
"media_image_url": "https://store.playstation.com/store/api/chihiro/00_09_000/container/SE/en/19/EP4381-CUSA01116_00-YOUTUBESCEE00000/1592614832000/image",
"media_title": "YouTube"
},
}
so what i want to do is in the jsonata for the image media_image_url attribute look for the object that matches the attribute media_content_id with my sensors attribute media_content_id and from that get the value under media_image_url and return it to my sensors media_image_url
[{"id":"4d980637.848cf8","type":"tab","label":"PS4 Game sensors","disabled":false,"info":""},{"id":"a99aca48.636358","type":"switch","z":"4d980637.848cf8","name":"","property":"data_app_game.attributes.media_content_type","propertyType":"msg","rules":[{"t":"eq","v":"game","vt":"str"},{"t":"eq","v":"app","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":990,"y":460,"wires":[["e01ccecc.cd89","78bbcca3.f6b3d4"],["1197faa3.befed5","78bbcca3.f6b3d4"]]},{"id":"882d08da.7cd658","type":"ha-entity","z":"4d980637.848cf8","name":"ps4 game 1","server":"9b88cb19.5c8db8","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":""},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"data.attributes.media_title","stateType":"msg","attributes":[{"property":"entity_picture","value":"data.attributes.entity_picture","valueType":"msg"},{"property":"media_content_id","value":"data.attributes.media_content_id","valueType":"msg"},{"property":"media_content_type","value":"game","valueType":"msg"},{"property":"media_title","value":"data.attributes.media_title","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":1190,"y":40,"wires":[[]]},{"id":"93809f99.8a0b2","type":"ha-entity","z":"4d980637.848cf8","name":"ps4 game 2","server":"9b88cb19.5c8db8","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":""},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"data_ps4game1.attributes.media_title","stateType":"msg","attributes":[{"property":"entity_picture","value":"data_ps4game1.attributes.entity_picture","valueType":"msg"},{"property":"media_content_id","value":"data_ps4game1.attributes.media_content_id","valueType":"msg"},{"property":"media_content_type","value":"game","valueType":"str"},{"property":"media_title","value":"data_ps4game1.attributes.media_title","valueType":"msg"}],"resend":true,"outputLocation":"data","outputLocationType":"msg","inputOverride":"allow","x":1190,"y":120,"wires":[["c5aa192.539a6e8","d37732d3.077a5"]]},{"id":"70b397b9.67f2e8","type":"ha-entity","z":"4d980637.848cf8","name":"ps4 game 3","server":"9b88cb19.5c8db8","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":""},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"data_ps4game2.attributes.media_title","stateType":"msg","attributes":[{"property":"entity_picture","value":"data_ps4game2.attributes.entity_picture","valueType":"msg"},{"property":"media_content_id","value":"data_ps4game2.attributes.media_content_id","valueType":"msg"},{"property":"media_content_type","value":"game","valueType":"str"},{"property":"media_title","value":"data_ps4game2.attributes.media_title","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":1190,"y":200,"wires":[[]]},{"id":"939cb4e1.cbfdc8","type":"ha-entity","z":"4d980637.848cf8","name":"ps4 game 4","server":"9b88cb19.5c8db8","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":""},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"data_ps4game3.attributes.media_title","stateType":"msg","attributes":[{"property":"entity_picture","value":"data_ps4game3.attributes.entity_picture","valueType":"msg"},{"property":"media_content_id","value":"data_ps4game3.attributes.media_content_id","valueType":"msg"},{"property":"media_content_type","value":"game","valueType":"str"},{"property":"media_title","value":"data_ps4game3.attributes.media_title","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":1190,"y":280,"wires":[[]]},{"id":"b6c3d143.ca2b4","type":"ha-entity","z":"4d980637.848cf8","name":"ps4 app 1","server":"9b88cb19.5c8db8","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":""},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"data.attributes.media_title","stateType":"msg","attributes":[{"property":"entity_picture","value":"data.attributes.entity_picture","valueType":"msg"},{"property":"media_content_id","value":"data.attributes.media_content_id","valueType":"msg"},{"property":"media_content_type","value":"app","valueType":"str"},{"property":"media_title","value":"data.attributes.media_title","valueType":"msg"},{"property":"media_image_url","value":"$lookup(CUSA00124, ps4_media_id)","valueType":"jsonata"}],"resend":true,"outputLocation":"data","outputLocationType":"msg","inputOverride":"allow","x":880,"y":580,"wires":[["8a537d79.61b5b"]]},{"id":"6317a610.3948d8","type":"ha-entity","z":"4d980637.848cf8","name":"ps4 app 2","server":"9b88cb19.5c8db8","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":""},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"data_ps4app1.attributes.media_title","stateType":"msg","attributes":[{"property":"entity_picture","value":"data_ps4app1.attributes.entity_picture","valueType":"msg"},{"property":"media_content_id","value":"data_ps4app1.attributes.media_content_id","valueType":"msg"},{"property":"media_content_type","value":"app","valueType":"str"},{"property":"media_title","value":"data_ps4app1.attributes.media_title","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":820,"y":660,"wires":[["171aa7e2.68fb98"]]},{"id":"5512c102.38a6b","type":"ha-entity","z":"4d980637.848cf8","name":"ps4 app 3","server":"9b88cb19.5c8db8","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":""},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"data_ps4app2.attributes.media_title","stateType":"msg","attributes":[{"property":"entity_picture","value":"data_ps4app2.attributes.entity_picture","valueType":"msg"},{"property":"media_content_id","value":"data_ps4app2.attributes.media_content_id","valueType":"msg"},{"property":"media_content_type","value":"app","valueType":"str"},{"property":"media_title","value":"data_ps4app2.attributes.media_title","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":820,"y":720,"wires":[["171aa7e2.68fb98"]]},{"id":"68848ebd.9b60b","type":"ha-entity","z":"4d980637.848cf8","name":"ps4 app 4","server":"9b88cb19.5c8db8","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":""},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"data_ps4app3.attributes.media_title","stateType":"msg","attributes":[{"property":"entity_picture","value":"data_ps4app3.attributes.entity_picture","valueType":"msg"},{"property":"media_content_id","value":"data_ps4app3.attributes.media_content_id","valueType":"msg"},{"property":"media_content_type","value":"app","valueType":"str"},{"property":"media_title","value":"data_ps4app3.attributes.media_title","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":820,"y":780,"wires":[[]]},{"id":"189368be.a0bc5f","type":"inject","z":"4d980637.848cf8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":340,"y":360,"wires":[["9b9d987.bbddb68"]]},{"id":"1197faa3.befed5","type":"api-current-state","z":"4d980637.848cf8","name":"","server":"9b88cb19.5c8db8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.ps4_app_1","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data_ps4app1","override_data":"msg","blockInputOverrides":false,"x":380,"y":600,"wires":[["98105449.793058","171aa7e2.68fb98"]]},{"id":"98105449.793058","type":"switch","z":"4d980637.848cf8","name":"","property":"data.attributes.media_content_id","propertyType":"msg","rules":[{"t":"neq","v":"data_ps4app1.attributes.media_content_id","vt":"msg"},{"t":"eq","v":"data_ps4app1.attributes.media_content_id","vt":"msg"}],"checkall":"false","repair":false,"outputs":2,"x":630,"y":600,"wires":[["b6c3d143.ca2b4","b58d7d43.18dd6"],[]]},{"id":"b58d7d43.18dd6","type":"api-current-state","z":"4d980637.848cf8","name":"","server":"9b88cb19.5c8db8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.ps4_app_2","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data_ps4app2","override_data":"msg","blockInputOverrides":false,"x":380,"y":660,"wires":[["435fce72.18fe4","171aa7e2.68fb98","480301cb.36dbf"]]},{"id":"435fce72.18fe4","type":"switch","z":"4d980637.848cf8","name":"","property":"data_ps4app1.attributes.media_content_id","propertyType":"msg","rules":[{"t":"eq","v":"data_ps4app2.attributes.media_content_id","vt":"msg"},{"t":"neq","v":"data_ps4app2.attributes.media_content_id","vt":"msg"}],"checkall":"false","repair":false,"outputs":2,"x":630,"y":660,"wires":[[],["6317a610.3948d8","5b86750a.3c984c"]]},{"id":"5b86750a.3c984c","type":"api-current-state","z":"4d980637.848cf8","name":"","server":"9b88cb19.5c8db8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.ps4_app_3","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data_ps4app3","override_data":"msg","blockInputOverrides":false,"x":380,"y":720,"wires":[["4ceb1b16.ced0e4","480301cb.36dbf","c20598bf.f780b8"]]},{"id":"4ceb1b16.ced0e4","type":"switch","z":"4d980637.848cf8","name":"","property":"data_ps4app2.attributes.media_content_id","propertyType":"msg","rules":[{"t":"eq","v":"data.attributes.media_content_id","vt":"msg"},{"t":"eq","v":"data_ps4app3.attributes.media_content_id","vt":"msg"},{"t":"neq","v":"data_ps4app3.attributes.media_content_id","vt":"msg"}],"checkall":"false","repair":false,"outputs":3,"x":630,"y":720,"wires":[[],[],["5512c102.38a6b","5152fec1.05591"]]},{"id":"5152fec1.05591","type":"api-current-state","z":"4d980637.848cf8","name":"","server":"9b88cb19.5c8db8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.ps4_app_4","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data_ps4app4","override_data":"msg","blockInputOverrides":false,"x":380,"y":780,"wires":[["31a4caf1.459206","c20598bf.f780b8","cc43528c.beda4"]]},{"id":"31a4caf1.459206","type":"switch","z":"4d980637.848cf8","name":"","property":"data_ps4app3.attributes.media_content_id","propertyType":"msg","rules":[{"t":"eq","v":"data.attributes.media_content_id","vt":"msg"},{"t":"eq","v":"data_ps4app1.attributes.media_content_id","vt":"msg"},{"t":"eq","v":"data_ps4app4.attributes.media_content_id","vt":"msg"},{"t":"neq","v":"data_ps4app4.attributes.media_content_id","vt":"msg"}],"checkall":"false","repair":false,"outputs":4,"x":630,"y":800,"wires":[[],[],[],["68848ebd.9b60b"]]},{"id":"e01ccecc.cd89","type":"api-current-state","z":"4d980637.848cf8","name":"","server":"9b88cb19.5c8db8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.ps4_game_1","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data_ps4game1","override_data":"msg","blockInputOverrides":false,"x":760,"y":40,"wires":[["9ea0be65.d70a3","c5aa192.539a6e8"]]},{"id":"9ea0be65.d70a3","type":"switch","z":"4d980637.848cf8","name":"","property":"data.attributes.media_content_id","propertyType":"msg","rules":[{"t":"neq","v":"data_ps4game1.attributes.media_content_id","vt":"msg"},{"t":"eq","v":"data_ps4game1.attributes.media_content_id","vt":"msg"}],"checkall":"false","repair":false,"outputs":2,"x":1010,"y":40,"wires":[["882d08da.7cd658","500f5cfa.1f2f84"],[]]},{"id":"500f5cfa.1f2f84","type":"api-current-state","z":"4d980637.848cf8","name":"","server":"9b88cb19.5c8db8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.ps4_game_2","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data_ps4game2","override_data":"msg","blockInputOverrides":false,"x":760,"y":120,"wires":[["7ce4c93e.6a39b8","c5aa192.539a6e8","d37732d3.077a5"]]},{"id":"7ce4c93e.6a39b8","type":"switch","z":"4d980637.848cf8","name":"","property":"data_ps4game1.attributes.media_content_id","propertyType":"msg","rules":[{"t":"neq","v":"data_ps4game2.attributes.media_content_id","vt":"msg"},{"t":"eq","v":"data_ps4game2.attributes.media_content_id","vt":"msg"}],"checkall":"false","repair":false,"outputs":2,"x":1010,"y":120,"wires":[["93809f99.8a0b2","c8203612.aedd18"],[]]},{"id":"c8203612.aedd18","type":"api-current-state","z":"4d980637.848cf8","name":"","server":"9b88cb19.5c8db8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.ps4_game_3","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data_ps4game3","override_data":"msg","blockInputOverrides":false,"x":760,"y":180,"wires":[["47adcc65.9c9544","d37732d3.077a5","91b6a09d.a5025","c5aa192.539a6e8"]]},{"id":"47adcc65.9c9544","type":"switch","z":"4d980637.848cf8","name":"","property":"data_ps4game2.attributes.media_content_id","propertyType":"msg","rules":[{"t":"eq","v":"data.attributes.media_content_id","vt":"msg"},{"t":"eq","v":"data_ps4game3.attributes.media_content_id","vt":"msg"},{"t":"neq","v":"data_ps4game3.attributes.media_content_id","vt":"msg"}],"checkall":"false","repair":false,"outputs":3,"x":1010,"y":180,"wires":[[],[],["70b397b9.67f2e8","dd191948.cb1ca8"]]},{"id":"dd191948.cb1ca8","type":"api-current-state","z":"4d980637.848cf8","name":"","server":"9b88cb19.5c8db8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.ps4_game_4","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data_ps4game4","override_data":"msg","blockInputOverrides":false,"x":760,"y":240,"wires":[["aac51492.ce59c8","91b6a09d.a5025","faaf8170.e1b57","c5aa192.539a6e8","d37732d3.077a5"]]},{"id":"aac51492.ce59c8","type":"switch","z":"4d980637.848cf8","name":"","property":"data_ps4game3.attributes.media_content_id","propertyType":"msg","rules":[{"t":"eq","v":"data.attributes.media_content_id","vt":"msg"},{"t":"eq","v":"data_ps4game1.attributes.media_content_id","vt":"msg"},{"t":"eq","v":"data_ps4game4.attributes.media_content_id","vt":"msg"},{"t":"neq","v":"data_ps4game4.attributes.media_content_id","vt":"msg"}],"checkall":"false","repair":false,"outputs":4,"x":1010,"y":260,"wires":[[],[],[],["939cb4e1.cbfdc8"]]},{"id":"8a537d79.61b5b","type":"debug","z":"4d980637.848cf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"ps4_media_image","targetType":"msg","x":1450,"y":440,"wires":[]},{"id":"171aa7e2.68fb98","type":"debug","z":"4d980637.848cf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"data_ps4app1","targetType":"msg","x":1290,"y":620,"wires":[]},{"id":"480301cb.36dbf","type":"debug","z":"4d980637.848cf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"data_ps4app2","targetType":"msg","x":1290,"y":680,"wires":[]},{"id":"c20598bf.f780b8","type":"debug","z":"4d980637.848cf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"data_ps4app3","targetType":"msg","x":1290,"y":740,"wires":[]},{"id":"cc43528c.beda4","type":"debug","z":"4d980637.848cf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"data_ps4app4","targetType":"msg","x":1290,"y":800,"wires":[]},{"id":"d90c18e4.6f8e98","type":"api-current-state","z":"4d980637.848cf8","name":"","server":"9b88cb19.5c8db8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"media_player.pandoras_box","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data_app_game","override_data":"msg","blockInputOverrides":false,"x":730,"y":460,"wires":[["a99aca48.636358","78bbcca3.f6b3d4"]]},{"id":"78bbcca3.f6b3d4","type":"debug","z":"4d980637.848cf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"data_app_game","targetType":"msg","x":1300,"y":540,"wires":[]},{"id":"24c561b1.25dc3e","type":"poll-state","z":"4d980637.848cf8","name":"","server":"9b88cb19.5c8db8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"60","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":false,"entity_id":"media_player.pandoras_box","state_type":"str","halt_if":"playing","halt_if_type":"str","halt_if_compare":"is","outputs":2,"x":310,"y":460,"wires":[["d90c18e4.6f8e98"],[]]},{"id":"c5aa192.539a6e8","type":"debug","z":"4d980637.848cf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"data_ps4gsme1","targetType":"msg","x":1420,"y":100,"wires":[]},{"id":"d37732d3.077a5","type":"debug","z":"4d980637.848cf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"data_ps4game2","targetType":"msg","x":1420,"y":160,"wires":[]},{"id":"91b6a09d.a5025","type":"debug","z":"4d980637.848cf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"data_ps4game3","targetType":"msg","x":1420,"y":220,"wires":[]},{"id":"faaf8170.e1b57","type":"debug","z":"4d980637.848cf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"data_ps4game4","targetType":"msg","x":1420,"y":280,"wires":[]},{"id":"2d621fa1.24e37","type":"change","z":"4d980637.848cf8","name":"ps4_media_image","rules":[{"t":"move","p":"payload","pt":"msg","to":"ps4_media_image.ps4_media_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":400,"wires":[["8a537d79.61b5b","b6c3d143.ca2b4"]]},{"id":"9b9d987.bbddb68","type":"bigfile reader","z":"4d980637.848cf8","name":"","filename":"/config/.ps4-games.709E290032B2_9077.json","nopayload":true,"flow":"blocks","highWaterMark":16,"encoding":"utf8","format":"utf8","keepEmptyLines":false,"x":660,"y":400,"wires":[["80071470.3d0ad8"],[]]},{"id":"80071470.3d0ad8","type":"json","z":"4d980637.848cf8","name":"","property":"payload","action":"","pretty":false,"x":930,"y":400,"wires":[["2d621fa1.24e37"]]},{"id":"9b88cb19.5c8db8","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
i have added another layer to the source data in hope that it will make the identification easier. it is one of the change nodes.
if someone could please assist me with that i would realy appreciate it
sincearly
Fredrik B