{"id":149,"date":"2020-08-13T09:04:00","date_gmt":"2020-08-13T09:04:00","guid":{"rendered":"http:\/\/doctor-dark.co.uk\/blog\/2020\/08\/13\/raspberry-pi-motion-detection-and-notification-program\/"},"modified":"2023-12-18T12:18:02","modified_gmt":"2023-12-18T12:18:02","slug":"raspberry-pi-motion-detection-and-notification-program","status":"publish","type":"post","link":"https:\/\/doctor-dark.co.uk\/blog\/raspberry-pi-motion-detection-and-notification-program\/","title":{"rendered":"Raspberry Pi motion detection and notification program"},"content":{"rendered":"<h2 style=\"text-align: left;\"><span style=\"font-family: verdana;\">PiDoorCam updated<\/span><\/h2>\n<div style=\"text-align: justify;\"><span style=\"font-family: verdana;\">This is the amended, latest version of my Raspberry Pi program to watch the street outside, detect change, and send a picture to another computer for storage, and to my phone. I&#8217;m often in the back garden, and can&#8217;t hear the doorbell; missing deliveries is rather annoying!<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-family: verdana;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-family: verdana;\">It no longer tries to take pictures when it&#8217;s dark, not just because I don&#8217;t have an infra-red camera and infra-red floodlights, but mainly because the street light outside flashes on and off all night, and I don&#8217;t want hundreds of pictures of that!<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-family: verdana;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-family: verdana;\">You&#8217;ll need to set up a Pushover account, which is free provided you don&#8217;t send too many notifications, and a Ramdisk with a directory called \/var\/tmp on the Pi.<\/span><\/div>\n<h2 style=\"text-align: left;\"><span style=\"font-family: verdana;\"><\/p>\n<p>Program listing<\/span><\/h2>\n<div>\n<div><span style=\"font-family: arial; font-size: small;\"># Program for PiDoorCam<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># Detects motion, and when it spots some, takes a high resolution<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># picture, and sends the picture to another computer, also<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># a notification via Pushover, to my phone.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">import io<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">import os<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">import picamera<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">import ftplib<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">import time<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">import datetime<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">from PIL import Image<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">import requests<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">import json<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">import schedule<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">camera = picamera.PiCamera()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">picamera.PiCamera.CAPTURE_TIMEOUT = 30<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># If we detect 100 pixels that changed by 30, we have seen movement.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">pixels = 100<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">difference = 30<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># Use the maximum resolution of the camera.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># This is for V1. V2 is 3280 x 2464.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># It&#8217;s also correct for the ZeroCam.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">width = 2592<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">height = 1944<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># Internet lookup of sunrise and sunset at our location<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">def sunrise_sunset():<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; global sunrise, sunset<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;&nbsp;<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; # Location of greenhouse is lat = yyyyy lon = xxxxx<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; url = &#8216;https:\/\/api.sunrise-sunset.org\/json?lat=yyyyy&amp;lng=xxxxx&#8217;<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; response = requests.get(url)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; dict = response.json()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; res = dict.get(&#8216;results&#8217;)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; curtim = datetime.datetime.now()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; hm = res.get(&#8216;sunrise&#8217;).split(&#8220;:&#8221;)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; sunrise = curtim.replace(hour=int(hm[0])-1, minute=int(hm[1]))<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; print(&#8220;An hour before sunrise &#8220;,sunrise)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;&nbsp;<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; hm = res.get(&#8216;sunset&#8217;).split(&#8220;:&#8221;)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; sunset = curtim.replace(hour=int(hm[0])+13, minute=int(hm[1]))<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; print(&#8220;An hour after sunset&nbsp; &nbsp;&#8220;,sunset)<\/span><\/div>\n<\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># I copied this voodoo motion detection from somewhere. Changed the timeout<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">#&nbsp; setting above to prevent the occasional failures to complete captures.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># Only alter this if you know what you are doing!<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">def compare():<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;camera.resolution = (100, 75)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;stream = io.BytesIO()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;format = &#8216;bmp&#8217;<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;camera.capture(stream, format)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;stream.seek(0)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;im = Image.open(stream)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;buffer = im.load()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;stream.close()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;return im, buffer<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># Function to take a new high resolution picture, send it to another computer,<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># send it to my phone, and then delete it.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">def newimage(width, height):<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; when = datetime.datetime.now()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; filename = &#8220;door-%04d%02d%02d-%02d%02d%02d.jpg&#8221; <\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;% (when.year, when.month, when.day, when.hour, when.minute, when.second)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; camera.resolution = (width, height)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; camera.capture(&#8220;\/var\/tmp\/&#8221;+filename)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; connected = True<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; ftp = ftplib.FTP()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; ftp.connect(&#8220;computer-name&#8221;)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;&nbsp;<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; try:<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; ftp.login(&#8220;user-name&#8221;,&#8221;password&#8221;)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; except ftplib.all_errors:<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; connected = False<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; print (&#8220;Failed to login to server.&#8221;)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; ftp.quit()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; if connected:<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; ftp.storbinary(&#8216;STOR &#8216;+filename, open(&#8220;\/var\/tmp\/&#8221;+filename, &#8220;rb&#8221;))<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; print (&#8220;Sent to server &#8220;, filename)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; ftp.quit()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># Code to send the Pushover message. Make picture smaller first.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># Note this uses a Ramdisk you must set up elsewhere.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; im = Image.open(&#8220;\/var\/tmp\/&#8221;+filename)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; im.resize((324,243),Image.ANTIALIAS)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; im.save(&#8220;\/var\/tmp\/&#8221;+filename)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;&nbsp;<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; r = requests.post(&#8220;https:\/\/api.pushover.net\/1\/messages.json&#8221;, data = {<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &#8220;token&#8221;: &#8220;you-need-to-get-a-token-from-pushover&#8221;,<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &#8220;user&#8221;: &#8220;you-need-to-get-a-user-name-from-pushover&#8221;,<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &#8220;device&#8221;: &#8220;your-device&#8221;,<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &#8220;sound&#8221;: &#8220;intermission&#8221;,<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &#8220;message&#8221;: filename<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; },<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; files = {<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &#8220;attachment&#8221;: (filename, open(&#8220;\/var\/tmp\/&#8221;+filename, &#8220;rb&#8221;), &#8220;image\/jpeg&#8221;)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; })<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;# Check r for problems &#8211; maybe put a delay here?<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; if r.status_code != 200:<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; print(&#8220;Pushover message failed.&#8221;)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; else:<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; print(&#8220;Pushover accepted the message.&#8221;)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># Now delete the file.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; os.remove(&#8220;\/var\/tmp\/&#8221;+filename)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; # Delay to avoid being nasty to Pushover server.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; time.sleep(5)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># Main program.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">camera.rotation = 0<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">print(&#8220;Running door.py&#8221;)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">image1, buffer1 = compare()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div>\n<div><span style=\"font-family: arial; font-size: small;\"># Find sunrise and sunset times at two in the morning, and once<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"># at startup.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">schedule.every().day.at(&#8220;02:00&#8221;).do(sunrise_sunset)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">sunrise_sunset()<\/span><\/div>\n<\/div>\n<div><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">while (True):<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;# See if it&#8217;s time to get sunrise and sunset.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;schedule.run_pending()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;image2, buffer2 = compare()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;changedpixels = 0<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;for x in range(0, 100):<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; for y in range(0, 75):<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pixdiff = abs(buffer1[x,y][1] &#8211; buffer2[x,y][1])<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if pixdiff &gt; difference:<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; changedpixels += 1<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;# See if we think something moved.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;if changedpixels &gt; pixels:<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;# See if it&#8217;s light enough to take a picture.<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; now = datetime.datetime.now()<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; if now &gt; sunrise and now &lt; sunset:<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newimage(width, height)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; else:<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print(&#8220;A bit dark at &#8220;,now)<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;image1 = image2<\/span><\/div>\n<div><span style=\"font-family: arial; font-size: small;\">&nbsp; &nbsp;buffer1 = buffer2<\/span><\/div>\n<div style=\"font-family: verdana;\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>PiDoorCam updated This is the amended, latest version of my Raspberry Pi program to watch the street outside, detect change, and send a picture to another computer for storage, and to my phone. I&#8217;m often in the back garden, and can&#8217;t hear the doorbell; missing deliveries is rather annoying! It no longer tries to take &hellip; <a href=\"https:\/\/doctor-dark.co.uk\/blog\/raspberry-pi-motion-detection-and-notification-program\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Raspberry Pi motion detection and notification program&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-149","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts\/149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":1,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":421,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions\/421"}],"wp:attachment":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}