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

#26 chvvkumar

chvvkumar

    Surveyor 1

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

Posted 09 December 2023 - 01:24 PM

Sure you can make a plugin that implements a HTTP service that utters JSON blobs for a given URI and have HA poll that. It's a matter of push vs. pull. MQTT facilitates NINA pushing the information to a broken upon its creation, and clients would then pick that up and do with it what they may. A cursory google search shows this is possible with HA?

Yes, that will work too, many ways to skin the cat in HA. Whichever way is more maintainable is what I would vote for.



#27 Astrofather

Astrofather

    Lift Off

  • -----
  • Posts: 7
  • Joined: 12 Oct 2020
  • Loc: Madrid

Posted 09 December 2023 - 01:48 PM

That looks correct, you said you could not connect to the broker from the plugin, correct? Can you try with the following:

 

1. Disable 'Use TLS' in the plugin settings for ground station to rule out trust issues between the plugin and the broker

2. Disable user name and password on the MQTT broker and try it without a username/password to rule out authentication issues

Thanks for your time with this, TLS option was disabled, tried without a username/password and always MQTT Error (Failed to send message to MQTT). As said before, the same test with MQTT Explorer is sending the messages to HA without any problem. Same machine and LAN.

I´ve already unistall and install the plugin to check, but same result. I´ve a question regarding Client ID Prefix, do I need to use it?



#28 chvvkumar

chvvkumar

    Surveyor 1

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

Posted 09 December 2023 - 02:19 PM

Thanks for your time with this, TLS option was disabled, tried without a username/password and always MQTT Error (Failed to send message to MQTT). As said before, the same test with MQTT Explorer is sending the messages to HA without any problem. Same machine and LAN.

I´ve already unistall and install the plugin to check, but same result. I´ve a question regarding Client ID Prefix, do I need to use it?

Once again check your IP host name or address. If possible, please post screenshots of tthe MQTT config page of the plugin and MQTT explorer.

 

I just tried without any fields populated on the plugin settings other than the broker address and port and was able to send a message to the broker from my desktop (192.168.1.50). My MQTT explorer runs inside HA (192.168.1.30) and my broker is on a third machine (192.168.1.250).

 

l5WyHBa.jpg

 

CgMWeo5.jpg


Edited by chvvkumar, 09 December 2023 - 02:25 PM.


#29 junktrunk

junktrunk

    Explorer 1

  • -----
  • Posts: 87
  • Joined: 09 Nov 2019

Posted 10 December 2023 - 01:59 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).

 

 

Screenshot 2023-12-10 005729.png



#30 Astrofather

Astrofather

    Lift Off

  • -----
  • Posts: 7
  • Joined: 12 Oct 2020
  • Loc: Madrid

Posted 10 December 2023 - 06:13 AM

Once again check your IP host name or address. If possible, please post screenshots of tthe MQTT config page of the plugin and MQTT explorer.

 

I just tried without any fields populated on the plugin settings other than the broker address and port and was able to send a message to the broker from my desktop (192.168.1.50). My MQTT explorer runs inside HA (192.168.1.30) and my broker is on a third machine (192.168.1.250).

 

l5WyHBa.jpg

 

CgMWeo5.jpg

Thanks chvvkumar for your support with this issue. Attached you can see how Ground Station plugin is configured, the connection with MQTT Explorer, a reading in the HA sensor sent from MQTT Explorer, and the error message that I always get from NINA. NINA, MQTT server (configured in HA), and MQTT Explorer are in the same LAN (192.168.8.xx/24).

RegardsSENSOR WITH VALUES SENT FROM MQTT EXPLORER.jpg NINA ERROR MESSAGE.jpg MQTT NINA_EXPLORER.jpg



#31 chvvkumar

chvvkumar

    Surveyor 1

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

Posted 10 December 2023 - 09:42 AM

Thanks chvvkumar for your support with this issue. Attached you can see how Ground Station plugin is configured, the connection with MQTT Explorer, a reading in the HA sensor sent from MQTT Explorer, and the error message that I always get from NINA. NINA, MQTT server (configured in HA), and MQTT Explorer are in the same LAN (192.168.8.xx/24).

Regardsattachicon.gif SENSOR WITH VALUES SENT FROM MQTT EXPLORER.jpgattachicon.gif NINA ERROR MESSAGE.jpgattachicon.gif MQTT NINA_EXPLORER.jpg

I think there is the issue, remove "http://" from the broker address.


Edited by chvvkumar, 10 December 2023 - 09:43 AM.

  • dghent and Astrofather like this

#32 dghent

dghent

    N.I.N.A. (& More)

  • *****
  • Freeware Developers
  • Posts: 2,241
  • Joined: 10 Jun 2007
  • Loc: Maryland, US

Posted 10 December 2023 - 11:31 AM

Yes, the address is a hostname or IP; it's not a URL.


  • chvvkumar likes this

#33 ispybadguys

ispybadguys

    Viking 1

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

Posted 10 December 2023 - 04:17 PM

So this sudden increase in interest in telemetry has me thinking of extending Ground Station some more in the MQTT department. Right now its MQTT implementation is mostly sequence-oriented, with an explicit publish instruction and a trigger that reports sequence failures. The Last Will & Testament stuff is of course independent of any sequence.

 

NINA periodically polls hardware every 2 seconds by default. There's a poll loop for each hardware type - camera, mount, focuser, etc. and a event handler can be registered so that it is ran each time this occurs. There are also events that fire for both stages for the image saving pipeline - once when an image is initially acquired, and later when stats have been computed for the image and it has been saved to disk. Obviously that second event can happen at a relatively random time, with stats computation taking a varying amount of time based on the CPU of the system doing it. My InfluxDB plugin (not released, I need to find more free time to touch it up) uses the above facilities to transmit hardware and image metrics to a given influxdb instance - there are no sequence instructions involved.

 

I'm thinking I can take that same scheme and set up similar event handlers in Ground Station's existing MQTT code in order to constantly transmit the same stats to a broker. I'd probably just make a simple JSON blob per hardware type and it would publish that blob to a per-device class topic on the broker - nina/mount, nina/camera, etc. I purposefully want to keep that part simple because I really don't like, and don't think it's necessary to implement a list of configuration knobs that's as long as my arm that covers every single little metric and a topic endpoint. Perhaps I can work on this over the coming holidays.

That sound great. What I would really kill for is an Observing Conditions Driver that pulled data from MQTT and allowed us to do safety conditions. I seems simple to me but the learning curve is to steep for me having never written a single line of Windows code and haven't even driven the Studio IDE.

 

Kurt


Edited by ispybadguys, 10 December 2023 - 04:20 PM.


#34 ispybadguys

ispybadguys

    Viking 1

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

Posted 10 December 2023 - 10:52 PM

Sure you can make a plugin that implements a HTTP service that utters JSON blobs for a given URI and have HA poll that. It's a matter of push vs. pull. MQTT facilitates NINA pushing the information to a broken upon its creation, and clients would then pick that up and do with it what they may. A cursory google search shows this is possible with HA?



#35 ispybadguys

ispybadguys

    Viking 1

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

Posted 10 December 2023 - 10:55 PM

I am gathering JSON and unformatted values using both REST and MQTT with equal ease. MQTT is easier and more reliable for my IOT devices based on ESP32's.

Kurt

#36 Bob Denny

Bob Denny

    ASCOM Initiative

  • -----
  • Organization
  • Posts: 1,297
  • Joined: 17 Mar 2009
  • Loc: Mesa AZ USA

Posted 11 December 2023 - 04:14 PM

That sound great. What I would really kill for is an Observing Conditions Driver that pulled data from MQTT and allowed us to do safety conditions. I seems simple to me but the learning curve is to steep for me having never written a single line of Windows code and haven't even driven the Studio IDE.

 

Kurt

How about Python or C++ and not on Windows? You can write an Alpaca driver using the AlpycaDevice SDK. Several people  have already used it to make Alpaca drivers. Alpaca is REST and this SDK is cross platform. Any app on Windows including NINA can access an Alpaca-speaking device anywhere on the LAN (no public net!!) by virtue of the ASCOM Platform Chooser on WIndows.

 

The Observatorio El Sauce (120+ scopes in Chile) made an Alpaca ObservingConditions and SafetyMonitor feed using AlpycaDevice SDK on a Linux system in just two days! Now all NINA, SGP, ACP, can use this. 

 

Also several people have recently popped up  with ESP32's speaking Alpaca. Here's an Alpaca ObservingConditions device using an ESP32 and C++.  If you want to try to cram your MQTT stuff and the Alpaca stuff onto an ESP32, it may get tight :-) 


Edited by Bob Denny, 11 December 2023 - 04:18 PM.

  • ispybadguys likes this

#37 ispybadguys

ispybadguys

    Viking 1

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

Posted 11 December 2023 - 05:48 PM

Thanks Bob. I'll take a look at this. I wonder if it could be done all in Home Assistant? I had an ESP32 running my ROR and one running an observing conditions monitor and pulling data vis REST from Openweather, WeatherflowTempest,Pegasus Uranus, and PWI4 for my L350. The OC monitor would disconnect and the NINA would dump my night so I would like something more reliable.

 

Kurt



#38 Bob Denny

Bob Denny

    ASCOM Initiative

  • -----
  • Organization
  • Posts: 1,297
  • Joined: 17 Mar 2009
  • Loc: Mesa AZ USA

Posted 11 December 2023 - 06:27 PM

Well there is always that problem (not having a reliable source of weather) grin.gif . One would expect the SafetyMonitor to report "unsafe" if the weather was not available.

 

I had no idea what Home Assistant is so I looked. I see "Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server." Alpyca (the Python client package for Alpaca) and AlpycaDevice SDK were developed on a Raspberry Pi (4B/64) to assure cross-platform-ness. I would recommend becoming at least fairly familiar with Alpaca before jumping in. See our Alpaca Developer's web site area. You wouldn't have to get into the blood and guts though as AlpycaDevice has all of the boiler plate. But you do need to know what's going on and why.

 

One good self-teaching tool is the Omni Simulators app. It provides Alpaca-speaking simulators for all ASCOM devices, usable from any Windows ASCOM app even though running on a Linux or Max, or Pi, or (of course) Windows. Fire it up and use this link to get to its OpenAPI/Swagger API browser. Great teaching tool.


  • ispybadguys likes this

#39 dj19476

dj19476

    Lift Off

  • -----
  • Posts: 9
  • Joined: 08 May 2017

Posted 13 December 2023 - 02:10 PM

i stumbled upon this great  topic a few days ago. i configured mqtt broken on home assistent (on a virtual pc), i can send test message from nina pc to home assistent.

i made a sensor .yaml and added the name to configuration.yaml.

but how do i add the sensors to the dashboard and/or add the dashboard.yaml to home assistent?

i can copy/paste  code but have no idea how to write code. grin.gif

 

i did a lot of searching but can't find out what i'm missing.


Edited by dj19476, 13 December 2023 - 02:10 PM.

  • chimeralaw likes this

#40 chvvkumar

chvvkumar

    Surveyor 1

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

Posted 13 December 2023 - 02:16 PM

i stumbled upon this great  topic a few days ago. i configured mqtt broken on home assistent (on a virtual pc), i can send test message from nina pc to home assistent.

i made a sensor .yaml and added the name to configuration.yaml.

but how do i add the sensors to the dashboard and/or add the dashboard.yaml to home assistent?

i can copy/paste  code but have no idea how to write code. grin.gif

 

i did a lot of searching but can't find out what i'm missing.

You don't have to edit dashboard code directly. Click the three dots on the top right of a dashboard, click edit, and add an appropriate card and configure the card with the entities you want. You can do all of it through the GUI.



#41 dj19476

dj19476

    Lift Off

  • -----
  • Posts: 9
  • Joined: 08 May 2017

Posted 13 December 2023 - 02:34 PM

thanks for the quick reply.

when i add a card and choose an entity, i can see one mqtt sensor (nina imaging)

i think i made this for a test. do the sensor become visible in HA after beeing send from nina? that would explain it..

i'm a big step further.

 

edit: YES. i made a configuration error in configuration.yaml. sensors are visible and the data is transferred from nina pc (when i click the button i can see camera info) .


Edited by dj19476, 13 December 2023 - 03:06 PM.


#42 Astrofather

Astrofather

    Lift Off

  • -----
  • Posts: 7
  • Joined: 12 Oct 2020
  • Loc: Madrid

Posted 13 December 2023 - 07:07 PM

I think there is the issue, remove "http://" from the broker address.

Sorry for not responding sooner, I have been traveling. Thank you very much for your help, that was indeed the problem! everything is working. Thanks again for your help.


  • chvvkumar likes this

#43 Astrofather

Astrofather

    Lift Off

  • -----
  • Posts: 7
  • Joined: 12 Oct 2020
  • Loc: Madrid

Posted 13 December 2023 - 07:09 PM

Yes, the address is a hostname or IP; it's not a URL.

Thanks Dale! is working now. Your plugin is awesome.


  • chvvkumar likes this

#44 ispybadguys

ispybadguys

    Viking 1

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

Posted 14 December 2023 - 09:09 AM

I am pulling data using REST from my Pegasus Uranus and UPBv2 box. It took me a while because I need to get the Unique Keys and then use them in the HTTP request. I can get my dew heaters, could conditions, and SQM this way. I was going to put some roof status but my Indi-All-Sky camera posts each image to the MQTT broker and I can verify the roof is open or closed in a glance. I feel better about that rather than looking at the state of a roof switch.

 

The M5STACK ESP32 driving my roof does a REST GET to retrieve all of the mount data from my L350 and posts this to the MQTT broker that HA accesses. I do this to verify roof clearance in addition to checking a photo cell that looks at a reflector on the back of the scope to provide additional storage verification.

 

BTW I found an interesting MQTT Broker at shiftr.io that has a nice display that shows what data is going where. I might switch my mosquitto broker out for this. 

 

(edited I streamlined the YAML here and added the UBPV2 Power Sensor and showed the MQTT entries for getting the Indi-All-Sky Camera)

 

Kurt

################################### MQTT SENSORS #####################################
mqtt:
  sensor:
    - name: "Mount Altitude"
      state_topic: "L350/mount.altitude_degs"
      unit_of_measurement: "°"
      unique_id: "mount_altitude_sensor"
      value_template: "{{ value | round(2) }}"
   
    - name: "Mount Azimuth"
      state_topic: "L350/mount.azimuth_degs"
      unit_of_measurement: "°"
      unique_id: "mount_azimuth_sensor"
      value_template: "{{ value | round(2) }}"

    - name: "Mount Axis 0 Current"
      state_topic: "L350/mount.axis0.measured_current_amps"
      unit_of_measurement: "A"
      unique_id: "mount_axis0_current"
      value_template: "{{ value | round(2) }}"
   
    - name: "Mount Axis 1 Current"
      state_topic: "L350/mount.axis1.measured_current_amps"
      unit_of_measurement: "A"
      unique_id: "mount_axis1_current"
      value_template: "{{ value | round(2) }}"
   
    - name: "Mount Axis 0 RMS"
      state_topic: "L350/mount.axis0.rms_error_arcsec"
      unit_of_measurement: "\""
      unique_id: "mount_axis0_rms_error_arcsec"
      value_template: "{{ value | round(2) }}"

    - name: "Mount Axis 1 RMS"
      state_topic: "L350/mount.axis1.rms_error_arcsec"
      unit_of_measurement: "\""
      unique_id: "mount_axis1_rms_error_arcsec"
      value_template: "{{ value | round(3) }}"

    - name: "indi_allsky_stars"
      state_topic: "indi-allsky/stars"
      unique_id: "indi_allsky_stars"
 
  camera:
    name: "Indi Allsky Latest"
    topic: "indi-allsky/latest"
    unique_id: "indi_allsky_latest_camera"
    encoding: "jpeg"

################################### URANUS SENSORS #####################################
sensor:
  - platform: template
    sensors:
      upbv2_sensor:
        friendly_name: "UPBv2 Sensor"
        value_template: "{{ state_attr('sensor.connected_devices', 'data') | selectattr('name', 'equalto', 'UPBv2') | map(attribute='uniqueKey') | list | first }}"

  - platform: rest
    name: "Connected Devices"
    resource: "http://192.168.1.15:32000/Server/DeviceManager/Connected"
    json_attributes:
      - data
    value_template: OK

  - platform: rest
    name: "upbv2_dew_report"
    resource_template: "http://192.168.1.15:32000/Driver/UPBv2/Dew/Hub/Status?DriverUniqueKey={{ state_attr('sensor.connected_devices', 'data') | selectattr('name', 'equalto', 'UPBv2') | map(attribute='uniqueKey') | list | first }}"
    method: GET
    json_attributes:
      - data
    value_template: OK

  - platform: rest
    name: "power_readings_report"
    resource_template: "http://192.168.1.15:32000/Driver/UPBv2/Report/Power?DriverUniqueKey={{ state_attr('sensor.connected_devices', 'data') | selectattr('name', 'equalto', 'UPBv2') | map(attribute='uniqueKey') | list | first }}"
    method: GET
    json_attributes:
      - data
    value_template: OK

  - platform: rest
    name: "uranus_report"
    resource_template: "http://192.168.1.15:32000/Driver/Uranus/Report?DriverUniqueKey={{ state_attr('sensor.connected_devices', 'data') | selectattr('name', 'equalto', 'Uranus') | map(attribute='uniqueKey') | list | first }}"
    method: GET
    json_attributes:
      - data
    value_template: OK

  - platform: template
    sensors:
      uranus_temperature:
        friendly_name: "Uranus Temperature"
        unique_id: uranus_temperature
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['temperature']['temperature'] | float }}"
        unit_of_measurement: "°C"

      uranus_humidity:
        friendly_name: "Uranus Humidity"
        unique_id: uranus_humidity
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['relativeHumidity']['percentage'] }}"
        unit_of_measurement: "%"

      uranus_pressure:
        friendly_name: "Uranus Pressure"
        unique_id: uranus_pressure
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['absolutePressure']['hPa'] }}"
        unit_of_measurement: "hPa"

      uranus_dew_point:
        friendly_name: "Uranus Dew Point"
        unique_id: uranus_dew_point
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['dewPoint']['temperature'] }}"
        unit_of_measurement: "°C"

      uranus_relative_pressure:
        friendly_name: "Uranus Relative Pressure"
        unique_id: uranus_relative_pressure
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['relativePressure']['hPa'] }}"
        unit_of_measurement: "hPa"

      uranus_altitude:
        friendly_name: "Uranus Altitude"
        unique_id: uranus_altitude
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['barometricAltitude']['meters'] }}"
        unit_of_measurement: "m"

      uranus_sky_quality:
        friendly_name: "Uranus Sky Quality"
        unique_id: uranus_sky_quality
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['skyQuality']['mpsas'] }}"
        unit_of_measurement: "mpsas"

      uranus_nelm:
        friendly_name: "Uranus Naked Eye Limit Magnitude"
        unique_id: uranus_nelm
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['nelm']['vMag'] }}"

      uranus_illuminance:
        friendly_name: "Uranus Illuminance"
        unique_id: uranus_illuminance
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['illuminance']['lux'] }}"
        unit_of_measurement: "lux"

      uranus_temperature_difference:
        friendly_name: "Uranus Temperature Difference"
        unique_id: uranus_temperature_difference
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['temperatureDifference']['temperature'] }}"
        unit_of_measurement: "°C"

      uranus_cloud_coverage:
        friendly_name: "Uranus Cloud Coverage"
        unique_id: uranus_cloud_coverage
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['cloudCoverage']['percentage'] }}"
        unit_of_measurement: "%"

      uranus_sky_temperature:
        friendly_name: "Uranus Sky Temperature"
        unique_id: uranus_sky_temperature
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['skyTemperature']['temperature'] }}"
        unit_of_measurement: "°C"

      uranus_latitude:
        friendly_name: "Uranus Latitude"
        unique_id: uranus_latitude
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['latitude']['dd']['decimalDegree'] }}"
        unit_of_measurement: "°"

      uranus_longitude:
        friendly_name: "Uranus Longitude"
        unique_id: uranus_longitude
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['longitude']['dd']['decimalDegree'] }}"
        unit_of_measurement: "°"

      uranus_total_satellites:
        friendly_name: "Uranus Total Satellites"
        unique_id: uranus_total_satellites
        value_template: "{{ state_attr('sensor.uranus_report', 'data')['message']['totalSatellites'] }}"
      upbv2_port1_current:
        friendly_name: "UPBv2 Port 1 Current"
        unit_of_measurement: "A"
        value_template: "{{ state_attr('sensor.upbv2_dew_report', 'data').message.hub[0].current.value | round(3)}}"

      upbv2_port1_power:
        friendly_name: "UPBv2 Port 1 Heater Power"
        unit_of_measurement: "W"
        value_template: "{{ state_attr('sensor.upbv2_dew_report', 'data').message.hub[0].port.power | round(3) }}"

      upbv2_port2_current:
        friendly_name: "UPBv2 Port 2 Heater Current"
        unit_of_measurement: "A"
        value_template: "{{ state_attr('sensor.upbv2_dew_report', 'data').message.hub[1].current.value | round(3) }}"

      upbv2_port2_power:
        friendly_name: "UPBv2 Port 2 Heater Power"
        unit_of_measurement: "W"
        value_template: "{{ state_attr('sensor.upbv2_dew_report', 'data').message.hub[1].port.power | round(3) }}"

      upbv2_port3_current:
        friendly_name: "UPBv2 Port 3 Heater Current"
        unit_of_measurement: "A"
        value_template: "{{ state_attr('sensor.upbv2_dew_report', 'data').message.hub[2].current.value | round(3) }}"

      upbv2_port3_power:
        friendly_name: "UPBv2 Port 3 Heater Power"
        unit_of_measurement: "W"
        value_template: "{{ state_attr('sensor.upbv2_dew_report', 'data').message.hub[2].port.power | round(3) }}"

      upbv2_current:
        friendly_name: "upbv2_current"
        unit_of_measurement: "A"
        value_template: "{{ state_attr('sensor.power_readings_report', 'data').message.current | round(3) }}"

      upbv2_power:
        friendly_name: "upbv2_power"
        unit_of_measurement: "W"
        value_template: "{{ state_attr('sensor.power_readings_report', 'data').message.power | round(3) }}"       
template:
  - trigger:
      platform: homeassistant
      event: start
    action:
      - delay: 00:00:10
      - repeat:
          while:
            - condition: template
              value_template: "{{ states('sensor.Connected Devices') == 'unavailable' }}"
          sequence:
            - service: homeassistant.update_entity
              entity_id: sensor.connected_devices
            - delay: 00:00:01

############################# URANUS Automations #################################
automation:

  - id: 'periodic_uranus_report_update'
    alias: Periodic Update Uranus Report
    trigger:
      - platform: time_pattern
        seconds: "/10"  # Adjust this as needed for your desired interval
    action:
      - service: homeassistant.update_entity
        target:
          entity_id: sensor.connected_devices
      - delay: '00:00:03'  # Adjust the delay time as needed  
      - service: homeassistant.update_entity
        target:
          entity_id: sensor.uranus_report,sensor.upbv2_dew_report

Edited by ispybadguys, 14 December 2023 - 03:29 PM.


#45 dj19476

dj19476

    Lift Off

  • -----
  • Posts: 9
  • Joined: 08 May 2017

Posted 14 December 2023 - 09:22 AM

thanks for all the help! this is a great topic!

 

i added all the sensors to my dashboard. when i start the sequence the data is send to HA.

however, the data isn't refreshed.

is it possible to configure the sequence  in NINA to refresh the sensor data every 5min of so? (when i stop the sequence the last sensor data remains in HA)

or did i make another config mistake in HA?

i used the json sequence mentioned above (page 1).



#46 chvvkumar

chvvkumar

    Surveyor 1

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

Posted 14 December 2023 - 11:10 AM

thanks for all the help! this is a great topic!

 

i added all the sensors to my dashboard. when i start the sequence the data is send to HA.

however, the data isn't refreshed.

is it possible to configure the sequence  in NINA to refresh the sensor data every 5min of so? (when i stop the sequence the last sensor data remains in HA)

or did i make another config mistake in HA?

i used the json sequence mentioned above (page 1).

The last data will persist unless you clear it by sending a blank message. I update my MQTT before and after every sequence step and I have attached my sequence to the first post if you want to take a look.



#47 ispybadguys

ispybadguys

    Viking 1

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

Posted 20 December 2023 - 09:53 AM

I am wondering if you experts out there know if you can run an ASCOM Alpaca Server from HA. There its a python implementation here https://ascom-standa...ml#installation.

 

I don't code Python but I have a book on it that I might be motivated to read.

 

My interest is that I gather all of my weather data from openweathermap and from my local Tempest station in HA. If I could build an Observing Conditions server in HA that would be pretty simple I could then probably build an Alpaca Server for the ROR controller and get a nearly zero hardware solution.

 

Kurt


  • chvvkumar likes this

#48 ispybadguys

ispybadguys

    Viking 1

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

Posted 21 December 2023 - 12:09 AM

I am making a little progress I downloaded the Alpaca SDK here https://github.com/A...e/AlpycaDevice# It has some detailed instructions of only a few steps, so necessary for some one in the python zero state like me, on how to configure a test an Alpaca Server. The have complete server codes for all devices with nice areas marked that say ## put your code for x here ##.

 

Maybe I will only have to learn a couple of things about Python. Since I am a lazy old engineer that might work for me. This seems promising.

 

Kurt



#49 chvvkumar

chvvkumar

    Surveyor 1

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

Posted 23 December 2023 - 03:10 PM

Finally got my AllSky camera setup over the last few days. The status of my dashboard so far:

 

Clipboard01.png


Edited by chvvkumar, 23 December 2023 - 04:36 PM.

  • dghent likes this

#50 ispybadguys

ispybadguys

    Viking 1

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

Posted 24 December 2023 - 01:12 AM

Well there is always that problem (not having a reliable source of weather) grin.gif . One would expect the SafetyMonitor to report "unsafe" if the weather was not available.

 

I had no idea what Home Assistant is so I looked. I see "Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server." Alpyca (the Python client package for Alpaca) and AlpycaDevice SDK were developed on a Raspberry Pi (4B/64) to assure cross-platform-ness. I would recommend becoming at least fairly familiar with Alpaca before jumping in. See our Alpaca Developer's web site area. You wouldn't have to get into the blood and guts though as AlpycaDevice has all of the boiler plate. But you do need to know what's going on and why.

 

One good self-teaching tool is the Omni Simulators app. It provides Alpaca-speaking simulators for all ASCOM devices, usable from any Windows ASCOM app even though running on a Linux or Max, or Pi, or (of course) Windows. Fire it up and use this link to get to its OpenAPI/Swagger API browser. Great teaching tool.

I have been working on the SDK you recommended. This is great! Very nice work. I especially like the step by step detailed instructions which enabled me to get it running in Python3 under windows. I installed the Python3 extensions in HA and I understand that any of the sensor values in HA can be accessed by your Python script so there is the path to making an OC server.

 

The value of HA is that it has a lot of plugin's that access a huge number of devices. In my case I just added the WeatherFlow integration which magically grabbed real-time weather data from my Tempest sensor and made internal sensor values for everything. The I wrote a simple REST interface and pulled Sky Data from my Uranus sensor. Another integration and in two clicks I have current data from OpenWeatherMap. I added and MQTT integration and got my roof state. So when my roof is closed there is no rain on my Uranus but it sees the roof and not the sky so I will use OpenWeather to give me approximate cloud cover. Using the SDK I feel confident that I can, with my extremely limited understanding of Python, craft an Alpaca OC server to serve this data to NINA. The other great attraction of HA is that it is really easy to build nice displays. It also has integrations that can control smart switches and even ESP32 devices so I think I could host an Alpaca Dome Server and probably a nice sophisticated Alpaca Safety Monitor. I see that I could access other ASCOM devices so I could display and plot other data in a HA dashboard. HA dashboards can be displayed on your phone of tablet. Right now I do this using RealVNC but displaying a 4K screen on my phone is only barely workable.

 

In my experience with NINA when my OC Server fails the Safety Monitor goes unsafe. 99% of the time it is safe. What I would like is two levels of safe. Unsafe do to poor conditions  like clouds or smoke and unsafe due to conditions that make demand to close the. NINA can park my scope and close the cover in the former and My ROR will force a park and close the roof on rain.

 

Kurt


  • chvvkumar likes this


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