Jump to content

  •  

CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.

Photo

NINA status dashboard in Home Assistant via. MQTT

  • Please log in to reply
144 replies to this topic

#51 ispybadguys

ispybadguys

    Viking 1

  • -----
  • Posts: 616
  • Joined: 31 Jan 2021
  • Loc: Albuquerque,NM

Posted 11 March 2024 - 09:17 PM

I cooked up a little Python code that looks for updates to the ImageMetaData.json file you can create with the Session Meta Data plug-in and publishes the JSON data to an MQTT server. I then suck this in (a technical term) to Home Assistant to get exposure time and FWHM data into my dashboard. Here it is if you have a use for it. You need to install Python and paho.mqtt.client and then start the script during your session

import time
import json
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import paho.mqtt.client as mqtt

# MQTT Configuration
broker_address = "threadripper"
topic = "NINA/exposure"

# Initialize MQTT client with MQTT version specified
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)

def on_connect(client, userdata, flags, rc, properties=None):
    print(f"Connected to MQTT Broker with result code {rc}")

client.on_connect = on_connect

try:
    client.connect(broker_address)
    client.loop_start()
    print("MQTT Connect called")
except Exception as e:
    print(f"Failed to connect to MQTT Broker: {e}")

class FileChangeHandler(FileSystemEventHandler):
    def __init__(self, filename):
        self.filename = filename

    def on_modified(self, event):
        if event.src_path == self.filename:
            try:
                with open(self.filename, "r") as file:
                    data = json.load(file)
                    if data and isinstance(data, list) and data[-1]:
                        latest_object = data[-1]
                        print(f"Publishing latest object: {latest_object}")
                        client.publish(topic, json.dumps(latest_object))
            except Exception as e:
                print(f"Error processing file {self.filename}: {e}")

file_to_watch = "E:\\NINA\\ImageMetaData.json"
event_handler = FileChangeHandler(file_to_watch)
observer = Observer()
observer.schedule(event_handler, path="E:\\NINA", recursive=False)
observer.start()

print("Observer started, monitoring file changes...")

try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    observer.stop()
    observer.join()
    client.loop_stop()
    client.disconnect()

I cleaned up my dashboard some.

 

dashboard.jpg

 

Kurt


  • chvvkumar, richard1955 and Szymfinger like this

#52 Verschup

Verschup

    Lift Off

  • -----
  • Posts: 4
  • Joined: 17 Mar 2023

Posted 23 August 2024 - 08:28 AM

I've published a first complete version of the thumbnail image pull service now that I've got the gallery view working better with a bit more info about the session stats, the code is less dependent on pyscript, and has better error handling. It's working well for me now. Let me know if any of you install it and have questions of feedback.  https://github.com/p...nina-image-data

 

v0.1.0:

 

Initial release providing the following capabilities:

  • Connect to arbitrary URL where NINA running Web Session History Viewer is publishing image data; retrieve all current sessions' image thumbnails
  • Store all retrieved thumbnails to HA-local directory along with index.html and js/css files to support a basic gallery of all images, starting with the most recent image, similar to NINA's own visualization of captured images
  • Initial round of efficiency improvements to download new images as they are available and delete images that are no longer reported by WSHV
  • Initial round of basic error checking with graceful handling
  • Instructions for how to incorporate script into HA, including pyscript setup, HA automations, and dashboard tile to display image gallery

Runs on local python and in pyscript on Home Assistant (container mode tested, others may or may not be supported).

 

 

attachicon.gif Screenshot 2023-12-10 005729.png

Hi Explorer 1,

 

Great job. This works like a charm. Only one question, what's the 'custom_components.pyscript: info' doing? Is this just to write into the log? If I add it to my config file and check it, my system just hangs and keeps checking if the config is ok to reboot.

 

Thanks.

 

Pim



#53 DanieleS

DanieleS

    Lift Off

  • -----
  • Posts: 15
  • Joined: 17 Feb 2021

Posted 12 September 2024 - 01:17 PM

Hi everyone, I found this post very interesting as I have HA too.
I found several interesting solutions here, the only one I managed to make work is that of the author of the post but I don't like it because I necessarily have to use the Advanced Sequencer while I do everything manually.
In your opinion, among the valid alternatives here, what is the best solution to have all the data on HA?

So I avoid following different paths

Thank you



#54 chvvkumar

chvvkumar

    Surveyor 1

  • *****
  • topic starter
  • Posts: 1,821
  • Joined: 03 Aug 2020
  • Loc: Cottleville, MO

Posted 12 September 2024 - 10:35 PM

Hi everyone, I found this post very interesting as I have HA too.
I found several interesting solutions here, the only one I managed to make work is that of the author of the post but I don't like it because I necessarily have to use the Advanced Sequencer while I do everything manually.
In your opinion, among the valid alternatives here, what is the best solution to have all the data on HA?

So I avoid following different paths

Thank you

OP here. Depends on how much you want to wrangle code, NINA web session history viewer plugin provides most of this data in the JSON format:

 

https://github.com/t...nina.plugin.web

 

It publishes its session data to the browser at this path 

http://NINA_IP_OR_HOSTNAME/sessions/sessions.json

with each session 's date and 'key' as key-value pairs (an example from mine):

{
  "sessions": [
    {
      "key": "20240904-193040",
      "display": "Sep 04 2024, 19:30:40"
    },
    {
      "key": "20240906-193335",
      "display": "Sep 06 2024, 19:33:35"
    },
    {
      "key": "20240907-174034",
      "display": "Sep 07 2024, 17:40:34"
    },
    {
      "key": "20240908-173933",
      "display": "Sep 08 2024, 17:39:33"
    },
    {
      "key": "20240909-172324",
      "display": "Sep 09 2024, 17:23:24"
    },
    {
      "key": "20240910-194608",
      "display": "Sep 10 2024, 19:46:08"
    },
    {
      "key": "20240912-222211",
      "display": "Sep 12 2024, 22:22:11"
    }
  ]
}

You then take the ID of the latest session and put it into the following URL to get a JSON object of that session's details

http://NINA_IP_OR_HOSTNAME/sessions/20240912-222211/sessionHistory.json

This a is a large JSON object containing the whole history of the session. But for our use, we only need the latest image's details about things like RMS, RA, DEC etc. as Home Assistant will record the history from each update. You can then take the JSON and do what you want with it. To start you off, this is what I came up with so far to get RMS from the most recent image. 

 

You can test it by copying the JSON object and using it in HA's template editor under developer tools. Put the JSON between the curly braces in this template on the empty line

{% set value_json = {

}
%}

"{{ value_json.targets[0].imageRecords[-1].GuidingRMSArcSec }}"

This line is just dot walking the path to the first target > last image (the latest image is at the end of the JSON object so this wraps around to the end)  and finally to the image's GuidingRMSArcSec value.

"{{ value_json.targets[0].imageRecords[-1].GuidingRMSArcSec }}"


#55 DanieleS

DanieleS

    Lift Off

  • -----
  • Posts: 15
  • Joined: 17 Feb 2021

Posted 13 September 2024 - 12:25 PM

 

OP here. Depends on how much you want to wrangle code, NINA web session history viewer plugin provides most of this data in the JSON format:

 

https://github.com/t...nina.plugin.web

 

It publishes its session data to the browser at this path 

http://NINA_IP_OR_HOSTNAME/sessions/sessions.json

with each session 's date and 'key' as key-value pairs (an example from mine):

{
  "sessions": [
    {
      "key": "20240904-193040",
      "display": "Sep 04 2024, 19:30:40"
    },
    {
      "key": "20240906-193335",
      "display": "Sep 06 2024, 19:33:35"
    },
    {
      "key": "20240907-174034",
      "display": "Sep 07 2024, 17:40:34"
    },
    {
      "key": "20240908-173933",
      "display": "Sep 08 2024, 17:39:33"
    },
    {
      "key": "20240909-172324",
      "display": "Sep 09 2024, 17:23:24"
    },
    {
      "key": "20240910-194608",
      "display": "Sep 10 2024, 19:46:08"
    },
    {
      "key": "20240912-222211",
      "display": "Sep 12 2024, 22:22:11"
    }
  ]
}

You then take the ID of the latest session and put it into the following URL to get a JSON object of that session's details

http://NINA_IP_OR_HOSTNAME/sessions/20240912-222211/sessionHistory.json

This a is a large JSON object containing the whole history of the session. But for our use, we only need the latest image's details about things like RMS, RA, DEC etc. as Home Assistant will record the history from each update. You can then take the JSON and do what you want with it. To start you off, this is what I came up with so far to get RMS from the most recent image. 

 

You can test it by copying the JSON object and using it in HA's template editor under developer tools. Put the JSON between the curly braces in this template on the empty line

{% set value_json = {

}
%}

"{{ value_json.targets[0].imageRecords[-1].GuidingRMSArcSec }}"

This line is just dot walking the path to the first target > last image (the latest image is at the end of the JSON object so this wraps around to the end)  and finally to the image's GuidingRMSArcSec value.

"{{ value_json.targets[0].imageRecords[-1].GuidingRMSArcSec }}"

as your suggestion I installed the plug in "Web Session History Viewer", I activated it. When I start Nina it shows me the URL as "http: //localhost:80/dist" but if I go to the address it gives me an error on the page. What am I doing wrong?



#56 chvvkumar

chvvkumar

    Surveyor 1

  • *****
  • topic starter
  • Posts: 1,821
  • Joined: 03 Aug 2020
  • Loc: Cottleville, MO

Posted 13 September 2024 - 01:03 PM

as your suggestion I installed the plug in "Web Session History Viewer", I activated it. When I start Nina it shows me the URL as "http: //localhost:80/dist" but if I go to the address it gives me an error on the page. What am I doing wrong?

Replace 'localhost' with the IP or hostname of your NINA PC.



#57 DanieleS

DanieleS

    Lift Off

  • -----
  • Posts: 15
  • Joined: 17 Feb 2021

Posted 13 September 2024 - 03:50 PM

Replace 'localhost' with the IP or hostname of your NINA PC.

this is my plugin:
websession.png

 

and this is when i go on browser and use that url:
host.png



#58 chvvkumar

chvvkumar

    Surveyor 1

  • *****
  • topic starter
  • Posts: 1,821
  • Joined: 03 Aug 2020
  • Loc: Cottleville, MO

Posted 13 September 2024 - 04:11 PM

this is my plugin:
attachicon.gif websession.png

 

and this is when i go on browser and use that url:
attachicon.gif host.png

You have an IIS server running on that port 80 I think. Change the port in NINA plugin to something else, like 9999 and try that.



#59 DanieleS

DanieleS

    Lift Off

  • -----
  • Posts: 15
  • Joined: 17 Feb 2021

Posted 14 September 2024 - 02:02 AM

You have an IIS server running on that port 80 I think. Change the port in NINA plugin to something else, like 9999 and try that.

Thank you, now it works!!
so, in the templates on developer tools I insert this:

{% set value_json = "{
http: //192.168.1.139:9999/sessions/20240914-085018/sessionHistory.json
}"
%}
"{{ value_json.targets[0].imageRecords[-1].GuidingRMSArcSec }}"

but it returns me: "UndefinedError: 'str object' has no attribute 'targets'"

 

second thing I wanted to say: 

although looking at your initial proposal with MQTT it's not bad.

I created an advanced sequence based on my needs, the only thing I didn't understand was how to send the data via MQTT at the end of the shot.
That is, for example, if I am making 300s exposures, at each end of the exposure you will have to send me the updated data. Also, where do I find topics to listen to?

So I take both ways
I attach my sequence

Attached Files


Edited by DanieleS, 14 September 2024 - 07:54 AM.


#60 chvvkumar

chvvkumar

    Surveyor 1

  • *****
  • topic starter
  • Posts: 1,821
  • Joined: 03 Aug 2020
  • Loc: Cottleville, MO

Posted 14 September 2024 - 10:47 AM

Thank you, now it works!!
so, in the templates on developer tools I insert this:

{% set value_json = "{
http: //192.168.1.139:9999/sessions/20240914-085018/sessionHistory.json
}"
%}
"{{ value_json.targets[0].imageRecords[-1].GuidingRMSArcSec }}"

but it returns me: "UndefinedError: 'str object' has no attribute 'targets'"

You need to copy the JSON object's contents and put it there, not the URL. But this is to test how to get the data you want from the said object. Once you have all the things you need identified, you then need to use HA's RESTful sensor to query the URL for new JSON data and use the expressions you created in the developer tools' template editor to create REST sensors in HA. I have had not had time to do this part yet.

 

 

second thing I wanted to say: 

although looking at your initial proposal with MQTT it's not bad.

I created an advanced sequence based on my needs, the only thing I didn't understand was how to send the data via MQTT at the end of the shot.
That is, for example, if I am making 300s exposures, at each end of the exposure you will have to send me the updated data. Also, where do I find topics to listen to?

So I take both ways
I attach my sequence

 

I am attaching my sequence I use every day (this is for SHO, I have a similar one for LRGB and HOO). I use the ground station plugin in NINA to send MQTT messages. The process is posted earlier in this thread where another user was having issues with setting it up.

 

Attached File  Advanced Sequence.txt   91.34KB   24 downloads



#61 DanieleS

DanieleS

    Lift Off

  • -----
  • Posts: 15
  • Joined: 17 Feb 2021

Posted 14 September 2024 - 01:08 PM

You need to copy the JSON object's contents and put it there, not the URL. But this is to test how to get the data you want from the said object. Once you have all the things you need identified, you then need to use HA's RESTful sensor to query the URL for new JSON data and use the expressions you created in the developer tools' template editor to create REST sensors in HA. I have had not had time to do this part yet.

 

 

 

I am attaching my sequence I use every day (this is for SHO, I have a similar one for LRGB and HOO). I use the ground station plugin in NINA to send MQTT messages. The process is posted earlier in this thread where another user was having issues with setting it up.

 

attachicon.gif Advanced Sequence.txt

I managed to set it, the only thing I couldn't do is have the data read every time a shot ends.
as I did it, send the data with MQTT to HA, the intelligent exposure starts and the entities are not updated.. that's why I was wondering if there was a way to send the updated data with each shot



#62 flamidey

flamidey

    Ranger 4

  • -----
  • Posts: 319
  • Joined: 25 Oct 2021
  • Loc: Montreal, Canada

Posted 14 September 2024 - 02:16 PM

I managed to set it, the only thing I couldn't do is have the data read every time a shot ends.
as I did it, send the data with MQTT to HA, the intelligent exposure starts and the entities are not updated.. that's why I was wondering if there was a way to send the updated data with each shot

Ground Station Beta 3 sends the image and all its parameters after each shot.



#63 DanieleS

DanieleS

    Lift Off

  • -----
  • Posts: 15
  • Joined: 17 Feb 2021

Posted 14 September 2024 - 02:52 PM

Ground Station Beta 3 sends the image and all its parameters after each shot.

i guess to find a solution with loop interations

Attached Thumbnails

  • nina.png

  • chvvkumar likes this

#64 chvvkumar

chvvkumar

    Surveyor 1

  • *****
  • topic starter
  • Posts: 1,821
  • Joined: 03 Aug 2020
  • Loc: Cottleville, MO

Posted 14 September 2024 - 03:31 PM

Ground Station Beta 3 sends the image and all its parameters after each shot.

How do you install the beta? I added the git repo to NINA (the 'gs3' branch, specifically but GS plugin in the list shows 2.4.0.0.



#65 flamidey

flamidey

    Ranger 4

  • -----
  • Posts: 319
  • Joined: 25 Oct 2021
  • Loc: Montreal, Canada

Posted 14 September 2024 - 03:48 PM

How do you install the beta? I added the git repo to NINA (the 'gs3' branch, specifically but GS plugin in the list shows 2.4.0.0.

From the Discord :
Ground Station 3.0 beta 3

Changes since previous beta:
The retention flag for MQTT messages can now be specified.

The Ground Station 3.0 beta is available via the NINA Plugin beta channel. Add https://nighttime-im...on/nina/v1/beta to Options > General > Plugin Repositories to access it.


  • chvvkumar likes this

#66 chvvkumar

chvvkumar

    Surveyor 1

  • *****
  • topic starter
  • Posts: 1,821
  • Joined: 03 Aug 2020
  • Loc: Cottleville, MO

Posted 14 September 2024 - 04:17 PM

From the Discord :
Ground Station 3.0 beta 3

Changes since previous beta:
The retention flag for MQTT messages can now be specified.

The Ground Station 3.0 beta is available via the NINA Plugin beta channel. Add https://nighttime-im...on/nina/v1/beta to Options > General > Plugin Repositories to access it.

Thank you! I got the beta installed, time to play with it.


  • flamidey likes this

#67 chvvkumar

chvvkumar

    Surveyor 1

  • *****
  • topic starter
  • Posts: 1,821
  • Joined: 03 Aug 2020
  • Loc: Cottleville, MO

Posted 14 September 2024 - 04:25 PM

Ok the Beta has everything I wanted for getting session data into HA. I will build my dashboard and post the steps here.


  • dswtan and flamidey like this

#68 chvvkumar

chvvkumar

    Surveyor 1

  • *****
  • topic starter
  • Posts: 1,821
  • Joined: 03 Aug 2020
  • Loc: Cottleville, MO

Posted 14 September 2024 - 06:31 PM

i guess to find a solution with loop interations

I think this will give you what you are looking for. I just finished setting up my dashboard.

 

Steps:

 

Ground Station:

  1. Install the beta version of Ground Station as flamidey described
  2. Next, in the plugin settings:
  • Turn on Image Publishing
  • Set image topic (I used Astro/NINA/image/latestimage)
  • Set metadata topic ( I used Astro/NINA/image/metadata)
  • Select the type of images you want published. I left them on Lights and Snapshots selected

NINA Sequencer:

I did not have to add the instruction for MQTT publish to get latest data in my testing. But I will have to test this more during actual imaging.

 

Home Assistant:

I use a seperate mqtt.yaml file to define my MQTT sensors. This is just the aforementioned file that you create next to your configuration.yaml file and is included in the configuration.yaml like so:

mqtt: !include mqtt.yaml

Within mqtt.yaml, I define my MQTT sensors like so:

sensor:
- name: "NINA Exposure Number"
    unique_id: 181wgN6NoA5rIh7
    icon: mdi:format-list-numbered
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.Image.ExposureNumber }}"

  - name: "NINA Exposure Time"
    unique_id: 6O0bPg897sd4Af6
    icon: mdi:camera-timer
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.Image.ExposureTime }}"

  - name: "NINA Total RMS"
    unique_id: lqasWp87B8bxg2b
    icon: mdi:chart-bell-curve
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.Image.RecordedRMS.Total }}"

  - name: "NINA PeakRA"
    unique_id: SrOKnMc14z27wF2
    icon: mdi:arrow-left-top
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.Image.RecordedRMS.PeakRA }}"

  - name: "NINA PeakDec"
    unique_id: YsU1rt89dKtzIco
    icon: mdi:arrow-oscillating
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.Image.RecordedRMS.PeakDec }}"

  - name: "NINA Camera Temperature"
    unique_id: PzdB7Q6OS07031c
    icon: mdi:camera-enhance
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.Camera.Temperature }}"

  - name: "NINA Filter Wheel Filter"
    unique_id: 3m0oTIh0O8S9HLf
    icon: mdi:movie-roll
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.FilterWheel.Filter }}"

  - name: "NINA Target Name"
    unique_id: 97lBCRvy8wE4arb
    icon: mdi:target
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.Target.Name }}"

  - name: "NINA Target Max Saturated Pixels"
    unique_id: FCyxR576V44cHxh
    icon: mdi:view-grid-compact
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.ImageStatistics.Max }}"

  - name: "NINA Star HFR"
    unique_id: j5EW6Nq8FZ5x54d
    icon: mdi:star-outline
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.StarDetectionAnalysis.HFR }}"

  - name: "NINA Star HFRStDev"
    unique_id: sbtXX96tN8Of7MD
    icon: mdi:star-three-points-outline
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.StarDetectionAnalysis.HFRStDev }}"

  - name: "NINA Star DetectedStars"
    unique_id: DXWiwoj57KGwo7K
    icon: mdi:star-settings
    state_topic: "Astro/NINA/image/metadata"
    value_template: "{{ value_json.ImageMetaData.StarDetectionAnalysis.DetectedStars }}"

# Gets the latest image from MQTT and creates a HA MQTT Camera
camera:
  - name: "NINA LatestImage"
    unique_id: VOWuYi4BGv1hr1X
    topic: "Astro/NINA/image/latestimage"
    qos: 1
    payload_available: "online"
    payload_not_available: "offline"

Quick reload HA config and you should have everything show up in HA as sensors 

 

 

2024-09-14_19-03-03.jpg


Edited by chvvkumar, 14 September 2024 - 07:04 PM.

  • flamidey likes this

#69 DanieleS

DanieleS

    Lift Off

  • -----
  • Posts: 15
  • Joined: 17 Feb 2021

Posted 15 September 2024 - 02:58 AM


    value_template: "{{ value_json.ImageMetaData.StarDetectionAnalysis.DetectedStars }}"


I also installed the beta. However, in the yaml you published the flip time is missing as a sensor. But i cant find in json:

 

{
    "ImageMetaData": {
        "WorldCoordinateSystem": null,
        "Sequence": {
            "Title": "nuova sequenza"
        },
        "Image": {
            "Id": 5,
            "ExposureStart": "2024-09-15T09:43:30.1588277Z",
            "ExposureMidPoint": "2024-09-15T09:43:35.5935124Z",
            "ExposureNumber": 4,
            "ImageType": "LIGHT",
            "Binning": "1x1",
            "ExposureTime": 10,
            "RecordedRMS": {
                "RA": 0,
                "Dec": 0,
                "Total": 0,
                "RAText": "RA: 0.00 (0.00\")",
                "DecText": "Dec: 0.00 (0.00\")",
                "TotalText": "Tot: 0.00 (0.00\")",
                "PeakRAText": "Peak RA: 0.00 (0.00\")",
                "PeakDecText": "Peak Dec: 0.00 (0.00\")",
                "Scale": 3.22289,
                "PeakRA": 0,
                "PeakDec": 0,
                "DataPoints": 0
            }
        },
        "Camera": {
            "BayerPattern": 0,
            "Id": "QHY294PROC-15ad71428ec385af",
            "Name": "QHY294PROC",
            "Binning": "1x1",
            "BinX": 1,
            "BinY": 1,
            "PixelSize": 4.63,
            "Temperature": -0.2,
            "Gain": 1,
            "Offset": 0,
            "ElectronsPerADU": null,
            "SetPoint": 0,
            "ReadoutModeIndex": 0,
            "ReadoutModeName": "11M MODE",
            "SensorType": 2,
            "BayerOffsetX": 0,
            "BayerOffsetY": 0,
            "USBLimit": 0
        },
        "Telescope": {
            "Name": "Newton",
            "FocalLength": 750,
            "FocalRatio": 5,
            "Altitude": 36.83694437854953,
            "Azimuth": 2.0924598170823927e-7,
            "Airmass": 1.665105858835866,
            "SideOfPier": 1,
            "Coordinates": {
                "RA": 16.941998996168532,
                "RAString": "16:56:31",
                "RADegrees": 254.12998494252798,
                "Dec": 90,
                "DecString": "90° 00' 00\"",
                "Epoch": 2,
                "DateTime": {
                    "Now": "2024-09-15T11:43:48.9992485+02:00",
                    "UtcNow": "2024-09-15T09:43:48.9992555Z",
                    "MinValue": "0001-01-01T00:00:00",
                    "MaxValue": "9999-12-31T23:59:59.9999999"
                }
            }
        },
        "Focuser": {
            "Name": "",
            "Position": null,
            "StepSize": null,
            "Temperature": null
        },
        "Rotator": {
            "Name": "",
            "MechanicalPosition": null,
            "Position": null,
            "StepSize": null
        },
        "FilterWheel": {
            "Name": "",
            "Filter": ""
        },
        "Target": {
            "Name": "",
            "Rotation": 0,
            "PositionAngle": 0,
            "Coordinates": {
                "RA": 0,
                "RAString": "00:00:00",
                "RADegrees": 0,
                "Dec": 0,
                "DecString": "00° 00' 00\"",
                "Epoch": 2,
                "DateTime": {
                    "Now": "2024-09-15T11:43:48.9992855+02:00",
                    "UtcNow": "2024-09-15T09:43:48.999287Z",
                    "MinValue": "0001-01-01T00:00:00",
                    "MaxValue": "9999-12-31T23:59:59.9999999"
                }
            }
        },
        "Observer": {
            "Latitude": 36.83694444444445,
            "Longitude": 14.76,
            "Elevation": 420
        },
        "WeatherData": {
            "CloudCover": null,
            "DewPoint": null,
            "Humidity": null,
            "Pressure": null,
            "SkyBrightness": null,
            "SkyQuality": null,
            "SkyTemperature": null,
            "StarFWHM": null,
            "Temperature": null,
            "WindDirection": null,
            "WindGust": null,
            "WindSpeed": null
        },
        "GenericHeaders": []
    },
    "ImageStatistics": {
        "BitDepth": 16,
        "StDev": 83.26087853866028,
        "Mean": 152.32694997070038,
        "Median": 136,
        "MedianAbsoluteDeviation": 60,
        "Max": 10780,
        "MaxOccurrences": 1,
        "Min": 0,
        "MinOccurrences": 271,
        "Histogram": [
            {
                "X": 0,
                "Y": 11638219
            },
            {
                "X": 1,
                "Y": 99
            },
            {
                "X": 2,
                "Y": 26
            },
            {
                "X": 3,
                "Y": 14
            },
            {
                "X": 4,
                "Y": 10
            },
            {
                "X": 5,
                "Y": 3
            },
            {
                "X": 6,
                "Y": 4
            },
            {
                "X": 7,
                "Y": 0
            },
            {
                "X": 8,
                "Y": 1
            },
            {
                "X": 9,
                "Y": 2
            },
            {
                "X": 10,
                "Y": 0
            },
            {
                "X": 11,
                "Y": 0
            },
            {
                "X": 12,
                "Y": 0
            },
            {
                "X": 13,
                "Y": 0
            },
            {
                "X": 14,
                "Y": 1
            },
            {
                "X": 15,
                "Y": 0
            },
            {
                "X": 16,
                "Y": 1
            },
            {
                "X": 17,
                "Y": 0
            },
            {
                "X": 18,
                "Y": 0
            },
            {
                "X": 19,
                "Y": 0
            },
            {
                "X": 20,
                "Y": 0
            },
            {
                "X": 21,
                "Y": 0
            },
            {
                "X": 22,
                "Y": 0
            },
            {
                "X": 23,
                "Y": 0
            },
            {
                "X": 24,
                "Y": 0
            },
            {
                "X": 25,
                "Y": 0
            },
            {
                "X": 26,
                "Y": 0
            },
            {
                "X": 27,
                "Y": 0
            },
            {
                "X": 28,
                "Y": 0
            },
            {
                "X": 29,
                "Y": 0
            },
            {
                "X": 30,
                "Y": 0
            },
            {
                "X": 31,
                "Y": 0
            },
            {
                "X": 32,
                "Y": 0
            },
            {
                "X": 33,
                "Y": 0
            },
            {
                "X": 34,
                "Y": 0
            },
            {
                "X": 35,
                "Y": 0
            },
            {
                "X": 36,
                "Y": 0
            },
            {
                "X": 37,
                "Y": 0
            },
            {
                "X": 38,
                "Y": 0
            },
            {
                "X": 39,
                "Y": 0
            },
            {
                "X": 40,
                "Y": 0
            },
            {
                "X": 41,
                "Y": 0
            },
            {
                "X": 42,
                "Y": 0
            },
            {
                "X": 43,
                "Y": 0
            },
            {
                "X": 44,
                "Y": 0
            },
            {
                "X": 45,
                "Y": 0
            },
            {
                "X": 46,
                "Y": 0
            },
            {
                "X": 47,
                "Y": 0
            },
            {
                "X": 48,
                "Y": 0
            },
            {
                "X": 49,
                "Y": 0
            },
            {
                "X": 50,
                "Y": 0
            },
            {
                "X": 51,
                "Y": 0
            },
            {
                "X": 52,
                "Y": 0
            },
            {
                "X": 53,
                "Y": 0
            },
            {
                "X": 54,
                "Y": 0
            },
            {
                "X": 55,
                "Y": 0
            },
            {
                "X": 56,
                "Y": 0
            },
            {
                "X": 57,
                "Y": 0
            },
            {
                "X": 58,
                "Y": 0
            },
            {
                "X": 59,
                "Y": 0
            },
            {
                "X": 60,
                "Y": 0
            },
            {
                "X": 61,
                "Y": 0
            },
            {
                "X": 62,
                "Y": 0
            },
            {
                "X": 63,
                "Y": 0
            },
            {
                "X": 64,
                "Y": 0
            },
            {
                "X": 65,
                "Y": 0
            },
            {
                "X": 66,
                "Y": 0
            },
            {
                "X": 67,
                "Y": 0
            },
            {
                "X": 68,
                "Y": 0
            },
            {
                "X": 69,
                "Y": 0
            },
            {
                "X": 70,
                "Y": 0
            },
            {
                "X": 71,
                "Y": 0
            },
            {
                "X": 72,
                "Y": 0
            },
            {
                "X": 73,
                "Y": 0
            },
            {
                "X": 74,
                "Y": 0
            },
            {
                "X": 75,
                "Y": 0
            },
            {
                "X": 76,
                "Y": 0
            },
            {
                "X": 77,
                "Y": 0
            },
            {
                "X": 78,
                "Y": 0
            },
            {
                "X": 79,
                "Y": 0
            },
            {
                "X": 80,
                "Y": 0
            },
            {
                "X": 81,
                "Y": 0
            },
            {
                "X": 82,
                "Y": 0
            },
            {
                "X": 83,
                "Y": 0
            },
            {
                "X": 84,
                "Y": 0
            },
            {
                "X": 85,
                "Y": 0
            },
            {
                "X": 86,
                "Y": 0
            },
            {
                "X": 87,
                "Y": 0
            },
            {
                "X": 88,
                "Y": 0
            },
            {
                "X": 89,
                "Y": 0
            },
            {
                "X": 90,
                "Y": 0
            },
            {
                "X": 91,
                "Y": 0
            },
            {
                "X": 92,
                "Y": 0
            },
            {
                "X": 93,
                "Y": 0
            },
            {
                "X": 94,
                "Y": 0
            },
            {
                "X": 95,
                "Y": 0
            },
            {
                "X": 96,
                "Y": 0
            },
            {
                "X": 97,
                "Y": 0
            },
            {
                "X": 98,
                "Y": 0
            },
            {
                "X": 99,
                "Y": 0
            },
            {
                "X": 100,
                "Y": 0
            }
        ]
    },
    "StarDetectionAnalysis": {
        "Metrics": {
            "StructureCandidates": 0,
            "TotalDetected": 0,
            "TooSmall": 0,
            "OnBorder": 0,
            "TooDistorted": 0,
            "TooDistortedBounds": [],
            "Degenerate": 0,
            "DegenerateBounds": [],
            "Saturated": 0,
            "SaturatedBounds": [],
            "LowSensitivity": 0,
            "LowSensitivityBounds": [],
            "NotCentered": 0,
            "NotCenteredBounds": [],
            "TooFlat": 0,
            "TooFlatBounds": [],
            "TooLowHFR": 0,
            "HFRAnalysisFailed": 0,
            "PSFFitFailed": 0,
            "OutsideROI": 0,
            "SaturatedPixelCount": 0,
            "HotpixelCount": 5907
        },
        "PSFType": 0,
        "PSFRSquared": null,
        "Sigma": null,
        "FWHM": null,
        "FWHMMAD": null,
        "Eccentricity": null,
        "EccentricityMAD": null,
        "MeasurementAverage": 0,
        "PixelScale": 1.2733414038987414,
        "HFR": 0,
        "HFRStDev": 0,
        "DetectedStars": 0,
        "StarList": []
    },
    "ImagePath": "C:\\Users\\spado\\Documents\\N.I.N.A\\2024-09-14\\LIGHT\\_T-0.20_Exp10.00s_G1_O0_0004.fits"
}


 


Edited by DanieleS, 15 September 2024 - 04:49 AM.


#70 chvvkumar

chvvkumar

    Surveyor 1

  • *****
  • topic starter
  • Posts: 1,821
  • Joined: 03 Aug 2020
  • Loc: Cottleville, MO

Posted 15 September 2024 - 04:59 AM

Unfortunately, flip time is not in the JSON, But it is a variable that Ground Station plugin has. I am publishing it from Ground Station plugin at the start of a target run as an instruction. Refer back to my sequence I attached, it's in there.


  • DanieleS likes this

#71 DanieleS

DanieleS

    Lift Off

  • -----
  • Posts: 15
  • Joined: 17 Feb 2021

Posted 15 September 2024 - 05:10 AM

Unfortunately, flip time is not in the JSON, But it is a variable that Ground Station plugin has. I am publishing it from Ground Station plugin at the start of a target run as an instruction. Refer back to my sequence I attached, it's in there.

then I take the flip time from the ASTRO/NINA/FLIPTIME topic, doing as in my previous screenshot with the interactions, so at the end of each shot I have the updated flip time data



#72 chvvkumar

chvvkumar

    Surveyor 1

  • *****
  • topic starter
  • Posts: 1,821
  • Joined: 03 Aug 2020
  • Loc: Cottleville, MO

Posted 15 September 2024 - 05:24 AM

then I take the flip time from the ASTRO/NINA/FLIPTIME topic, doing as in my previous screenshot with the interactions, so at the end of each shot I have the updated flip time data

Sounds right, but you may want to do that before a target starts, before each target begins and not after each shot. Flip time won't change during the run. This is why I have an initial MQTT update in my sequence for things that don't need to update frequently (like mount home/parked status, target name, flip time etc.).


Edited by chvvkumar, 15 September 2024 - 05:26 AM.


#73 DanieleS

DanieleS

    Lift Off

  • -----
  • Posts: 15
  • Joined: 17 Feb 2021

Posted 15 September 2024 - 08:16 AM

Sounds right, but you may want to do that before a target starts, before each target begins and not after each shot. Flip time won't change during the run. This is why I have an initial MQTT update in my sequence for things that don't need to update frequently (like mount home/parked status, target name, flip time etc.).

I actually wanted to say how much time is left until the Merdian Flip


  • chvvkumar likes this

#74 chimeralaw

chimeralaw

    Explorer 1

  • -----
  • Posts: 61
  • Joined: 13 Oct 2020
  • Loc: Canberra, Australia

Posted 15 September 2024 - 07:59 PM

Please forgive my ignorance but what sends the MQTT payload now? So previously, there was a Publish to MQTT broker for specific events like camera. But now, the only Topic is Astro/NINA/image/metadata which has lots of payload messages. 



#75 chvvkumar

chvvkumar

    Surveyor 1

  • *****
  • topic starter
  • Posts: 1,821
  • Joined: 03 Aug 2020
  • Loc: Cottleville, MO

Posted 15 September 2024 - 08:26 PM

Sorry to ask this but I am getting a bit lost with the direction of this wonderful thread. I initially used the GroundStation.SendToMqtt for the topics I was interested in. I was running a parallel Instruction set with all the MQTT payloads but now @chvvkumar says: NINA Sequencer:

I did not have to add the instruction for MQTT publish to get latest data in my testing. But I will have to test this more during actual imaging. I am sort of lost as to what gets sent to where. 

Thanks

Basically, it looks like with the new beta version of the plugin, GS will automatically send a message after an exposure is taken. And the plugin now sends a large JSON message with various parameters like DanieleS posted in post #69. All of this gets sent to the MQTT broker after every image (you can set what types of images trigger this in the plugin settings). Once it is published, my code in post #68 will create entities within Home Assistant that use data from this topic.

 

The last few comments about meridian flip were because the large JSON at this time does not publish flip time to Astro/NINA/image/metadata. So for that information, you still have to trigger an MQTT publish like you do now.


Edited by chvvkumar, 15 September 2024 - 08:28 PM.



CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.


Recent Topics






Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics